Re: Plea for inline expansion of transcendentals.

From: Xavier Leroy (
Date: Sat Dec 11 1999 - 16:31:35 MET

Date: Sat, 11 Dec 1999 16:31:35 +0100
From: Xavier Leroy <>
To: David McClain <>,
Subject: Re: Plea for inline expansion of transcendentals.
In-Reply-To: <000f01bf4246$81914b30$210148bf@dylan>; from David McClain on Thu, Dec 09, 1999 at 06:08:34AM -0700

> Since I do a great deal of bluk math processing, it would sure be nice if
> many of the simpler transcendental functions could be inlined by OCAMLOPT.
> I'm speaking primarily of round_to_int, sin, cos, tan, asin, acos, atan,
> atan2, log, exp, sqrt, etc.
> Of course I am working on Pentium class machines which have these functions
> available in hardware. Other arhitectures might not be so kind in this
> regard...

One difficulty with the FSIN, FCOS, etc, Pentium instructions is that
they fail if the argument is greater than 2^64 (if I remember
correctly). To produce a correct result in all cases, the error must
be trapped and the operation retried after suitable normalization of
the argument. This makes it difficult to inline those operations.

(Note: I said "correct result", not "meaningful result". No one in
their right minds would compute sin(2^64), but still we have to
produce the same result as everyone else even in this case.)

- Xavier Leroy

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET