Re: Odd [math] behaviour

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 52768
interpreted = N
texte = Pat Holliday wrote: > But that's not the answer - the answer is 700.1.. > > Why doesn't WebDNA do straightforward calculations by default? > It's your computer, not WebDNA. Floating point math is not exact; it is approximate. Certain combinations will not ever work in the way you are used to "on paper" so you just have to deal with it. I see that round() is not a valid function within the [math] (which is dumb), so you'll have to brew your own: [math]floor((6000.4-5300.3+0.005)*100)/100[/math] will display what you would expect. NOTE: because you are using floating point, even the above may not work all of the time, because some decimal representations are not possible to accurately store using floating point numbers (which are stored internally as a power of 2 not 10). HTH John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748 ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Odd [math] behaviour ( Tim Robinson 2003)
  2. Re: Odd [math] behaviour ( John Peacock 2003)
  3. Re: Odd [math] behaviour ( Paul Willis 2003)
  4. Re: Odd [math] behaviour ( Donovan 2003)
  5. Re: Odd [math] behaviour ( John Peacock 2003)
  6. Re: Odd [math] behaviour ( "WebDna @" 2003)
  7. Re: Odd [math] behaviour ( John Peacock 2003)
  8. Re: Odd [math] behaviour ( Donovan 2003)
  9. Re: Odd [math] behaviour ( "WebDna @" 2003)
  10. Re: Odd [math] behaviour ( Pat Holliday 2003)
  11. Re: Odd [math] behaviour ( "WebDna @" 2003)
  12. Re: Odd [math] behaviour ( John Peacock 2003)
  13. Odd [math] behaviour ( Pat Holliday 2003)
Pat Holliday wrote: > But that's not the answer - the answer is 700.1.. > > Why doesn't WebDNA do straightforward calculations by default? > It's your computer, not WebDNA. Floating point math is not exact; it is approximate. Certain combinations will not ever work in the way you are used to "on paper" so you just have to deal with it. I see that round() is not a valid function within the [math] (which is dumb), so you'll have to brew your own: [math]floor((6000.4-5300.3+0.005)*100)/100[/math] will display what you would expect. NOTE: because you are using floating point, even the above may not work all of the time, because some decimal representations are not possible to accurately store using floating point numbers (which are stored internally as a power of 2 not 10). HTH John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748 ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ John Peacock

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

OT: Variables in printed URL (2007) [date format] w/in sendmail (1997) WebCat2 - [format thousands] (1997) Mystery authentication (1997) authorize net (2001) [WebDNA] WebDNA 7 (2011) Webcat & SIMS (1998) Everyone: List Traffic (was [include ...] behavior) (1997) [WebDNA] Snow Leopard (2009) WebCommerce: Folder organization ? (1997) Realtime shipping suggestions (2007) [countWords]? (1997) WebCat NT v. Mac (1997) Stopping bad HTML propagation ? (1997) Search returns all, not 20 (1997) Hiding HTML and page breaks (1997) Please post more "exceptions to the rules" ... (2005) Associative lookup style? (1997) Protect and Serve (1999) Re:no [search] with NT (1997)