English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 1999-12-12 (22:08)
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