[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling of invalid arguments



On 29-Jun-06, at 10:55 AM, Bradley Lucier wrote:

On Jun 29, 2006, at 9:15 AM, Marc Feeley wrote:

I have noticed that the specification of flexpt, flsqrt, flatan and many other procedures may return a meaningless result for certain ranges of arguments.

I think "that's not a bug, that's a feature," to coin a phrase. I believe the intention is to let

(flsqrt -1.0)

return whatever the hardware sqrt function returns (a NaN in IEEE 754 arithmetic) rather than

> (sqrt -1.0)
+1.i

which is what Gambit returns. I believe the intent is to somehow map the <math.h> C functions to Scheme functions; any author of the SRFI want to comment here?

That was my understanding also. My comment is that for such cases of "invalid arguments" it should be an option to return a meaningless flonum rather than a requirement. If the wording "it is an error" is unacceptable, then I can live with giving the option to signal an error or return a meaningless flonum.

Marc