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).HTHJohn-- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4501 Forbes BoulevardSuite HLanham, MD 20706301-459-3366 x.5010fax 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:
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).HTHJohn-- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4501 Forbes BoulevardSuite HLanham, MD 20706301-459-3366 x.5010fax 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)