From: pito <pi...@vo...> - 2010-08-29 18:01:10
|
The test cases are designed specifically to se how it handles large and small numbers. The cases 1-3 are the same as 4-6, the later have only minus sign with those 10000 numbers. All the results shall be by design the integer number 31415 (visualised by "10000 x Pi" - as we do not have float format yet). The Pi is simply multiplied or/and divided by large numbers (as we do not have float input yet, it is done by several multiplication/division by 10000). The results are: > test1 31415 ok > test2 31415 ok > test3 |significand| > 16777215 Here the sign is chabged only: > test4 |significand| > 16777215 > test5 31438 ok > test6 |significand| > 16777215 > My current understanding is the division is cousing issues. The lost of significant figures shall not be the case - see the test 1: tmp = pi / (10000^5) pi = tmp * 10000^6 (correct result 31415). The test 2: tmp = pi / 10000 / 10000 pi = tmp * 10000^3 (correct result 31415). Te test 3: tmp = pi / 10000 / 10000 /10000 pi = tmp * 10000^4 (error). The test4-6 are same as the above one, but with minus sign at 10000. So the result shall be 31415 (when ignoring the sign). As you may see from previous test the f/ is sensitive to signs of the operands and gives unpecise results - see for example test5 result. Pito. ----- PŮVODNÍ ZPRÁVA ----- Od: "Leon N Maurer" <leo...@gm...> Komu: amf...@li... Předmět: Re: [Amforth-devel] Float testing - small/large numbers Datum: 29.8.2010 - 19:17:31 > I don't have my device handy so I can't test your > code. Could you be a little > more clear about which ones failed, what the > results are supposed to be, and > what the results actually are? (When you write > "the result shall be -31415", > is that what it's supposed to be, what it actualy > is, or something else?) > > It looks like you're dividing and then multiplying > by very large powers of 10. > I wouldn't be surprised if you loose some > significant figures by doing this. > -Leon > > ------------------------------------------------------------------------------ > > Sell apps to millions through the Intel(R) > Atom(Tm) Developer Program > Be part of this innovative community and reach > millions of netbook users > worldwide. Take advantage of special opportunities > to increase revenue and > speed time-to-market. Join now, and jumpstart your > future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |