479
submitted 1 day ago by [email protected] to c/[email protected]

Meme of two women fighting while a man smokes from a pipe in the background.

The women fighting are labeled "mathematicians defining pi" and "engineers just using 3 because it's within tolerance"

The man smoking is labeled "astrophysicists" and the pipe is labeled "pi = 1"

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 0 points 1 day ago* (last edited 1 day ago)

"Modern" is a bit misleading, x87 had fldpi. The whole x87 part of the standard has been deprecated with x86_64 in favour of the whole sse series of instructions and those don't come with pi. You instead load a constant from program memory, just like any other.

As processors (as of yet) still support those legacy modes they will also contain the constant somewhere in probably microcode storage, calculating it on the fly makes literally no sense at all: It's (for x87) 80 bits of data, much shorter than any imaginable program, smaller than any circuitry able to compute it so you'd be spending time to save no space which is pointless.

ARM, RISC-V etc. come from the RISC tradition so they wouldn't be caught dead including such an instruction. Both have zero registers though as zero is an absurdly useful constant, simplifying things drastically, both on the hardware front as well as within the instruction set (move is add zero to source, save to destination, clear is add zero and zero, save to destination)


Now, that's finite constants. In particular, it's about floating point arithmetic, which is a wonder of maths and a deep rat's nest of numerology, but has finite precision, it's not true real arithmetic. Real real arithmetic is undecidable, in particular comparison and expansion to decimal form are undecidable. Printing infinite strings of digits is usually not what we want to do, and limiting precision of comparisons is... not ideal, but better than having limited precision at every operation: You can decide once you're comparing how accurate you want things to be and don't have to worry while writing down your formula (btw Herbie exists, and that's why packages like this exist. In that case pi is not a constant but a formula, which can be expanded as needed. Quite slow compared to floating point hardware but when you need it you need it and even if you don't it's still useful as a sanity check, gives you an idea of how far off the floating point results are without having to call in a favour with a mathematician.

this post was submitted on 17 Jun 2025
479 points (97.2% liked)

Science Memes

15221 readers
2363 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS