Complex number functions for std.math

James Dunne james.jdunne at gmail.com
Fri Apr 7 08:05:01 PDT 2006


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.

-- 
-----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