[-] wischi@programming.dev 1 points 8 months ago

Looks like it worked 🤣

[-] wischi@programming.dev 1 points 10 months ago

I don't think think so. I'm not even sure my interpretation was actually why she reacted that way.

[-] wischi@programming.dev 1 points 1 year ago

🤣 well played

[-] wischi@programming.dev 1 points 1 year ago

You are right, I have no idea how I messed up that calculation.

I get how most pet owners really love their pets, but I'm pretty sure a lot of them would sell them in an instant for 3 million (or even 400k).

[-] wischi@programming.dev 1 points 2 years ago

But that's not because floats are inaccurate. A very very pedantic compiler wouldn't even let you write f64 x = 0.1; because 0.1 (and also 0.2 and 0.3) can't be converted to a float exactly (note that 0.5, 0.25, 0.125, etc. can be stored exactly!)

The moment you write f64 x = 0.1; and expect the computer to store that inside a float you already made a wrong assumption. What the computer actually stores is the float value that is as close as possible to 0.1. But not because floats are inaccurate, but because floats are base 2. Note that floating point types in general don't have to be base 2 - they can be any base (for example decimal types are base 10) but IEEE754 floats are base 2, because it allows for simpler hardware implementations.

An even more pedantic compiler would only let you write floating point in binary like 10.10110001b and let you do the conversation, because it would make it blatantly obvious that most base 10 decimals can't even be converted without information loss. So the "inaccuracy" is not(!) because float calculations are inaccurate but because many people wrongly assume that the base 10 literal they wrote can be stored inside a float.

Floats are actually really accurate (ignoring some Intel FPU hardware bugs). I skipped a lot of details which you can find here: https://zeta.one/floats-are-not-inaccurate/

Equipped with that knowledge your calculation 0.1+0.2 != 0.3 can simply be translated into: "The closest float to 0.1" + "The closest float to 0.2" is not equal to "The closest float to 0.3". Keep in mind that the addition itself is perfectly accurate and without any error/rounding(!) on every EEE754 conforming implementation.

[-] wischi@programming.dev 1 points 2 years ago

There are just two years to select and "two facts" in total? Or it doesn't work on mobile as expected.

[-] wischi@programming.dev 1 points 2 years ago

Franz Reichelt vibes

[-] wischi@programming.dev 1 points 2 years ago

A Dirac impulse slap would only hurt once

[-] wischi@programming.dev 1 points 2 years ago

Nice. Haven't thought about that 🤣

[-] wischi@programming.dev 1 points 2 years ago

Not even SSDs are. Do you have an SSD? You should lookup the exact drive size in bytes, it's very likely not an exact power of two.

[-] wischi@programming.dev 1 points 3 years ago

IIRC the US already uses metric (technically). The imperial units are defined in terms of metric units.

[-] wischi@programming.dev 1 points 3 years ago

Sure. In a few weeks there will be another article about a new battery that "scientist found" with 100 times the capacity of modern Li-Ion batteries 🤣

view more: ‹ prev next ›

wischi

0 post score
0 comment score
joined 3 years ago