Python Forum
How do I correct multiplication error? Greedy algorithm help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I correct multiplication error? Greedy algorithm help
#1
I am writing a function using the greedy algorithm and with this algorithm the dollars must be converted to cents.

One of the values is 1.15, however in idle;
1.15*100
114.99999999999999

when I multiply by 100 the output is 114.99999999999999 instead of 115 which messes up the math

Is there another way to convert the dollars to cents?
Reply


Messages In This Thread
How do I correct multiplication error? Greedy algorithm help - by student8 - Oct-02-2017, 02:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  If statements and multiplication elroberto 1 1,751 Jun-22-2022, 05:35 PM
Last Post: deanhystad
  Find the maximum multiplication ercv 3 2,189 Nov-30-2020, 11:55 AM
Last Post: DeaD_EyE
  Greedy Cow Transport Truman 18 9,768 Apr-18-2019, 02:06 PM
Last Post: Truman
  Multiplication Table Homework mcnhscc39 6 4,683 Nov-25-2018, 04:01 PM
Last Post: mcnhscc39
  Syntax error for code that seems correct mcnhscc39 4 3,657 Nov-15-2018, 08:40 PM
Last Post: j.crater
  creating a 3x3 multiplication table aditvaddi 1 3,650 Jun-18-2018, 06:05 AM
Last Post: volcano63
  Multiplication Table funnybone04 4 5,823 Apr-08-2018, 03:03 AM
Last Post: nilamo
  Nested Loop multiplication table SushiRolz 3 10,273 Feb-28-2018, 04:34 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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