MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Wishful thinking



>Floating point numbers: They work just like integers, except a float
>would be returned if 1 number in the expression was a float.
>
>;2+2 => 4
>;2.0+2 => 4.0
>;2.0+2.0 => 4.0

One idea I had once is, instead of adding a new type (FLOAT), we could just
overload the math functions for LIST values. Currently, a+b throws E_TYPE
if a or b are lists.
If a non-integer could be represented by a list of {mantissa STR, exponent
NUM}, and the evaluating code were modified accordingly, this could provide
the most powerful math... that I can imagine.

E.g. {"23443",-8} would mean: 0.23443E-8
     {"23443",-8}*5 -> {"117215",-7}

The reason for using a STR for the mantissa is that, for some applications,
the <10 digits that a NUM value would provide, would be too little
accuracy. A STR would be practically unlimited there.

I toyed with the notion of making this hack myself (and call it MUP
obviously ;) but it's too big a hack for me to finish in the next few
years... :)

-------------------------------------------------------------
Gustavo Glusman               Founder/administrator of BioMOO
-- Gustavo@bioinformatics.weizmann.ac.il
-- http://bioinformatics.weizmann.ac.il/Gustavo
-- BioMOO: telnet bioinformatics.weizmann.ac.il 8888
           WWW:   http://bioinfo.weizmann.ac.il:8888





Home | Subject Index | Thread Index