Is it possible to get an "exact" value? - page 5 1234567 New comment Andrey F. Zelinsky 2014.10.04 11:38 #41 WePlexus: Yes, and the calculator says 0.09*5=0.45. :)just needs to be normalized://double d=0.019999999999999999; double d=NormalizeDouble(0.09*5,2); double e=(int)(d*100)/100.0; Print("e=",e); Alexandr Bryzgalov 2014.10.04 12:11 #42 abolk: well, sanyok, you're a liar.My function:=0.44. I didn't check yours.) Alexandr Bryzgalov 2014.10.04 12:12 #43 abolk: normalisation just needs to be done:also an option )))and what's up with the number? )))0.01999999999999999999 Andrey F. Zelinsky 2014.10.04 12:22 #44 sanyooooook: also an option )))and what's up with the number? )))this is the maximum number with which normalisation works:double d=NormalizeDouble(0.01999999,18); double e=(int)(d*100)/100.0; Print("e=",e); if you take one more 9, it's normalized to 0.02. Alexandr Bryzgalov 2014.10.04 12:23 #45 abolk: is the maximum number with which normalisation takes place: If you take one more 9, it's normalized to 0.02. don't cut it off.) Andrey F. Zelinsky 2014.10.04 12:24 #46 sanyooooook: don't truncate the number.) whatever -- NormalizeDouble() 's accuracy format is 0-8 Alexandr Bryzgalov 2014.10.04 12:44 #47 abolk: so sideways -- the format of accuracy in NormalizeDouble() -- 0-8 so it's already sideways)) Andrey F. Zelinsky 2014.10.04 12:46 #48 sanyooooook: so that's it, it's all the same))we're already getting to the "heart of the problem" -- that's why "already"first the decomposition of the problem -- then the composition of the problemor are there still some loose ends? Alexandr Bryzgalov 2014.10.04 12:57 #49 abolk: we're already getting to the "heart of the problem" -- that's why "already"first the decomposition of the problem -- then the composition of the problemor are there still some unexplained points?yes )how to use the same function (say, the one you wrote) to truncate any input number to the right number of digits:even if it's this:0.01999999999999999999or this:0.09*5 Andrey F. Zelinsky 2014.10.04 13:02 #50 sanyooooook: yes )how to truncate any input number to the right number of digits using the same function:even if it's this:or this:To solve this problem, 0.09*5 has to be =0.45, not =0.44999999999999999and if there is no such a thing, then the problem is unsolvable 1234567 New comment
Yes, and the calculator says 0.09*5=0.45. :)
just needs to be normalized:
well, sanyok, you're a liar.
My function:
=0.44.normalisation just needs to be done:
also an option )))
and what's up with the number? )))
0.01999999999999999999also an option )))
and what's up with the number? )))
this is the maximum number with which normalisation works:
if you take one more 9, it's normalized to 0.02.
is the maximum number with which normalisation takes place:
If you take one more 9, it's normalized to 0.02.don't truncate the number.)
so sideways -- the format of accuracy in NormalizeDouble() -- 0-8
so that's it, it's all the same))
we're already getting to the "heart of the problem" -- that's why "already"
first the decomposition of the problem -- then the composition of the problem
or are there still some loose ends?
we're already getting to the "heart of the problem" -- that's why "already"
first the decomposition of the problem -- then the composition of the problem
or are there still some unexplained points?
yes )
how to use the same function (say, the one you wrote) to truncate any input number to the right number of digits:
even if it's this:
0.01999999999999999999or this:
yes )
how to truncate any input number to the right number of digits using the same function:
even if it's this:
or this:
To solve this problem, 0.09*5 has to be =0.45, not =0.44999999999999999
and if there is no such a thing, then the problem is unsolvable