Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confusing Math
#3
More About Floating Points
If you want to be precise. Then you have to use fractions.Fraction.
from fractions import Fraction
a = Fraction(1)
b = Fraction(92, 100)
print(float(a - b))
99 percent of computer problems exists between chair and keyboard.
Reply


Messages In This Thread
Confusing Math - by DrJu - Jan-18-2018, 10:19 PM
RE: Confusing Math - by Gribouillis - Jan-18-2018, 10:30 PM
RE: Confusing Math - by Windspar - Jan-18-2018, 10:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  math.log versus math.log10 stevendaprano 10 2,427 May-23-2022, 08:59 PM
Last Post: jefsummers
  Confusing in [for loop] topic Sherine 11 3,526 Jul-31-2021, 02:53 PM
Last Post: deanhystad
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,782 Feb-24-2021, 05:09 PM
Last Post: bowlofred
  Confusing logic Blob 4 2,407 Nov-18-2019, 03:26 AM
Last Post: Blob
  Confusing output from 2to3 about what files need change Moonwatcher 1 4,841 Dec-30-2018, 04:07 PM
Last Post: Gribouillis
  IndentationError message could be confusing to new programmers insearchofanswers87 1 2,353 May-16-2018, 05:05 PM
Last Post: Larz60+
  Some Confusing Program Errors (Newbie stuff) WildPictus 1 2,799 Sep-03-2017, 05:00 PM
Last Post: hbknjr
  CPU utilisation is confusing Bidgey225 6 5,192 Mar-20-2017, 01:49 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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