Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
33*25.4
#6
Yes, I am converting from inch to mm and mm to inch every day. I'm an engineer :)

I was also thinking about calculating it as an integer instead of a float, but ended up with this (see below), which I really wasn't expecting either. This base 2 stuff really blows my mind!

>>> format(33*(254/10),'.17g')
'838.19999999999993'
>>> format((33*254)/10,'.17g')
'838.20000000000005'

I now understand why I sometimes see these very small errors in SolidWorks, which is always rounded to 8 decimal places.

Thanks for your help!
Reply


Messages In This Thread
33*25.4 - by schascheck - Oct-27-2020, 12:45 AM
RE: 33*25.4 - by deanhystad - Oct-27-2020, 01:09 AM
RE: 33*25.4 - by bowlofred - Oct-27-2020, 01:56 AM
RE: 33*25.4 - by schascheck - Oct-27-2020, 03:38 AM
RE: 33*25.4 - by DeaD_EyE - Oct-27-2020, 08:47 AM
RE: 33*25.4 - by schascheck - Oct-27-2020, 02:46 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020