Re: I Need Help
- Posted by Lucius L Hilley III <luciuslhilleyiii at JUNO.COM> Jun 22, 1997
- 911 views
On Sat, 21 Jun 1997 23:45:00 -0400 Ad Rienks <Ad_Rienks at COMPUSERVE.COM> writes: >financial calculating in Euphoria. Isn't this possible at all, or >should I maybe disable my math coprocessor? > >Ad Rienks > Just how many places must your numbers be accurate 2, 3, 4, 5, 6? function fix(atom a, integer p) --if p = 1 then --a = a * 10 --elsif p = 2 then --a = a * 100 --elsif p = 3 then --a = a * 1000 --end if --return a return a * power(10, p) end function function unfix(atom a, integer p) --floor(a) --if p = 1 then --a = a / 10 --elsif p = 2 then --a = a / 100 --elsif p = 3 then --a = a / 1000 --end if --return a return floor(a) / power(10, p) end function atom a, b, c c = .0001 a = 0 for r = 1 to 1000 a = a + c end for printf(1, "%f14", a) b = 0 for r = 1 to 1000 b = b + fix(c, 3) end for b = unfix(b, 3) printf(1, "%f14", b) Try these routines. the second value passed is accuracy. --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I support transferring of files less than 60K. -- I can Decode both UU and Base64 format.