Strange behaviour with numbers in exponential notation
Christian Gollwitzer
auriocus at gmx.de
Sat Sep 3 02:42:14 EDT 2016
Am 03.09.16 um 02:31 schrieb Marco Sulla:
> On 2 September 2016 at 21:12, Christian Gollwitzer <auriocus at gmx.de> wrote:
>> Am 02.09.16 um 19:24 schrieb Marco Sulla:
>> Because Python has no long double type?
>
> Python no of course, but C++ yes, and CPython is written in C++.
> However, I think the answer is here:
> https://en.wikipedia.org/wiki/Long_double#Implementations
> Briefly, long double is not implemented in all hardwares, or its
> implementation is really different from machine to machine.
Yes - 64 bit IEEE floats are today the universally available floating
point data type across different machines. If you want arbitrary
precision floats, you can have them in Python, too:
https://pypi.python.org/pypi/bigfloat/
Of course this is a "software emulation" and is consequently slower then
hardware floats. It does not, howver take away the principle problem
that you must set the precision from the beginning of your calculation.
Christian
More information about the Python-list
mailing list