![]() |
Rounding - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html) +--- Forum: Bar (https://python-forum.io/forum-27.html) +--- Thread: Rounding (/thread-37635.html) |
Rounding - DPaul - Jul-04-2022 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 ? ![]() Paul RE: Rounding - Larz60+ - Jul-04-2022 Please see: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html RE: Rounding - Skaperen - Jul-04-2022 ...or... try the calculations with the decimal.Decimal type. actually, read that document, anyway, first. then read about the decimal.Decimal type. RE: Rounding - DPaul - Jul-04-2022 wow, all this is not for the faint of heart. Will try to make some sense of it. Paul RE: Rounding - Skaperen - Jul-06-2022 (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. |