View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Absolute value of a number

Elden Paul Iverson wrote on Apr 27, 2008

Mike-

This is a dumb question, but is there an absolute value command for real numbers in IRAF? I have thought about importing the abs() command from linux but all comments say that it only works with int (I thought this was weird). I can get around the issue, quick and dirty, with if statements but would prefer the elegance of a simple command.

Thanks.

-Paul

Mike Fitzpatrick wrote on Apr 27, 2008


ecl> =abs(-1.2)
1.2
ecl> print (abs(-3.14))
3.14


-Mike

Elden Paul Iverson wrote on Apr 27, 2008

Mike-

Is there an easy way to calculate the square root of a number in IRAF?

Thanks.

-Paul

Mike Fitzpatrick wrote on Apr 27, 2008

Use sqrt()

See the $iraf/doc/clman.ms doc for a list of available functions but in general it is what you'd expect.

-Mike

Elden Paul Iverson wrote on Apr 27, 2008

Thanks Mike.

I don't know what happened from the time I posted until the time you replied. We tried the =sqrt() command but it didn't work until you said to try it. (Craig thinks that you must have some remote connection to our IRAF installation and added that task for us so that we could feel really stupid).

In all seriousness though thanks again.

Last post on Apr 27, 2008