Complex number functions for std.math

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Sat Apr 8 09:54:25 PDT 2006


James Dunne wrote:
> 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.
> 

How about this:

floats   ifloats   cfloats
floatd   ifloatd   cfloatd
floate   ifloats   cfloatd

floatc   ifloatc   cfloats
floath   ifloath   cfloatd

Another alternative:

float32  ifloat32  cfloat32
float64  ...
float80
float128
float16

etc. Just exploring alternatives, not actually suggesting it, but I 
prefer a nomenclature that actually mentions that the type is a floating 
point number. ("single", "extended"? Single what? Extended what?)

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list