diff --git a/std/internal/math/errorfunction.d b/std/internal/math/errorfunction.d index 9be6ac6c3..6c57a364d 100644 --- a/std/internal/math/errorfunction.d +++ b/std/internal/math/errorfunction.d @@ -25,6 +25,11 @@ module std.internal.math.errorfunction; import std.math; +pure: +nothrow: +@safe: +@nogc: + private { immutable real EXP_2 = 0.13533528323661269189L; /* exp(-2) */ enum real SQRT2PI = 2.50662827463100050242E0L; // sqrt(2pi) diff --git a/std/internal/math/gammafunction.d b/std/internal/math/gammafunction.d index d54e53922..28aafce93 100644 --- a/std/internal/math/gammafunction.d +++ b/std/internal/math/gammafunction.d @@ -22,6 +22,11 @@ module std.internal.math.gammafunction; import std.internal.math.errorfunction; import std.math; +pure: +nothrow: +@safe: +@nogc: + private { enum real SQRT2PI = 2.50662827463100050242E0L; // sqrt(2pi) @@ -490,7 +495,7 @@ unittest { assert(logGamma(-real.min_normal*real.epsilon) == real.infinity); // x, correct loggamma(x), correct d/dx loggamma(x). - static real[] testpoints = [ + immutable static real[] testpoints = [ 8.0L, 8.525146484375L + 1.48766904143001655310E-5, 2.01564147795560999654E0L, 8.99993896484375e-1L, 6.6375732421875e-2L + 5.11505711292524166220E-6L, -7.54938684259372234258E-1, 7.31597900390625e-1L, 2.2369384765625e-1 + 5.21506341809849792422E-6L, -1.13355566660398608343E0L, diff --git a/std/mathspecial.d b/std/mathspecial.d index b67e3ff62..d8ba22ac6 100644 --- a/std/mathspecial.d +++ b/std/mathspecial.d @@ -62,7 +62,12 @@ private import std.internal.math.errorfunction; /* *********************************************** * GAMMA AND RELATED FUNCTIONS * * ***********************************************/ -//pure nothrow: + +pure: +nothrow: +@safe: +@nogc: + /** The Gamma function, $(GAMMA)(x) * * $(GAMMA)(x) is a generalisation of the factorial function diff --git a/unittest.d b/unittest.d index f2858027c..9d64a8f64 100644 --- a/unittest.d +++ b/unittest.d @@ -102,7 +102,7 @@ int main(char[][] args) assert(x[2] == 45); cast(void)std.math.sin(3.0); - std.mathspecial.gamma(6.2); + cast(void)std.mathspecial.gamma(6.2); std.demangle.demangle("hello");