Michael Van Canneyt michael.vancanneyt at wisa.be
Mon Oct 15 09:25:06 CEST 2001

On Sat, 13 Oct 2001, [koi8-r] íÅÄ×ÅÄÅ× óÌÁ×Á wrote:

> Hello, developers,
> It seems to be a bug in MATH.PP in arcsin function.
> I think, this is incorrect:
> if abs(x) > 1 then InvalidArgument
> I added these strings:
> const Epsilon = 1.0e-9;
> ....
> if (x-1)<=Epsilon then x:=1;
> if (x+1)<=Epsilon then x:=-1;
> I made these changes because of InvalidArgument exception when arcsin
> parameter (displayed by GDB) is 1 (but, I think, it was near 1, but
> not 1).

But if it is larger than 1, arcsin is not defined ?
You deliberately introduce an error in the calculation in this way ?

It may be better to change the code to

if abs(x)>1.0 then

Because then reals are used for the comparision, since in the case
of abs(X) > 1 the '1' will probably be interpreted as an integer.


More information about the fpc-devel mailing list