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
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to