473,588 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lightning Calculator

I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.

If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:

f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
....

You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.

What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.

This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.

Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[])
{

time_t t1, t0;
double elapsed;

time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;

}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE") ;
return EXIT_SUCCESS;

}

Aug 20 '05 #1
10 1300
Co********@gmai l.com wrote:
....
This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.


The commented code does not have the same effect as the addition code.

Back to the drawing board.

BTW - I would be very surprised if this has a really significant
performance difference (when you get the code right).
Aug 20 '05 #2
Co********@gmai l.com wrote:
I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.

If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:

f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
...

You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.

What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.

This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.

Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[])
{

time_t t1, t0;
double elapsed;

time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;

}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE") ;
return EXIT_SUCCESS;

}


Sounds bogus to me. Here are two routines:

typedef unsigned char u_char;

inline
u_char sum ( u_char a, u_char b ) {
if ( a == 0 && b == 0 ) return 0;
if ( a == 0 && b == 1 ) return 1;
if ( a == 0 && b == 2 ) return 2;
if ( a == 0 && b == 3 ) return 3;
if ( a == 0 && b == 4 ) return 4;
if ( a == 0 && b == 5 ) return 5;
if ( a == 0 && b == 6 ) return 6;
if ( a == 0 && b == 7 ) return 7;

if ( a == 1 && b == 0 ) return 1;
if ( a == 1 && b == 1 ) return 2;
if ( a == 1 && b == 2 ) return 3;
if ( a == 1 && b == 3 ) return 4;
if ( a == 1 && b == 4 ) return 5;
if ( a == 1 && b == 5 ) return 6;
if ( a == 1 && b == 6 ) return 7;
if ( a == 1 && b == 7 ) return 8;

if ( a == 2 && b == 0 ) return 2;
if ( a == 2 && b == 1 ) return 3;
if ( a == 2 && b == 2 ) return 4;
if ( a == 2 && b == 3 ) return 5;
if ( a == 2 && b == 4 ) return 6;
if ( a == 2 && b == 5 ) return 7;
if ( a == 2 && b == 6 ) return 8;
if ( a == 2 && b == 7 ) return 9;

if ( a == 3 && b == 0 ) return 3;
if ( a == 3 && b == 1 ) return 4;
if ( a == 3 && b == 2 ) return 5;
if ( a == 3 && b == 3 ) return 6;
if ( a == 3 && b == 4 ) return 7;
if ( a == 3 && b == 5 ) return 8;
if ( a == 3 && b == 6 ) return 9;
if ( a == 3 && b == 7 ) return 10;

if ( a == 4 && b == 0 ) return 4;
if ( a == 4 && b == 1 ) return 5;
if ( a == 4 && b == 2 ) return 6;
if ( a == 4 && b == 3 ) return 7;
if ( a == 4 && b == 4 ) return 8;
if ( a == 4 && b == 5 ) return 9 ;
if ( a == 4 && b == 6 ) return 10;
if ( a == 4 && b == 7 ) return 11;

return 0;

}

inline
u_char sum1 ( u_char a, u_char b ) {
return( a + b );
}

Would you expect sum1 to be faster? You are right that it does not add,
however it performs quite a few tests, which also cost time.

Best

Kai-Uwe Bux
Aug 20 '05 #3

<Co********@gma il.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.

If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:

f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
...

You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.

What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.

This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.

Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[])
{

time_t t1, t0;
double elapsed;

time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;

}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE") ;
return EXIT_SUCCESS;

}


Corey, what makes you think the commented lines are faster than the addtion
operator?

As far as I know, and assuming no compiler optimization is used, each
commented line can be translated into two subtraction (SUB) operations
(comparison on integers is substraction and check zero), a logical AND
operation, and a very slow (as compared to addtion and subtraction) jump
(JMP) operation, followed by an assignment (MOV) operation. So far you have
x and y, result of (x==0), result of (y==577), result of (x==0 && y==577),
it is unlikely that all operands are stored in register for fast access.

A simple addtion is just an addtion (ADD) operation plus an assignment
operation. And because only x, y and result of x+y are stored and read (the
result of x+y naturally in the ACC), it is likely that the whole operation
is done on registers, which means very fast.

With compiler optimization, the compiler probably sees the definition of x
and y followed by assignment to x and y, so the values of x and y within the
iteration scope are entirely predictable (x = 577 and y = 1154), that it
wouldn't bother to add anyway.

Finally, the uncommented code is much more explicit, simple, readable than
the one you devised.

Regards,
Ben
Aug 20 '05 #4
Aha, so you want to see this in assembly, and you want this to work in
a way that actually saves time even when working with cases that are
not as special as an addition operation on two variables that have
values you can be sure of.

Try this piece of code that uses inline assembly and does a bit of
division. The program is about 10 times faster when done the 'long
way'. I hope you can see how it all depends on what sort of operations
you are doing, and the scope of the information you are working with.
You have to find a balance, and this method may not always be useful
for everything, especially in high level languages like C++.

int main(int argc, char *argv[]){
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"cmp $0x04, %ax\n\t"
"cmp $0x02, %bx\n\t"
"mov $0x02, %ax\n\t");
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<"Time: "<<elapsed< <" seconds."<<endl ;

time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"div %bx, %ax\n\t");
}
time(&t1);
elapsed = difftime(t1, t0);

cout<<"Time: "<<elapsed< <" seconds."<<endl ;
system("PAUSE") ;
return EXIT_SUCCESS;
}

Aug 21 '05 #5

<Co********@gma il.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Aha, so you want to see this in assembly, and you want this to work in
a way that actually saves time even when working with cases that are
not as special as an addition operation on two variables that have
values you can be sure of.

Try this piece of code that uses inline assembly and does a bit of
division. The program is about 10 times faster when done the 'long
way'. I hope you can see how it all depends on what sort of operations
you are doing, and the scope of the information you are working with.
You have to find a balance, and this method may not always be useful
for everything, especially in high level languages like C++.

int main(int argc, char *argv[]){
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"cmp $0x04, %ax\n\t"
"cmp $0x02, %bx\n\t"
"mov $0x02, %ax\n\t");
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<"Time: "<<elapsed< <" seconds."<<endl ;

time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"div %bx, %ax\n\t");
Why is that a div here?
}
time(&t1);
elapsed = difftime(t1, t0);

cout<<"Time: "<<elapsed< <" seconds."<<endl ;
system("PAUSE") ;
return EXIT_SUCCESS;
}

Aug 21 '05 #6

<Co********@gma il.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.

If you wanted to define mathematics I would first define addition. The
simplest way to define addition is to create a function for every
number and say f_n(x)=x+n , where n is the number you are preforming
addition on and x is the modifying value. The problem with this is it
uses addition to define itself, so I decided to write it longhand:

f_1(x) = if x==1 then y=2 , if x==2 then y=3, if x==3 then y=4...
f_2(x) = if x==1 then y=3 , if x==2 then y=4, if x==3 then y=5...
f_3(x) = if x==1 then y=4 , if x==2 then y=5, if x==3 then y=6...
...

You could do this for every number you wished to use and define the
scope of the numers you wished to work with. I of course have not
created a table that goes up to infinity or one that can use infinite
decimal places. If I need to I will just create new functions that
work with larger numbers and more decimal places.

What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.

This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.

Do you think we could optimize computer architecture to take advantage
of this?
Any feedback on this theory is welcome

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[])
{

time_t t1, t0;
double elapsed;

time(&t0); /* start time */
for(int cnt=0; cnt<1000000000; cnt++){
int x=0;
int y=577;
x=x+y;
y=x+y;
//if(x==0 && y==577) x=577;
//if(x==577 && y==577) y=1154;

}
time(&t1);
elapsed = difftime(t1, t0);
cout<<elapsed;
system("PAUSE") ;
return EXIT_SUCCESS;

}


Well, this is fine for the SPECIFIC values of 577. But waht about 576. And
575. And 574. And...

So in reality you would need to go through 576 if statements before you got
to 577. That's 577 compares.

Do that same code for adding teh intergers 0 to 20 and then test and you'll
see it's much slower.

Aug 21 '05 #7
"benben" <moc.liamtoh@hg nohneb read backward> wrote in news:4307e533$0
$2************* @news.optusnet. com.au:

<Co********@gma il.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Aha, so you want to see this in assembly, and you want this to work in a way that actually saves time even when working with cases that are
not as special as an addition operation on two variables that have
values you can be sure of.

Try this piece of code that uses inline assembly and does a bit of
division. The program is about 10 times faster when done the 'long
way'. I hope you can see how it all depends on what sort of operations you are doing, and the scope of the information you are working with.
You have to find a balance, and this method may not always be useful
for everything, especially in high level languages like C++.

int main(int argc, char *argv[]){
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"cmp $0x04, %ax\n\t"
"cmp $0x02, %bx\n\t"
"mov $0x02, %ax\n\t");
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<"Time: "<<elapsed< <" seconds."<<endl ;

time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x04, %ax\n\t"
"mov $0x02, %bx\n\t"
"div %bx, %ax\n\t");
Why is that a div here?


It divides ax by bx and stores the result in ax.
}
time(&t1);
elapsed = difftime(t1, t0);

cout<<"Time: "<<elapsed< <" seconds."<<endl ;
system("PAUSE") ;
return EXIT_SUCCESS;
}


I wanted to show off a newer version of this program that is a little
more sophisticated and utilizes better assembly. Tell me if there is
anything you don't understand about this code. I thought you might be
able to appreciate it, because there are more options for the integers
which we divide. It can do 4/2 8/2 16/2 32/2 64/2 and 12/8. Hard coding
this the long way with asm is 4 times faster than using div for
division. It doesn't seem to make so much of a differance how many
possible equations you decide to use either, unless you are talking
about hundreds of them.

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[]){
time_t t1, t0;
double elapsed;
time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x80, %ax\n\t"
"mov $0x02, %bx\n\t"
"cmp $0x04, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label1\n\t"
"cmp $0x08, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label2\n\t"
"cmp $0x10, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label3\n\t"
"cmp $0x20, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label4\n\t"
"cmp $0x40, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label5\n\t"
"cmp $0x80, %ax\n\t"
"cmp $0x02, %bx\n\t"
"je label6\n\t"
"label1:\n\ t"
"mov $0x02, %ax\n\t"
"jmp end\n\t"
"label2:\n\ t"
"mov $0x04, %ax\n\t"
"jmp end\n\t"
"label3:\n\ t"
"mov $0x08, %ax\n\t"
"jmp end\n\t"
"label4:\n\ t"
"mov $0x10, %ax\n\t"
"jmp end\n\t"
"label5:\n\ t"
"mov $0x20, %ax\n\t"
"jmp end\n\t"
"label6:\n\ t"
"mov $0x40, %ax\n\t"
"end:\n\t") ;
}
time(&t1);
elapsed = difftime(t1, t0);
cout<<"Time: "<<elapsed< <" seconds."<<endl ;
time(&t0); /* start time */
for(int cnt=0; cnt<2000000000; cnt++){
asm("mov $0x80, %ax\n\t"
"mov $0x02, %bx\n\t"
"div %bx, %ax\n\t");
}
time(&t1);
elapsed = difftime(t1, t0);

cout<<"Time: "<<elapsed< <" seconds."<<endl ;
system("PAUSE") ;
return EXIT_SUCCESS;
}
Aug 21 '05 #8
Co********@gmai l.com wrote:

This C++ program is an example of this kind of optimization. The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.


The commented lines are faster because compare-and-branch is likely to
be faster if the code is cached, which for such a small example it most
likely will be. However, this only works because your "addition jump
table" is so short, since you're always adding the same constants. To
make this table large enough to add any arbitrary ints would be too
large to hold in *memory*, let alone the code cache.

--
Mike Smith
Aug 23 '05 #9
Co********@gmai l.com wrote:
I asked the question, "how do you define arithmetic?", and when I came
to an answer I understood math in a new, much clearer way. I also
happened upon a method of arithmetic optimization that really speeds up
calculations on computers.
You may find it easier to understand, but I doubt that there's any
reasonable circumstance under which what you've shown really improves
speed. On a typical CPU, integer addition is already as fast as any
operation defined for the processor. That typically means one clock,
though in a few cases (e.g. the Pentium 4) it comes to only half a
clock (the Pentium 4 has a small part of the core operating at double
speed, so a single execution unit can produce 2 additions per clock).

One of the big considerations in designing hardware is the silicon
area, whihc is proportional to the number of gates required. For a
normal adder, the number of gates is approximately 2N where N is the
number of bits in a word (e.g. 32 for a 32-bit computer).

At least as I read it, your method would require gates proportional to
2^N instead. That limits the method to exceptionally small sizes --
e.g. a single adder built this way would use more silicon that planet
earth contains.
What I found in terms of computer programming, is that when I manually
assign values to variables I don't need to use the operators to do
arithmetic. What I like about doing it this way is it is faster.
What convinces you that this is faster? At best, I can see it hoping to
be the same speed, and under normal circumstances, it would be
somewhere between slightly and a drastically slower.
This C++ program is an example of this kind of optimization.
s/optimization/pessimization/g
The lines
commented out preform the exact same function as the lines which
preform arithmetic on the variables, but the commented lines are much
faster.


I seriously doubt they're really faster, and even if they were, you
haven't really shown much of anything. How about if you show us how
you'd implement even a slightly more general case, such as:

unsigned long total = 0;

for (unsigned i=0; i<100000; i++)
total += i;

Of course, this is still too trivial to prove _much_, but even so, I
suspect a working implementation will convince you that the approach
has more weaknesses than strengths.

Finally, I'd note that your method is really little more than a rather
convoluted method of implementing a table lookup. A much cleaner method
would be to just index into an actual table. This is pointless for
addition, but it can be worthwhile for things that are relatively slow
to calculate (e.g. for interactive graphics I've sometimes used small
tables of sine/cosine values).

--
Later,
Jerry.

The universe is a figment of its own imagination.

Aug 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1927
by: mwh | last post by:
Hi. If you remember, I posted Expressons Help. Now I am making a calculator with javascript. I can't get this to work: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <title>Calculator</title> <script language="Javascript"> <!-- Begin Hiding var total = 0
6
7295
by: Rafael | last post by:
Hi Everyone, I need some help with my calculator program. I need my program to do 2 arguments and a 3rd, but the 3rd with different operators. Any help would be great. Here is my code.... #include <stdio.h> #include <stdlib.h>
3
5199
by: Paul | last post by:
I want to make a simple calculator program but dont know where to get started. This is not GUI but a simple terminal program. It would get input like this Enter number: 5 + 10
3
2076
by: Art | last post by:
Hi, In part of my application the user may need to do a simple arithmetic calculation in order to get the value to put in a text box. I was thinking that it would be good if I could display the Windows calculator and then put the result in the textbox for the user. Additionally, I'd like to keep the text of the calculation - if possible. Is any of this possible? How would I go about it?
3
15132
by: PieMan2004 | last post by:
Hi, ive been looking for a solid java community to help me when im tearing out my hair :) Basically ive constructed a GUI that has to represent the same look and functions of the typical windows calculator. Ive made 4 classes 2 do this, my reasoning so it was easier to look through( when programming) rather than getting mixed up in my own code! My questions and problems: Ive been messing around with the windows look and feel,...
24
6313
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
19
4004
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*;
5
5754
Deathwing
by: Deathwing | last post by:
Hi everyone one I'm playing around with trying to make an expense calculator. I would like it so that the user can keep enter expenses until they have no more expenses. Then I would like for the program to give the users total expenses then subtract this from their total income and inform them how much they have left after monthly expenses. Any ideas ? this is what I've come up with thus far. # Expense calculator # This program calculates...
3
11844
by: itsmichelle | last post by:
This is a very primative code of a java swing calculator. I have assigned all the number buttons and the operator buttons and I can add, subtract, multiply, and divide two numbers together. However, my teacher wants the operators to follow the algebraic order of operations by chaining multiple operations. Such as, 7 + 4 * 2= 15. The operatorListener is the ActionListener for the operator buttons. Thanks for any help you can give me. ...
3
2884
by: mandy335 | last post by:
public class Calculator { private long input = 0; // current input private long result = 0; // last input/result private String lastOperator = ""; // keeps track of the last operator entered /* Digit entered as integer value i * Updates the value of input accordingly to (input * 10) + i */
0
7929
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1458
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1195
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.