|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Magic numbers
> which works fine and shows the expected result... now...if you change > .05 for .07 you get something totally unexpected (at least is unexpected > to me). It is the result for 0.05 that is more surprising than the result for 0.07. You wrote your numbers using decimal ".05" or ".07" but most computers these days are binary machines. You can not store either of those numbers exactly in base two floating point, just as you can't store 1/3 in base 10: its 0.333333... as accurate as you want to be but you can't store it exactly. So whenever you do floating point arithemetic on a machine you should _expect_ to see roundoff errors. Sometimes you get lucky and the roundoff error is smaller than the number of digits output so you get what looks like an exact answer, but in general this can't happen. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








