Campfyre
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Trev13@programming.dev to Programming@programming.dev · 2 days ago

Big Decimals: Stop Using Floats or Cents for Money

medium.com

external-link
message-square
53
fedilink
84
external-link

Big Decimals: Stop Using Floats or Cents for Money

medium.com

Trev13@programming.dev to Programming@programming.dev · 2 days ago
message-square
53
fedilink
Most people dealing with money in software hit the same annoying problem: the need to store and compute money values that were exact…
  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    That is default IEEE behaviour: https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even

    This is the default rounding mode used in IEEE 754 operations for results in binary floating-point formats.

    Though it’s definitely a bad default because it’s so surprising. Javascript and Rust do not do this.

    Not really anything to do with determinism though.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 114 users / day
  • 386 users / week
  • 1.6K users / month
  • 7.61K users / 6 months
  • 1 local subscriber
  • 22.9K subscribers
  • 2.45K Posts
  • 36.7K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.7
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org