3 ms·
Well, random() functions that are normally used are defined on the [0, 1) interval of 32-bit or 64-bit IEEE 754 floating point numbers, for which it is very muc
by poizan42 7y ago
Well, random() functions that are normally used are defined on the [0, 1) interval of 32-bit or 64-bit IEEE 754 floating point numbers, for which it is very much computable to determine whether they are exactly 1 (there's nothing "real number" about them though, they all belong to a small finite subset of the rations). Of course that isn't really an open interval in the topological sense either.
- edflsafoiewq 7y agoBut that's why it's often a bad idea to test exact equality of floats: the equality test isn't continuous. In fact, for float computations it's usually even more important to use continuous (ie. error tolerant) functions, since floating-point operations can introduce errors.
- saagarjha 7y agoComparing IEEE 754 floating point number is well defined and computable because the domain is discontinuous. It’d be stupid to use anything else…
- deleted 7y ago[deleted]