From 2e96d0654bb7146d40f71697c66a8fa6826440ee Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Wed, 12 Jul 2017 19:21:26 +0200 Subject: [PATCH] Issue 16984 - Make std.math runnable --- std/math.d | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/std/math.d b/std/math.d index 7e297b21c..39082ab4c 100644 --- a/std/math.d +++ b/std/math.d @@ -2771,8 +2771,7 @@ if (isFloatingPoint!T) int exp; real mantissa = frexp(123.456L, exp); - // check if values are equal to 19 decimal digits of precision - assert(equalsDigit(mantissa * pow(2.0L, cast(real) exp), 123.456L, 19)); + assert(approxEqual(mantissa * pow(2.0L, cast(real) exp), 123.456L)); assert(frexp(-real.nan, exp) && exp == int.min); assert(frexp(real.nan, exp) && exp == int.min); @@ -2782,6 +2781,15 @@ if (isFloatingPoint!T) assert(frexp(0.0, exp) == 0.0 && exp == 0); } +@system unittest +{ + int exp; + real mantissa = frexp(123.456L, exp); + + // check if values are equal to 19 decimal digits of precision + assert(equalsDigit(mantissa * pow(2.0L, cast(real) exp), 123.456L, 19)); +} + @safe unittest { import std.meta : AliasSeq; @@ -3619,6 +3627,11 @@ real log2(real x) @safe pure nothrow @nogc } /// +@system unittest +{ + assert(approxEqual(log2(1024.0L), 10)); +} + @system unittest { // check if values are equal to 19 decimal digits of precision