- 1

Would an example of a float be pi?

I'm pretty sure it is, but I just want to check

1st Nov 2017, 1:23 AM
Diamond_Girl
2 Answers
+ 6
Yea. At least that is what you get when you do: from math import pi print(math.pi)
1st Nov 2017, 4:56 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Pi has infinite and more or less random digits, so you'd also need infinite storage to store pi. A float is like 4 bytes so it doesn't quite work. Floats are numbers with stuff after the decimal point though, thats probably what you mean (like 4.43432 or 2.01). Pi is an "irrational" and you can only store an approximation of it in a float.
1st Nov 2017, 1:31 AM
Schindlabua
Schindlabua - avatar