March 26, 2010

Lars Tandle Kyllingstad wrote:
> Walter Bright wrote:
>>
>>
>> Andrei Alexandrescu wrote:
>>> Sounds good to me.
>>>
>>> Walter, what steps do we need to take to extricate complex from the language and put the related code in the stdlib with Don's help?
>>>
>>>
>>
>> It's pretty trivial. You can use the complex support code in dmd as a good starting point.
>
> http://www.dsource.org/projects/dmd/browser/trunk/src/complex_t.h http://www.dsource.org/projects/dmd/browser/trunk/src/backend/bcomplex.c
>
> Would these contain the code you are referring to?

Yes.

>
> Both look like standard, straightforward implementations of complex arithmetic operations.  Are there optimisations hidden in other parts of the code that I'm not seeing?
>

Nope. If there are clever/magic alternatives, I don't know about them.

March 26, 2010

Andrei Alexandrescu wrote:
>
> * Some asserts before division by zero would be helpful. Carrying through with silent NaNs annoy the heck out of anyone.
>

I don't agree. Complex arithmetic behavior should mirror IEEE 754 floating point behavior as far as exceptions and NaNs go.
March 27, 2010
On 27 March 2010 02:14, Walter Bright <walter at digitalmars.com> wrote:
>
>
> Andrei Alexandrescu wrote:
>>
>> * Some asserts before division by zero would be helpful. Carrying through with silent NaNs annoy the heck out of anyone.
>>
>
> I don't agree. Complex arithmetic behavior should mirror IEEE 754 floating point behavior as far as exceptions and NaNs go.

Yes, enable the division by zero exception if you don't want NaNs.

Secondly, the modulus operation should use std.math.hypot().  You can
copy the implementation from std.math.abs.
I think it should probably be called abs() rather than mod(). Mod has
such as strong connotation of %, that it's bound to cause confusion.
Everything else looks pretty good.


> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
1 2
Next ›   Last »