[Matrix-SIG] Re: Matrix-SIG digest, Vol 1 #364 - 9 msgs

skaller skaller@maxtal.com.au
Thu, 10 Feb 2000 03:22:53 +1100


Greg Kochanski wrote:

> By the way, automatic downcasting has a hidden problems if python
> is ever set to trap underflow errors.   I had a program that would
> randomly crash every 10th (or so) time I ran it with a large dataset
> (1000x1000 linear algebra).   After days of hair-pulling, I found that
> the matrix was being converted from double to float at one step,
> and about 1 in 10,000,000 of the entries was too small to represent
> as a single precision number.  That very rare event would underflow,
> be trapped, and crash the program with a floating point exception.

And conversely, IF the programmer deliberately trapped underflows
to terminate an iteration, _upcasting_ can be seen to be unsafe,
since the values may oscillate near zero rather than underflow
as expected.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
homepage: http://www.maxtal.com.au/~skaller
download: ftp://ftp.cs.usyd.edu/au/jskaller