[fpc-devel] Floating point precision
Jonas Maebe
jonas.maebe at elis.ugent.be
Sat Apr 7 18:11:01 CEST 2007
On 06 Apr 2007, at 21:36, Colin Western wrote:
> Can I ask what determines the precision of floating point
> calculations are done in? It seems that fpc treats (for example,
> with J declared as integer)
>
> 1/sqrt(J+1.0) as single
>
> but
>
> 1/sqrt(J+1) as double
In 2.1.2 and 2.2, both will be evaluated as single (except on 80x87,
because it is not possible to tell the 80x87 to perform a particular
calculation using only single/double precision).
> which seems counter-intuitive. In FORTRAN I can force double
> precision evaluation with sqrt(J+1.0D0) but there is no equivalent
> idea of a double constant in Pascal.
The Pascal equivalent is sqrt(j+double(1.0)).
Jonas
More information about the fpc-devel
mailing list