comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Inconstant log(-1) handling
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Inconstant log(-1) handling [message #844] Thu, 29 April 1993 08:02
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
dit@vaxser.grumed.fu-berlin.de (K.-H. Dittberner) writes:

> In article <C64BH2.Ex0@murdoch.acc.Virginia.EDU>,
> gsh7w@fermi.clas.Virginia.EDU (Greg Hennessy) writes:

>> 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>
>>

> That's what I've just seen running this test on a VAX under OpenVMS 5.5-2
> with no Check_Math set (IDL's default):

> ; IDL Version 3.0.0 (vms vax)
> ; Journal File for VAXSER::SYSTEM
> ; Working directory: SYS$SYSROOT:[SYSMGR]
> ; Date: Tue Apr 27 22:03:48 1993
>
> x=findgen(6)-3
> print,x
> ; -3.00000 -2.00000 -1.00000 0.000000 1.00000 2.00000
> print, alog10(x)
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; 0.000000 0.000000 0.000000 0.000000 0.000000 0.301030
> print, alog10(x)
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; % Program caused arithmetic error: Logarithm of 0 or negative
> ; 0.000000 0.000000 0.000000 0.000000 0.000000 0.301030

> It seems to be, there are 'some differences' between SUN- and VAX-IDL.
> Hope this helps.

> Karl-Heinz.

It's probably not IDL itself, but just differences between the way the
operating systems themselves handle numerical errors.

In my opinion the statement at the top of the original message is right--you
shouldn't do that. At best the results are "unpredictable".

Bill Thompson
Re: Inconstant log(-1) handling [message #957 is a reply to message #844] Tue, 27 April 1993 13:19 Go to previous message
dit is currently offline  dit
Messages: 5
Registered: July 1992
Junior Member
In article <C64BH2.Ex0@murdoch.acc.Virginia.EDU>,
gsh7w@fermi.clas.Virginia.EDU (Greg Hennessy) writes:

> 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>
>

That's what I've just seen running this test on a VAX under OpenVMS 5.5-2
with no Check_Math set (IDL's default):

; IDL Version 3.0.0 (vms vax)
; Journal File for VAXSER::SYSTEM
; Working directory: SYS$SYSROOT:[SYSMGR]
; Date: Tue Apr 27 22:03:48 1993

x=findgen(6)-3
print,x
; -3.00000 -2.00000 -1.00000 0.000000 1.00000 2.00000
print, alog10(x)
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; 0.000000 0.000000 0.000000 0.000000 0.000000 0.301030
print, alog10(x)
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; % Program caused arithmetic error: Logarithm of 0 or negative
; 0.000000 0.000000 0.000000 0.000000 0.000000 0.301030

It seems to be, there are 'some differences' between SUN- and VAX-IDL.
Hope this helps.

Karl-Heinz.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: help for install IDL on Solris 2.1
Next Topic: 2 quick IDL Widgets questions...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:32:47 PDT 2025

Total time taken to generate the page: 0.87992 seconds