Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stuck comparing two floats
#8
I ended up with a solution not requiring a module but that module is nice to know exists, thanks.

Basically used .split('.')[0] and [1] to compare the left and right sides then ran the if statement with int(l_num) > int(old_l_num)
and elif right num etc.

Thanks for the prodding in right direction.
Reply


Messages In This Thread
Stuck comparing two floats - by Tizzle - Jun-26-2020, 06:08 AM
RE: Stuck comparing two floats - by hussainmujtaba - Jun-26-2020, 06:12 AM
RE: Stuck comparing two floats - by Tizzle - Jun-26-2020, 06:35 AM
RE: Stuck comparing two floats - by DeaD_EyE - Jun-26-2020, 07:32 AM
RE: Stuck comparing two floats - by bowlofred - Jun-26-2020, 07:39 AM
RE: Stuck comparing two floats - by DeaD_EyE - Jun-26-2020, 07:48 AM
RE: Stuck comparing two floats - by ndc85430 - Jun-26-2020, 08:11 AM
RE: Stuck comparing two floats - by Tizzle - Jun-26-2020, 08:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  When is it safe to compare (==) two floats? Radical 4 760 Nov-12-2023, 11:53 AM
Last Post: PyDan
  floats 2 decimals rwahdan 3 1,656 Dec-19-2021, 10:30 PM
Last Post: snippsat
  rounding and floats Than999 2 3,132 Oct-26-2020, 09:36 PM
Last Post: deanhystad
  int, floats, eval menator01 2 2,461 Jun-26-2020, 09:03 PM
Last Post: menator01
  rounding floats to a number of bits Skaperen 2 2,329 Sep-13-2019, 04:37 AM
Last Post: Skaperen
  comparing fractional parts of floats Skaperen 4 3,390 Mar-19-2019, 03:19 AM
Last Post: casevh
  Integer vs Floats Tazbo 2 2,890 Jan-09-2019, 12:06 PM
Last Post: Gribouillis
  Formatting floats Irhcsa 6 4,209 Oct-04-2018, 04:23 PM
Last Post: volcano63
  How do you sort a table by one column?? (of floats) sortedfunctionfails 3 12,335 Jan-11-2018, 09:04 AM
Last Post: sortedfunctionfails
  Reading floats and ints from csv-like file Krookroo 15 20,134 Sep-05-2017, 03:58 PM
Last Post: Krookroo

Forum Jump:

User Panel Messages

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