floor()

new topic     » topic index » view thread      » older message » newer message

I'm having a problem with the floor function.
This is a (VERY VERY quickly) modified function so it will work independently
and still produce the error I am having trouble with. I'm not worried with what
I'm trying to do with my code here only show that floor() goes haywire.


From this code:

function convert(atom number)
    number = number - floor(number)
    ? number
    for i = 1 to 5 do

        number = number * 10
        puts(1,"\n----\nCurrent Number:  ")
        print(1,number)
        puts(1,"\nFloored Number:  ")
        print(1,floor(number))
    end for

    return 2
end function

I get these results (as copied and pasted from the DOS screen):
<start>
0.001

----
Current Number:  0.01
Floored Number:  0
----
Current Number:  0.1
Floored Number:  0
----
Current Number:  1
Floored Number:  0
----
Current Number:  10
Floored Number:  9
----
Current Number:  100
Floored Number:  99

<end>
Which are different yet again if I use floor() out of the function like at the
end of the .ex file. (floor(1) equals 1 all of a sudden instead of 0 as it did
inside the function). Is there somethign encrdibly simple I'm missing here or
what else can I do?

(censored)


Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at
http://www.eudoramail.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu