On Sat, Sep 12, 2020 at 12:56:25PM -0700, Christopher Barker wrote: > Is there any guarantee in Python or the C spec, or the IEEE spec that, e.g.: > > 1e10000 > > would create an Inf value, rather than an error of some sort?
IEEE-754 requires that float literals overflow to infinity. I don't have a source for this (I cannot find a copy of the IEEE-754 standard except behind paywalls) but I have a very strong memory of either Tim Peters and Mark Dickinson stating this, and I believe them. (If either of them are reading this, please confirm or deny.) > And there's still NaN -- any way to get that with a literal? If you have an INF, then you can generate a NAN with `INF - INF`. In general though, Python doesn't support generating the full range of NANs with payloads directly. -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LX5XVAN3FZCXBBHVKU6MGKWXZAS63Y2D/ Code of Conduct: http://python.org/psf/codeofconduct/