This is peak humor
Repeating of course
Submitted 1 month ago by cannedtuna@lemmy.world to science_memes@mander.xyz
https://lemmy.world/pictrs/image/7687173d-19bd-46ba-ba96-1d1367264f3c.webp
Comments
nemopy@lemmy.zip 1 month ago
Unpigged@lemmy.dbzer0.com 1 month ago
The joke missed opportunity to have two ints
LodeMike@lemmy.today 1 month ago
Floats aren’t fractions. Use a rational number library if you actually need a fraction.
floquant@lemmy.dbzer0.com 1 month ago
Isn’t this a looks inside floating point binary representation in memory situation?
Unleaded8163@fedia.io 1 month ago
But... they are fractions.
NeatNit@discuss.tchncs.de 1 month ago
They are fractions of the format m/(2^n), but they only mimic fractions like 2/5.
sculptor0725@sh.itjust.works 1 month ago
That’s 2¹/5 to you!
djmikeale@feddit.dk 1 month ago
I guess op refers to how they’re represented which is a bit complex imo: geeksforgeeks.org/…/floating-point-representation…
yucandu@lemmy.world 1 month ago
I had to just emulate floating points to save pulling in the giant print float library in stm32 to save flash memory. And then I learned that’s what all the pros do IRL anyway.
VinegarChunks@lemmus.org 1 month ago
I am hard pressed to find anyone irl who would be impressed by this but I made a spreadsheet that converts hexadecimal into float using only standard excel formulas.
mercano@lemmy.world 1 month ago
If you need actual numerators and denominators, there are libraries for that.
Quetzalcutlass@lemmy.world 1 month ago
Ah, Apache Commons: for those who felt Java’s standard library wasn’t bloated enough already.
(I kid, I kid, though it was always funny just how many basic features seemed to be missing from Java back in the day despite its massive bundled library, leading to seemingly every major project adding Commons as a dependency. Not as much as thing these days AFAIK)
sirico@feddit.uk 1 month ago
There are two types of c# Devs
Quetzalcutlass@lemmy.world 1 month ago
I feel obligated to post a link to this excellent (albeit incomplete) writeup of posits and unums, which can more accurately represent fractions in memory at the same (or lower) bit size as traditional floating point.
Said page also includes the single best slightly-above-entry-level explanation of how floating point works I’ve ever seen.
terranoid@lemmy.cafe 1 month ago
i have so many schemas to represent the most common fractions perfectly without needing more than just ONE bit. They even work with positive and negative infinity!
Schema 1/2
1 bit, little endian
if one: value is exactly 1/2
If zero: value is NOT one half
Schema 1/3
if one: value is 1/3
Quetzalcutlass@lemmy.world 1 month ago
I’ve managed to create a compression algorithm that reduces files down to a single bit. I call it “is this file ‘loss.png’?”.
It’s guaranteed 100% lossless with any input!
LurkingLuddite@piefed.social 1 month ago
Isn’t a big point of floating point that it can easily have mathematical operators done on them on CPUs? Sure, complex circuitry is no big deal these days, but IIRC, there were very good reasons for what was chosen.
Quetzalcutlass@lemmy.world 1 month ago
One of the linked papers makes the claim that the circuitry would be less complex than that needed for floats, but also includes this note:
The proposed system also lacks NaN and separate positive/negative infinities, so it wouldn’t be a drop-in replacement.