R
Chiwa said:Hey,
Expression:
Math.floor(x * 100) / 100
x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.
Thx in advance
Chiwa
Chiwa said:Expression:
Math.floor(x * 100) / 100
x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.
Cardman said:After working on my order form code it appears that I noticed and
solved this same problem long ago.
What I do is to add 0.000001 to the value x before putting it through
this same function, when this makes sure that the value is not below
the true value before you run the calculation.
Since this fraction is so small, then it would be rounded off
anywhere, where you only have to watch out that your x value does not
use this many decimal places.
That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.
There you go, perfect rounding results every time.
Cardman
http://www.cardman.com
http://www.cardman.co.uk
That of course is not a problem for money values, like what I use it
for, with only two (or three with VAT) decimal places.
There you go, perfect rounding results every time.
Math.floor(x * 100) / 100
x= 4.1 gives 4.09, why in gods name?
While other values for x don't give a problem.
Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian.
Still, it does not mention English for Sweden
either, when I know from my visit to Gothenburg that like everyone
there speaks English.
I think that they are trying to ignore the truth.
Did anyone ever tell you that English is spreading too far around the
region? :-]
I blame TV myself, with all that Hollywood programming, where they
even have the nerve to subtitle instead of dub. They should have done
like the Germans and banned the English language. ;-]
<snip>Cardman said:Then it is odd how my Atlas says that the languages used there are
Dutch and Frisian. Still, it does not mention English for Sweden
either, when I know from my visit to Gothenburg that like everyone
there speaks English.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.