129
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 12 Mar 2024
129 points (94.5% liked)
Asklemmy
43899 readers
827 users here now
A loosely moderated place to ask open-ended questions
If your post meets the following criteria, it's welcome here!
- Open-ended question
- Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
- Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
- Not ad nauseam inducing: please make sure it is a question that would be new to most members
- An actual topic of discussion
Looking for support?
Looking for a community?
- Lemmyverse: community search
- sub.rehab: maps old subreddits to fediverse options, marks official as such
- !lemmy411@lemmy.ca: a community for finding communities
~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~
founded 5 years ago
MODERATORS
In which case you're probably using a predefined 64-bit floating point number, which I think is accurate to 15 digits.
Well, you know what's funny, after writing the comment above, I double-checked what the π constant is called in Rust, as that's what I'm mostly coding with these days.
And well, it actually makes you choose. There's
f32::consts::PI
andf64::consts::PI
. Which I guess, makes sense. If you're calculating with 32-bit floats, you should be aware that π is going to be less precise.So, yeah, I'm a hoax, computer scientists do need to decide between 32-bit and 64-bit.
In fact, the one time I needed π in Rust, was as a 32-bit float. I built a tiny gravity simulation in a game engine and game engines generally use 32-bit floats...