this post was submitted on 02 Jan 2025
446 points (100.0% liked)

Programmer Humor

854 readers
8 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

top 11 comments
sorted by: hot top controversial new old
[–] codexarcanum@lemmy.dbzer0.com 13 points 2 weeks ago (2 children)

Technically, floating point also imitates irrational and whole numbers as well. Not all numbers though, you'd need a more uhm... elaborate structure to represent complex numbers, surreal numbers, vectors, matrices, and so on.

[–] needanke@feddit.org 6 points 2 weeks ago

It does not even imitate all rationals. For example 1/3.

[–] klangcola@reddthat.com 6 points 2 weeks ago

.... Surreal numbers?!?

[–] arrakark@10291998.xyz 6 points 2 weeks ago (1 children)

IEE 754 is my favourite IEEE standard. 754 gang

[–] SubArcticTundra@lemmy.ml 5 points 2 weeks ago (3 children)

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

[–] wewbull@feddit.uk 3 points 2 weeks ago

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

[–] gandalf_der_12te@discuss.tchncs.de 1 points 2 weeks ago* (last edited 2 weeks 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.

[–] lennivelkant@discuss.tchncs.de 5 points 2 weeks ago

Aren't they fractions rather than floating point decimals?

[–] kuberoot@discuss.tchncs.de 3 points 2 weeks 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.

[–] pencil_nerd@mander.xyz 2 points 2 weeks ago

The downvote is from someone who doesn't understand floating point notation