Skip to content

Behaviour of Gambit number objects in Python #3

@tturocy

Description

@tturocy

Gambit implements a Number object, which tracks the original representation of a number used to express a payoff or probability. In particular, Numbers should either be decimals or rationals.

This should be transparent to the user.

Initial suggestions for discussion:

  • Be sure to harmonize fully with the Python "numeric tower"
  • The Gambit Number object should be kept entirely internal. All objects returned when, e.g., retrieving payoffs should be decimal.Decimal or fractions.Fraction, as appropriate. Which to return should be controlled by whether there is a decimal point in the stored text representation.
  • Should accept integers when setting payoffs.
  • Probably we should not accept floating point numbers, as the semantics of these are tricky. The Python decimal.Decimal and fractions.Fraction objects do not accept floats, because of problems with numbers like 0.1. This looks like a good decision and Gambit should follow suit.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions