Ticket #2332 (closed defect: fixed)

Opened 3 years ago

Last modified 14 months ago

Trivial divide calculations generate results with rounding errors

Reported by: garycmartin Owned by: garycmartin
Priority: Unspecified by Maintainer Milestone: Unspecified by Release Team
Component: Calculate Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: New

Description

Trivial divide calculations are showing rounding errors (tested in Calculate-33).

89 / 100 = 0.890000000
496 / 100 = 4.95999999

Trying the same calculations in a terminal with python is fine 89 / 100 = 0.89, and 496 / 100 = 4.96.

If I try using multiply instead, the answers are accurate.

89 * 0.01 = 0.89
496 * 0.01 = 4.96

Attachments

0001-Ticket-2332-Rational-format-problem.patch Download (0.7 KB) - added by miguelgarcia 14 months ago.
patch for this issue

Change History

Changed 3 years ago by greenfeld

Is Calculate using an arbitrary precision numeric engine {python's Decimal type}, or just doing floating point math via eval() or similar?

If it is not doing the former, Calculate probably should do this, as at least a one other software calculator tool I know moved to an arbitrary precision approach to avoid these sorts of quirks.

Changed 16 months ago by godiard

This ticket can be related to #2697

Changed 14 months ago by miguelgarcia

patch for this issue

Changed 14 months ago by godiard

  • owner changed from rwh to garycmartin
  • status changed from new to assigned

Changed 14 months ago by garycmartin

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.