I am taking a Numerical Methods class this semester and have been given the following algorithm:
****************************
power = 1.0
b = 1.0
while b ~= 0.0
power = power / 2
a = 1.0 + power
b = a - 1.0
display(power, a, b)
end
display("Unit Round = ", 2*power)
******************************
First question - the "while b~= 0.0" statement... I've never seen the "~=" sign before in an algorithm. What does it mean? Does it mean "Not equal to"? Does it mean "approximately equal to"?
I am supposed to write a program that implements this algorithm. To me, there seems to be absolutely nothing to implement!!! I can't see anything useful that this algorithm does...let alone write a program that does something with it.
Is this a well-known algorithm that I should be aware of? Does it do something useful that I am not seeing? It just seems to show that "power" gets very small...
Any help would be appreciated!
Caveman
****************************
power = 1.0
b = 1.0
while b ~= 0.0
power = power / 2
a = 1.0 + power
b = a - 1.0
display(power, a, b)
end
display("Unit Round = ", 2*power)
******************************
First question - the "while b~= 0.0" statement... I've never seen the "~=" sign before in an algorithm. What does it mean? Does it mean "Not equal to"? Does it mean "approximately equal to"?
I am supposed to write a program that implements this algorithm. To me, there seems to be absolutely nothing to implement!!! I can't see anything useful that this algorithm does...let alone write a program that does something with it.
Is this a well-known algorithm that I should be aware of? Does it do something useful that I am not seeing? It just seems to show that "power" gets very small...
Any help would be appreciated!
Caveman