761
Stop using floats (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] wischi@programming.dev 1 points 3 weeks ago* (last edited 3 weeks ago)

Not only for audio, but everything that doesn't have to be an exact base 10 representation (like money). Anything that represents something "analog" or "measured" is perfectly fine to store in a float. Temperature, humidity, windspeed, car velocity, rocket acceleration, etc. Calculations with floats are perfectly accurate and given the same bit length are as accurate as decimal types. The only thing they can't do is exactly(!) represent base 10 decimals but for a very large amount of applications that doesn't matter.

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

Programmer Humor

20033 readers
834 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