Xref: utzoo comp.lang.fortran:782 comp.lang.c:10814
Path: utzoo!attcan!uunet!husc6!mailrus!ames!ll-xn!mit-eddie!bloom-beacon!mcgill-vision!mouse
From: mouse@mcgill-vision.UUCP (der Mouse)
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Should I convert FORTRAN code to C?
Message-ID: <1172@mcgill-vision.UUCP>
Date: 20 Jun 88 08:34:07 GMT
References: <10655@agate.BERKELEY.EDU> <1857@hubcap.UUCP> <10681@agate.BERKELEY.EDU>
Organization: McGill University, Montreal
Lines: 36

In article <10681@agate.BERKELEY.EDU>, jerry@violet.berkeley.edu ( Jerry Berkman ) writes:
> As for "x = abs(x);", it does compile and load.

> However, it's calling a library function.  What's wrong with that?
> (1) It's slow.
> (2) It returns the absolute value of integers.  You can type it
>     "float abs();" and it works on the VAX, but it may not work on
>     all systems.

Doesn't work on our VAX.  Your VAX must be using a different
floating-point format from the one in the VAX architecture manual.

I tried compiling and running this:

float abs();
main()
{
 printf("%g\n",abs(123.456));
 printf("%g\n",abs(-123.456));
}

and it gave me

-0.00210706
0.00210706

Of course, maybe you think that's what it means for it to work on the
VAX....but I daresay most people would disagree.

(You could also break down and use fabs, the floating-point absolute
value routine - or is that cheating?)

					der Mouse

			uucp: mouse@mcgill-vision.uucp
			arpa: mouse@larry.mcrcim.mcgill.edu