From: Leon N. M. <leo...@gm...> - 2010-09-04 03:13:41
|
I've finally added a function to output floats (in scientific notation): > 355 s>f 113 s>f f/ fs. 3.1415927 ok > 1 s>f f2/ f2/ f2/ f2/ fs. 6.25E-2 ok > 12345 s>f fs. 1.23449993E4 ok You can see from the second example that rounding problems do happen. That can be avoided... if you don't mind coding with decuple length integers (need to be able to store up to 2^154). See the pdf at: http://portal.acm.org/citation.cfm?id=93559 So I'm going to stick with this simpler -- but less accurate -- method for the moment (also in the pdf) -- I'll work on input before spending more time with output (similar problems exist -- maybe there are easier solutions). As usual, the code is available at: http://github.com/lnmaurer/amforth-float -Leon PS I'm not sure if these type of updates are of general interest, but there's been a lot of floating point stuff going around, so I'll keep sending them for the moment. |