757
Stop using floats (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] arc@lemm.ee 4 points 10 months ago* (last edited 10 months ago)

The problem is, that most languages have no native support other than 32 or 64 bit floats and some representations on the wire don't either. And most underlying processors don't have arbitrary precision support either.

So either you choose speed and sacrifice precision, or you choose precision and sacrifice speed. The architecture might not support arbitrary precision but most languages have a bignum/bigdecimal library that will do it more slowly. It might be necessary to marshal or store those values in databases or over the wire in whatever hacky way necessary (e.g. encapsulating values in a string).

this post was submitted on 26 Feb 2024
757 points (95.8% liked)

Programmer Humor

19817 readers
3 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS