Provide a first class Decimal class to allow arbitrary precision decimal types that support monetary mathematics. #317

Open
opened 2025-12-30 01:23:30 +01:00 by adam · 1 comment
Owner

Originally created by @HT154 on GitHub (Jul 10, 2025).

Discussed in https://github.com/apple/pkl/discussions/1119

Originally posted by DamianReeves July 10, 2025
Floats are not ideal for monetary calculations as they are not precise. It would be beneficial if Pkl included a decimal type to help with not only specifying decimal types, (which is fairly easy to do), but also providing decimal mathematics (which is a bit more difficult to get right on the user side).

Originally created by @HT154 on GitHub (Jul 10, 2025). ### Discussed in https://github.com/apple/pkl/discussions/1119 <div type='discussions-op-text'> <sup>Originally posted by **DamianReeves** July 10, 2025</sup> Floats are not ideal for monetary calculations as they are not precise. It would be beneficial if Pkl included a decimal type to help with not only specifying decimal types, (which is fairly easy to do), but also providing decimal mathematics (which is a bit more difficult to get right on the user side).</div>
Author
Owner

@odenix commented on GitHub (Aug 14, 2025):

An important aspect of monetary calculations are rounding modes and how/where they are specified.

@odenix commented on GitHub (Aug 14, 2025): An important aspect of monetary calculations are rounding modes and how/where they are specified.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#317