Python Forum
python calculate float plus float is incorrect?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python calculate float plus float is incorrect?
#5
a = 27.56
b = 13.78
c = a + b
print(f"{c:.2f}")
Output:
41.34
Reply


Messages In This Thread
RE: python calculate float plus float is incorrect? - by Axel_Erfurt - Apr-16-2024, 11:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python code to calculate mean of an array of numbers using numpy viren 3 175 May-29-2024, 04:49 PM
Last Post: Gribouillis
  Code is returning the incorrect values. syntax error 007sonic 6 1,402 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  Formatting float number output barryjo 2 1,010 May-04-2023, 02:04 PM
Last Post: barryjo
  convert string to float in list jacklee26 6 2,046 Feb-13-2023, 01:14 AM
Last Post: jacklee26
  TypeError: 'float' object is not callable #1 isdito2001 1 1,173 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  Write Null values as 0.0 (float) type in csv mg24 3 1,495 Dec-07-2022, 09:04 PM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,656 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov
  openpyxl convert data to float jacklee26 13 6,414 Nov-19-2022, 11:59 AM
Last Post: deanhystad
  Convert SQLite Fetchone() Result to float for Math Extra 13 3,836 Aug-02-2022, 01:12 PM
Last Post: deanhystad
  float("{:.2f}" return long number? korenron 2 1,151 Jul-13-2022, 05:35 AM
Last Post: korenron

Forum Jump:

User Panel Messages

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