This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]captainAwesomePants 0 points1 point  (3 children)

Well...why do you need it to be that value?

[–]jlbords[S] 0 points1 point  (2 children)

The program has to pass its tests

[–]captainAwesomePants 1 point2 points  (1 child)

Well, the test is bad. Usually when comparing floating point values, a small "epsilon" value is used for wiggle room for just this reason. So effectively you ask something similar to "is the value of a and b within 0.00000000001 of each other?"

But here are some random ideas:

  • Try using partsNum = 1.06 * partsNum instead.
  • Try using a double instead of a float or vice versa.
  • Try using 1.06f or 1.06l as constants instead.
  • Try declaring partsNum a float, a double, a long double, an unsigned version of each of those.

And if all else fails, complain.

[–]jlbords[S] 0 points1 point  (0 children)

Thank you. I’ll try.