[CLN-list] Types in cl_R
Bruno Haible
bruno at clisp.org
Thu Nov 18 23:03:03 CET 2004
Isidro Cachadiña Gutiérrez wrote:
> If you
> are working with real number, you don't expect complex numbers arriving
> elsewhere
That's a problem with your mathematical education, not a problem with CLN.
> I prefer an error warning if something like sqrt(-1) happen.
You get a compilation error if you write
cl_R x, y, z;
z = expt(x, y);
This makes you aware to check your formulas. You do that, then insert the
cast
cl_R x, y, z;
z = As(cl_R)(expt(x, y));
then CLN checks that the result is indeed a real number. What more do you
want?
The signature sqrt : cl_R -> cl_R is a convenience function which omits
the possibility of a compilation error. Maybe this is a disadvantage.
Bruno
More information about the CLN-list
mailing list