generic + numeric + literals = abomination
so at so.do
Sat Mar 27 05:04:21 PDT 2010
On Sat, 27 Mar 2010 13:52:28 +0200, bearophile <bearophileHUGS at lycos.com>
>> Since D is superb, i like to know how you do it in D.
>> If you got a better idea in C++, i would like to hear that too!
> You know there are float literal too, in C++/D, like: 5.5f
> I don't think D can help you more than C++ here.
> Can you explain better what the problem is and what kind of solution you
> would like?
You are right, i guess i wasn't clear enough.
In 5.5f, f is the float literal, i am trying to write generic code.
Say i changed the type to f64(double), or f128 by just changing a line.
typedef f128 scalar;
// or in D
alias f128 scalar;
So each cast above will be like f128(5.5f)...
What have i gained by increasing precision to 64 or 128 bit here?
Clear enough? :)
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn