From b4f675fe150afaa577d6a41d6013ca33d932bd57 Mon Sep 17 00:00:00 2001 From: Jack Stouffer Date: Thu, 5 Apr 2018 09:40:02 -0400 Subject: [PATCH] Work On Issue 18693 - Remove rndtonl from std.math --- .dscanner.ini | 1 - changelog/rndtonl-deprecated.dd | 6 ++++++ std/math.d | 38 ++++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 changelog/rndtonl-deprecated.dd diff --git a/.dscanner.ini b/.dscanner.ini index 2391b7da59b..0c1ba1daa98 100644 --- a/.dscanner.ini +++ b/.dscanner.ini @@ -252,7 +252,6 @@ has_public_example="-etc.c.curl,\ -std.internal.scopebuffer,\ -std.internal.test.dummyrange,\ -std.json,\ --std.math,\ -std.mathspecial,\ -std.mmfile,\ -std.net.curl,\ diff --git a/changelog/rndtonl-deprecated.dd b/changelog/rndtonl-deprecated.dd new file mode 100644 index 00000000000..8b6ae6140c8 --- /dev/null +++ b/changelog/rndtonl-deprecated.dd @@ -0,0 +1,6 @@ +std.math.rndtonl has been deprecated + +$(REF rndtonl, std, math) is a rounding function only available when using the +Digital Mars C Runtime on Windows. As this function is not cross-platform, it +has been deprecated, and will be removed on version 2.089. Please use +$(REF round, std, math) instead. diff --git a/std/math.d b/std/math.d index 88ffeb5069f..612ff877b75 100644 --- a/std/math.d +++ b/std/math.d @@ -1804,22 +1804,34 @@ long rndtol(float x) @safe pure nothrow @nogc { return rndtol(cast(real) x); } assert(prndtol != null); } -/***************************************** - * Returns x rounded to a long value using the FE_TONEAREST rounding mode. - * If the integer value of x is - * greater than long.max, the result is - * indeterminate. +/** +$(RED Deprecated. Please use $(LREF round) instead.) + +Returns `x` rounded to a `long` value using the `FE_TONEAREST` rounding mode. +If the integer value of `x` is greater than `long.max`, the result is +indeterminate. + +Only works with the Digital Mars C Runtime. + +Params: + x = the number to round +Returns: + `x` rounded to an integer value */ +deprecated("rndtonl is to be removed by 2.089. Please use round instead") extern (C) real rndtonl(real x); -// issue 18693 -//@safe unittest -//{ -// assert(rndtol(1.0) == 1.0); -// assert(rndtol(1.2) == 1.0); -// assert(rndtol(1.7) == 2.0); -// assert(rndtol(1.0001) == 1.0); -//} +/// +deprecated @system unittest +{ + version(CRuntime_DigitalMars) + { + assert(rndtonl(1.0) is -real.nan); + assert(rndtonl(1.2) is -real.nan); + assert(rndtonl(1.7) is -real.nan); + assert(rndtonl(1.0001) is -real.nan); + } +} /*************************************** * Compute square root of x.