[Issue 5757] New: std.math: exp, expm1, exp2 return 'inf' when no asm.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 20 09:08:59 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5757

           Summary: std.math: exp, expm1, exp2 return 'inf' when no asm.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2011-03-20 09:05:43 PDT ---
The fallback if D_InlineAsm is not a version predicate (true for non-x86
arch's) is not calling the appropriate libm functions for the precision we
require (need 80bit precision).

Regards


diff --git a/std/math.d b/std/math.d
index e5591e7..6bdb3e7 100644
--- a/std/math.d
+++ b/std/math.d
@@ -967,7 +967,7 @@ real exp(real x) @safe pure nothrow
         // and exp2 are so similar).
         return exp2(LOG2E*x);
     } else {
-        return core.stdc.math.exp(x);
+        return core.stdc.math.expl(x);
     }
 }
 /// ditto
@@ -1133,7 +1133,7 @@ L_largenegative:
             ret;
         }
     } else {
-        return core.stdc.math.expm1(x);
+        return core.stdc.math.expm1l(x);
     }
 }

@@ -1315,7 +1315,7 @@ L_was_nan:
             ret;
         }
     } else {
-        return core.stdc.math.exp2(x);
+        return core.stdc.math.exp2l(x);
     }
 }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list