float->double conversion problem?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

float->double conversion problem?

Andrew D. Fernandes

Perhaps someone can help me here: it seems that one is not equal to one...

Octave, version 1.0.  Copyright (C) 1992, 1993, 1994 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.

octave:1> format long e
octave:2> 1
ans =  1.00000047683363e+00
octave:3> 1/1
ans =  1.00000047683363e+00
octave:4> quit

So, what exactly does this mean? All attempts at setting a variable to exactly
1.0 have failed... is this a bug in the printing subroutines, or is a
conversion between a float and a double going on somewhere that twiddles with
the low order bits on the floating point number?

-Andrew. ([hidden email])