Skip to content

Commit

Permalink
Merge pull request #6429 from JackStouffer/issue18693
Browse files Browse the repository at this point in the history
Work On Issue 18693 - Remove rndtonl from std.math
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
  • Loading branch information
dlang-bot authored Apr 10, 2018
2 parents ac1dc46 + b4f675f commit 813327d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
1 change: 0 additions & 1 deletion .dscanner.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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,\
Expand Down
6 changes: 6 additions & 0 deletions changelog/rndtonl-deprecated.dd
Original file line number Diff line number Diff line change
@@ -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.
38 changes: 25 additions & 13 deletions std/math.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 813327d

Please sign in to comment.