El Miércoles, 17 de Noviembre de 2004 22:28, Richard B. Kreckel escribió:
On Tue, 16 Nov 2004, Isidro [iso-8859-15] Cachadiña Gutiérrez wrote:
I am using cln with real numbers. I have a problem in the expt function...
[...]
I also can define this function as:
cln::cl_R expt(cln::cl_R x, cln::cl_R y) { return exp(x*ln(y)); }
And It works fine, but I think that It have to be defined somewhere in the library.
Well, only if `x' is positive, right? This is ok because the result is a complex number. Or if `y' is integer. No, y can be a real number. There isn't any problem with this.
Normally if you are using real numbers you don't expect to find things like this -5.34^7.32. Perhaphs it would be neccesary a warning in the function to prevent it uses with x<0.
Maybe it would be worthwhile though, considering the fact that we also have sqrt(cl_R) defined only for arguments >= 0 without type checks for that. But given the other signatures, I see only very limited use.
Where you see a limited use I see a mathematical consistency use. If you are working with real number, you don't expect complex numbers arriving elsewhere, or better, you have to know where there is the posibility to find a result that leads to complex numbers. I prefer an error warning if something like sqrt(-1) happen. Saludos.
Saludos -richy.
-- *************************************************************************** * Dr. Isidro Cachadiña Gutiérrez * * Departamento de Física * * Facultad de Ciencias * * Universidad de Extremadura * * 06071 Badajoz ( SPAIN ) * * email: icacha@unex.es * * Teléfono: +34 924 289 300 Ext. 6826 Fax: +34 924 289 651 * *************************************************************************** * Usuario Linux: 8569 * * Para clave pública GnuPG: http://onsager.unex.es/firma.pub.asc * ***************************************************************************