1. 13
  1.  

  2. 1

    Super interesting post; I deal with this quite a bit during assessments of blockchain code that use TypeScript on the front end, and discussing “why you can’t use floats for currency” often comes up. I like what I’m seeing here tho; I don’t know if I can directly recommend to clients, but it’s an interesting discussion point for me to use.

    1. 3

      Yep, dealing with the actual monetary values is another big topic which I didn’t really bother to cover here, mostly because I think it’s already been covered in detail (Javascript, Haskell). Thankfully to turn them into bills and coins I only have to deal with the resulting values; all the heavy lifting in my project is done by Dinero.js with this typings file.

      1. 1

        Good links, dude!

        1. 1

          that’s really interesting, thanks for that!

          Where I usually see issues with clients is code that has two different rounding mechanisms (such as between their own bespoke safemath library for Ethereum and JavaScript). It’s an interesting discussion point to be had, and those links are also interesting, thanks for those!