Python Forum

Full Version: Rounding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have developed an app, which does lengthy, but not very complicated calculations.
The main thing is that it produces end results, rounded numbers to 2 decimals.
Works well. (On my PC)

I made an executable with pyinstaller : pyinstaller --onefile --windowed xxx.py,
and gave it to somebody else.

With the identical dataset, his results are the same except for the rounding.
I have eg. : 616.51
His PC produces : 616.5199999999999

Am I naive in thinking that an executable should always produce the exact same result als the source?
How can this be ? Huh
Paul
...or... try the calculations with the decimal.Decimal type. actually, read that document, anyway, first. then read about the decimal.Decimal type.
wow, all this is not for the faint of heart.
Will try to make some sense of it.
Paul
(Jul-04-2022, 05:08 PM)DPaul Wrote: [ -> ]wow, all this is not for the faint of heart.
the same can be said for many other things when you dive deep into programming. get used to it.