Version française
Home     About     Download     Resources     Contact us    
Browse thread
Plea for inline expansion of transcendentals.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Plea for inline expansion of transcendentals.
> 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