Complex number functions for std.math

Dave Dave_member at pathlink.com
Fri Apr 7 08:57:19 PDT 2006


In article <e15v1k$1qnu$1 at digitaldaemon.com>, James Dunne says...
>
>Don Clugston wrote:
>> Norbert Nemec wrote:
>>> (Sorry for writing "complex" instead of the monstrosity "creal". My
>>> fingers just don't obey me when I command them to write about a
>>> "complex real" number. Of course, "creal" could also stand for "really
>>> complex". But then "real" should be renamed into "cnreal", standing for
>>> "not really complex"...)
>> 
>> It is a bit of an oxymoron. I do like the idea of having 'complex' as a 
>> standard alias in std.math. It should operate almost as a reserved word, 
>> users should not be defining it to be anything other than creal.
>> But I would not like to have to type "imaginary" instead of "ireal" -- 
>> it's just too long. Any ideas on that one?
>> 
>
>Here's what I've devised for a floating-point type system similar to D's:
>
>    single - real single-precision (32-bit) IEEE 754 floating point
>   isingle - imaginary single-precision (32-bit) IEEE 754 floating poi$
>   csingle - complex single
>
>    double - real double-precision (64-bit) IEEE 754 floating point
>   idouble - imaginary double-precision (64-bit) IEEE 754 floating poi$
>   cdouble - complex double
>
>  extended - real extended-precision (80-bit) IEEE 754 floating point
>iextended - imaginary extended-precision (80-bit) IEEE 754 floating point
>cextended - complex extended
>
>     float - alias for  single
>    ifloat - alias for isingle
>    cfloat - alias for csingle
>
>Notably, the float has been renamed to single, and real has been renamed 
>to extended.  Float still lurks around as an alias for single though.
>

Since 'float' is included as an alias that C/++ programmers would be familiar
with, I like this scheme, except 'extended' isn't intuitive, especially on
machines that don't support > 64 bit fp.

Any ideas there?

>-- 
>-----BEGIN GEEK CODE BLOCK-----
>Version: 3.1
>GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O 
>M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e 
>h>--->++ r+++ y+++
>------END GEEK CODE BLOCK------
>
>James Dunne





More information about the Digitalmars-d mailing list