this post was submitted on 02 Jan 2025
845 points (99.4% liked)

Programmer Humor

32866 readers
1100 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

~~Stolen~~ Cross-posted from here: https://fosstodon.org/@foo/113731569632505985

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 1 week ago (3 children)

Has anyone ever come across 8 or 16 bit floats? What were they used for?

[–] [email protected] 4 points 1 week ago

Neural net evaluation mainly, but FP16 is used in graphics too.

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago) (2 children)

Actually, you can consider RGB values to be (triplets of) floats, too.

Typically, one pixel takes up up to 32 bits of space, encoding Red, Green, Blue, and sometimes Alpha (opacity) values. That makes approximately 8 bits per color channel.

Since each color can be a value between 0.0 (color is off) and 1.0 (color is on), that means every color channel is effectively a 8-bit float.

[–] [email protected] 7 points 1 week ago

Aren't they fractions rather than floating point decimals?

[–] [email protected] 3 points 1 week ago

Pretty sure what you're describing isn't floating-point numbers, but fixed-point numbers... Which would also work just as well or better in most cases where floats are used.