On 17 dec 2006, at 23:40, Jeff Miller wrote:

This is slightly off-topic, but nonetheless somewhat
relevant to these special math functions...

Can anyone explain what is the precision of fpc's
built-in math functions like sqrt, ln, exp, and so on?

According to the online documentation, these take
a ValReal argument and return a ValReal result:
  e.g.:  function sqrt(d: ValReal):ValReal;
But what exactly is a ValReal?  Real? Double? Extended?

The highest supported precision by the compiler on the used fpu. For x86 and x86_64 (except for Win64, because it no longer supports the x87) that is 80 bits "extended", on other platforms that's currently 64 bits (except maybe those that use emulation, they may be limited to 32 bits).

It would be ideal if these math functions would take arguments
of different precision and return results in the same precision.
Is that what happens?

No, they always return a result with the highest possible  precision.

I am asking because I need extended precision versions
of sqrt, etc, and I do not believe fpc provides that
(at least by default).

It does (on x86 and non-Win64 x86-64 at least).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to