On Tuesday, February 4, 2014 4:24:36 AM UTC-8, julien23 wrote: > > are Math.floor Math.pow ... depending of a plugin I might not have ? >
"Math" is a standard javascript object that defines a whole bunch of mathematical functions http://www.w3schools.com/jsref/jsref_obj_math.asp Le mardi 4 février 2014 13:23:10 UTC+1, julien23 a écrit : >> >> Thank you Eric >> >> I still have "108.95-84.72 = 24.230000000000004" >> I'll figure out why later >> > The extra digits are apparently a result of innaccuracy in the least significant bit of javascript's floating point calculations. The expression using Math.floor() and Math.pow() basically multiplies the number by a power a ten (to shift the decimal to the right), then truncates the value (discarding any remaining decimal digits), and then divides by the same power of ten to shift the decimal point back to the left. The 2nd argument in Math.pow(10,16) is the number of decimal digits to retain. When I tried this on my system (Win7/Chrome), keeping 16 decimal digits seemed to work (eliminating the last, spurious digit.. and the zeros leading up to it). Try changing the 2nd argument to a lower number, until the extra digits disappear. enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios YOUR DONATIONS ARE VERY IMPORTANT! HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.