0

Can anyone please share why I am getting extra 000000005 while doing below operation double value = 42923496; double res = value * Math.Pow(10, -4); //4292.3496000000005 Expected 4292.3496

Expected 4292.3496.

Below code is working fine double inde2 = 43009442; double res3 = inde2 * Math.Pow(10, -4);//4300.9442

Agina
  • 11
  • 1
  • `42923496` can be represented exactly, but `0.0001` cannot, and neither can `4292.3496`. I would say to use `decimal`, but unfortunately the API still lacks a method of creating exact but variable powers of 10, even though these are straightforward to represent. – Jeroen Mostert Jan 30 '23 at 09:50

0 Answers0