'real' not able to store it's largest value
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 22 13:29:15 PDT 2017
On 05/22/2017 01:26 PM, colin wrote:
> Am I doing something wrong here?
>
> real.max evaluates to: 1.18973e+4932
>
> So, I'd expect to be able to store any value up to that... however
> ```
> void main()
> {
> writeln("Real max: ", real.max);
> foreach(i; 0..10){
> writefln!("1024 ^^ %s = %s")(i, real(1024 ^^ i));
Like some other languages, expressions are mostly evaluated in
isolation. 1024 ^^ i is an int, which cannot represent anything close to
real.max. :)
This should work:
real(1024) ^^ i
Ali
More information about the Digitalmars-d-learn
mailing list