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

Home » Public Forums » archive » Re: SIGN function: signof(num or array of num)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: SIGN function: signof(num or array of num) [message #70139 is a reply to message #70138] Tue, 16 March 2010 08:32 Go to previous messageGo to previous message
Ding is currently offline  Ding
Messages: 20
Registered: March 2008
Junior Member
On Mar 16, 1:31 pm, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Tue, 16 Mar 2010, Ding wrote:
>> Dear IDL users,
>
>> I cannot find the SIGN function in IDL procedures, but one in
>> Solarsoft ssw/maths/ SIGN which occupy the name, but different
>> purpose( sign(a)*b). so I wrote the SIGNOF() function which is to get
>> the sign of a number or array,
>
>> Hopefully I am not repeating someone' work! you are welcome to
>> comments!
>
>> return, fix(abs(input)/input)
>
> IDL> input=0 & help, fix(abs(input)/input)
> <Expression>    INT       =        0
> % Program caused arithmetic error: Integer divide by 0
>
> I think SIGNOF() should not cause an arithmetic error for finite numbers.
>
> regards,
> lajos

This is expected in my algorithm, as the sign of 0 is considered to be
0. although there is an error in the IDL language, however 0/0=0, is
still true. the power of this in array calculation

IDL> a=[[1,0][-1,0]]
IDL> print,signof(a)
1 0
-1 0

Ding Yuan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to read data with format codes?
Next Topic: Predefined iTool Visualization in existing iTool

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

Current Time: Fri Oct 10 23:02:22 PDT 2025

Total time taken to generate the page: 0.94130 seconds