Promoting to Complex
Paul C. Anagnostopoulos
paul at windfall.com
Mon Sep 27 15:34:37 UTC 2010
At 9/27/2010 11:09 AM, Patrick R. Michaud wrote:
>On Sun, Sep 26, 2010 at 01:58:13PM -0400, Paul C. Anagnostopoulos wrote:
>> Folks,
>>
>> Should PMC functions with partial complex ranges promote their result to a
>> Complex? For example, should sqrt(negative Float) produce a Complex?
>> This issue does not pertain to native numbers, since we never promote
>> them to PMCs.
>
>I would tend to vote "no" here. Most languages would expect
>sqrt(negative Float) to throw an exception, and if a language
>wants the possibility of a complex result it's trivially simple
>to promote a Float to a Complex prior to calling the function.
Throw an exception, or return NaN? Right now most math functions return NaN or garbage on range errors or on complex domains.
~~ Paul
----------------------------------------------------------------
Windfall Paul C. Anagnostopoulos
----------------------------------------------------------
Software 978 371-2316
www.windfall.com
----------------------------------------------------------------
Metaphorical invocations ... often suffer from the
weakness of giving such satisfaction to the human
mind that they tend to be mistaken for incisive and
illuminating observations. ---Torkel Franzen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20100927/91a49e26/attachment.html>
More information about the parrot-dev
mailing list