www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18570] New: exp function does not work correctly for real in

https://issues.dlang.org/show_bug.cgi?id=18570

          Issue ID: 18570
           Summary: exp function does not work correctly for real in 64bit
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: gamblemj gmail.com

exp(real x) does not work when compiled under 64bit but does work under x86.
Others have confirmed this:
https://forum.dlang.org/post/xdssrjvcovxooweudkwn forum.dlang.org

below is a simple example.

import std.stdio;
import std.math;

unittest
{
        writefln("ln(largest double) = %s", log(double.max)); // 709.783
        writefln("e^710 = %s", exp(710.0));// inf, makes sense perhaps

        writefln("ln(largest real) = %s", log(real.max)); // 11356.6
        real t = 710.0;
        writefln("e^710 = %s", exp(t)); //inf in 64bit,  2.23399e+308 for 32bit
}

--
Mar 07 2018