Inconstant log(-1) handling [message #964] |
Mon, 26 April 1993 18:15 |
gsh7w
Messages: 9 Registered: March 1991
|
Junior Member |
|
|
I strongly get the idea that this is one of those "Doctor, it hurts
when I do this." "Don't do that." type posts, but here it goes. In IDL
v3.0.0 on a sparcstation 10, running 4.0.3b there seems to be an
inconsistency with how logarithms of negative numbers are done. Don't
sugguest that I shouldn't be doing this in the first place, I know I
shouldn't, however what IDL is giving me seems a tad bit weird. I do
know that if I do a
IDL>tmp=check_math(trap=0) & delvar,tmp
in my startupfile, IDL returns NaN's for the illegal values, but it
does not seem to do so by default.
Greg Hennessy
> idl
IDL. Version 3.0.0 (sunos sparc).
Copyright 1989-1992, Research Systems, Inc.
All rights reserved. Unauthorized reproduction prohibited.
Site: 2762.
Licensed for use by: UVA (Perseus)
% Compiled module: CINIT.
SUNIDL>x=findgen(6)-3
SUNIDL>print,x
-3.00000 -2.00000 -1.00000 0.00000 1.00000 2.00000
SUNIDL>print,alog10(x)
% Program caused arithmetic error: Floating illegal operand
% Detected at $MAIN$ (ALOG10).
% Program caused arithmetic error: Floating divide by 0
% Detected at $MAIN$ (ALOG10).
200000. 200000. 200000. 0.00000 0.00000 0.301030
SUNIDL>print,alog10(x)
% Program caused arithmetic error: Floating illegal operand
% Detected at $MAIN$ (ALOG10).
% Program caused arithmetic error: Floating divide by 0
% Detected at $MAIN$ (ALOG10).
1.00000 1.00000 1.00000 0.00000 0.00000 0.301030
SUNIDL>
--
-Greg Hennessy, University of Virginia
USPS Mail: Astronomy Department, Charlottesville, VA 22903-2475 USA
Internet: gsh7w@virginia.edu
UUCP: ...!uunet!virginia!gsh7w
|
|
|