chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #587: CR: expt should signal error on domain erro


From: Chicken Trac
Subject: Re: [Chicken-janitors] #587: CR: expt should signal error on domain error
Date: Tue, 21 Jun 2011 18:09:51 -0000

#587: CR: expt should signal error on domain error
-----------------------------+----------------------------------------------
  Reporter:  felix           |       Owner:       
      Type:  task            |      Status:  new  
  Priority:  minor           |   Milestone:       
 Component:  core libraries  |     Version:  4.7.x
Resolution:                  |    Keywords:  expt 
-----------------------------+----------------------------------------------

Comment(by zbigniew):

 It is reasonable to throw an exception on domain error in pow().  To me,
 this is always going to be a programming mistake by the user, who expects
 a complex number.  Couple notes: errno may, but is not guaranteed to, be
 set after a domain error; you are supposed to test the exception flags
 (see fenv(3)) afterward.  For example, it doesn't seem to be set on OS X.
 A better way in this case is probably to detect the domain error by
 testing the arguments prior to the call.  Testing for NaN afterward would
 probably work as well, since pow() only returns NaN in exactly this case,
 but feels less right because NaN is not really an error code.

 It's also reasonable to have {{fpexpt}} just return the raw NaN, in case
 you want the low-level C behavior.  Ideally, we'd have some way for the
 user to obtain the fp exception flags afterward.  But that's probably
 better saved for when someone is complaining they need it.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/587#comment:4>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]