1

Recently it was decided to update from VS6 to VS2017. During Checks we found there was a small 1p difference in a calculation.

The calculation example

27243.4999999999999999999996 * 229815.98735837682 / 229815.98735837682

In vs6 this gives a value of 27243.4999999999999999999996

In vs2017 this gives a value of 27243.50

If this is broken down into steps in vs2017 so

229815.98735837682 / 229815.98735837682 = 1

27243.4999999999999999999996 * 1 = 27243.4999999999999999999996

So the question , Does VS2017 handle Calculations in a different way to VS6 ? Is there built in rounding ?

PowPowPowell
  • 255
  • 1
  • 2
  • 11
  • 3
    Does this answer your question? https://stackoverflow.com/questions/588004/is-floating-point-math-broken – 463035818_is_not_an_ai Jun 16 '20 at 08:44
  • 2
    Not that I'm aware of but I expect any difference will be in the input/output routines rather than the floating point calculation itself. In any case you probably want to look at this https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=vs-2019. – john Jun 16 '20 at 09:16
  • `gives a value of ` Where do you get that - debugger, `cout`, `printf` etc? Also see the [`/fp`](https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=vs-2019) compiler options. – dxiv Jun 16 '20 at 15:33
  • I see this value in double variables to hold the results of the calculations. I will look into /fp compiler options. Thanks – PowPowPowell Jun 17 '20 at 10:22

0 Answers0