Python Forum
float("{:.2f}" return long number?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
float("{:.2f}" return long number?
#1
Hello ,
I have a code that divide 2 numbers then give me 2 after the decimal point
in most cased it's working
but something I get this answer :
0.06999999999999999
0.11000000000000001
in most cases I get the correct form:
0.03
0.05
0.01
0.0
what could be the resaon ?
*** I will try to catch the 2 numbers that I'm dividing when this happand

Thanks ,
Reply


Messages In This Thread
float("{:.2f}" return long number? - by korenron - Jul-12-2022, 02:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 558 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  Formatting float number output barryjo 2 1,013 May-04-2023, 02:04 PM
Last Post: barryjo
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 5,058 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  Sequence Generator - Long number krux_rap 3 2,417 Aug-19-2020, 06:37 PM
Last Post: buran
  Factorial Code is not working when the given number is very long integer Raj_Kumar 2 2,396 Mar-31-2020, 06:40 PM
Last Post: deanhystad
  Comaparing Float Values of Dictionary Against A Float Value & Pick Matching Key firebird 2 3,491 Jul-25-2019, 11:32 PM
Last Post: scidam
  time.time wont return a useable number Nyscersul 4 3,091 Nov-15-2018, 03:08 PM
Last Post: Nyscersul
  My function won't return the sum unless the last paramater is an odd number. Maximuskiller78 1 2,383 Sep-29-2018, 03:11 AM
Last Post: ichabod801
  How to trim a float number? microphone_head 5 9,397 Aug-20-2018, 08:52 PM
Last Post: perfringo
  splitting up long number iFunKtion 7 6,383 Dec-07-2016, 05:58 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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