From: 李雪愚 <sno...@gm...> - 2010-09-06 03:34:19
|
hi, Leon, Maybe you can port the float lib of PForth to amforth: http://pforth.googlecode.com/svn/trunk/fth/floats.fth unitTest: http://pforth.googlecode.com/svn/trunk/fth/t_floats.fth Best Regards > 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. > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |