# Decimal math in TypeScript

**URL:** <https://forum.canton.network/t/decimal-math-in-typescript/5726>\
**Category:** App Development\
**Tags:** daml, daml-sdk\
**Created:** [November 29, 2022, 5:21pm UTC](https://forum.canton.network/t/decimal-math-in-typescript/5726 "2022-11-29T17:21:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Schaeffer](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/michael_schaeffer/32/503_2.png) [@Michael\_Schaeffer](https://forum.canton.network/u/Michael_Schaeffer)\
**Post date:** [November 29, 2022, 5:21pm UTC](https://forum.canton.network/t/decimal-math-in-typescript/5726/1 "2022-11-29T17:21:36Z")

</div>

Given that `Decimal` ledger values are encoded by the TypeScript bindings as `string` values (to avoid loss of precision), is there a recommended library for mathematical operations on these values?

[https://docs.daml.com/0.13.54/daml2ts/index.html#primitive-daml-types-daml-types](https://docs.daml.com/0.13.54/daml2ts/index.html#primitive-daml-types-daml-types)

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [November 29, 2022, 5:25pm UTC](https://forum.canton.network/t/decimal-math-in-typescript/5726/2 "2022-11-29T17:25:38Z")

</div>

I’ve used [GitHub - MikeMcl/decimal.js: An arbitrary-precision Decimal type for JavaScript](https://github.com/MikeMcl/decimal.js/) successfully but I haven’t tested other libraries extensively.
