[Tutor] precision for complex numbers
Alan Gauld
alan.gauld at yahoo.co.uk
Thu Apr 6 19:46:08 EDT 2023
On 06/04/2023 17:32, ThreeBlindQuarks via Tutor wrote:
> I think a very serious problem to consider is that
> most numbers in the real world simply cannot be
> represented in binary. Something as simple as 1/3
> expands infinitely
Not just in binary, 1/3 is also a problem in decimal!
It's a problem with real numbers in general, whatever
base you choose there will be numbers that have either
infinite recurring patterns or, like pi, infinite
non-recurring sequences. binary, being the simplest
probably has most (I can't prove that mathematically,
but I suspect someone can! :-)
The only way to make it work would be a software
library which would be very slow - you couldn't
use the hardware floating point processor or
the GPU processor, both of which can process
regular floats at very high speed.
Gerard mentioned mpmath so maybe it already exists?
I haven't had a chance to investigate mpmath yet.
But the existing float/double implementations have
been way more than I've ever needed, but then I'm
an engineer, not a molecular scientist or similar!
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list