Python Forum
float multiplication - unexpected output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
float multiplication - unexpected output
#4
You need to learn more about floating point numbers.
Floating point numbers can't represent all decimal fractions.


import webbrowser
webbrowser.open(str(0.1 + 0.2) + '.com')
http://0.30000000000000004.com/


If you need something, which does not have this problem: decimal fractions
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
float multiplication - unexpected output - by inesk - Dec-11-2018, 10:41 AM
RE: float multiplication - unexpected output - by DeaD_EyE - Dec-11-2018, 10:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected output Starter 2 439 Nov-22-2023, 12:08 AM
Last Post: Starter
  Unexpected Output - Python Dataframes: Filtering based on Overlapping Dates Xensor 5 654 Nov-15-2023, 06:54 PM
Last Post: deanhystad
  Unexpected output while using random.randint with def terickson2367 1 467 Oct-24-2023, 05:56 AM
Last Post: buran
  Formatting float number output barryjo 2 878 May-04-2023, 02:04 PM
Last Post: barryjo
  Unexpected output from df.loc when indexing by label idratherbecoding 6 1,125 Apr-19-2023, 12:11 AM
Last Post: deanhystad
  Multiplication Table code alexsendlegames100 3 1,316 Jun-06-2022, 09:45 AM
Last Post: Gribouillis
  Try to solve GTG multiplication table problem. Frankduc 6 1,935 Jan-18-2022, 08:26 PM
Last Post: Frankduc
  Need help with my Python code (Multiplication) NeedHelpPython 2 1,629 Oct-04-2021, 12:09 PM
Last Post: Pedroski55
  unexpected output asyrafcc99 0 1,478 Oct-24-2020, 02:40 PM
Last Post: asyrafcc99
  Unexpected output: symbols for derivative not being displayed saucerdesigner 0 2,011 Jun-22-2020, 10:06 PM
Last Post: saucerdesigner

Forum Jump:

User Panel Messages

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