• nous@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Decimal does come at a cost though, being slower than raw floats. When you don’t need precision but do need performance then it is still valid to use floats. And quite often you don’t need absolute precision for things.

    • SkyeStarfall@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Be careful however, if you work with really large numbers this will absolutely tank your performance and eat up all your memory.

      There’s a reason floating point numbers exist. They are very good at what they do, at the cost of lower precision and being a bit more difficult to work with.