Skip to content

Commit

Permalink
Sig constraints for approxEqual.
Browse files Browse the repository at this point in the history
  • Loading branch information
H. S. Teoh committed Jan 16, 2018
1 parent 58b1f5d commit fcae11f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions std/math.d
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ version (Win64)
static import core.math;
static import core.stdc.math;
static import core.stdc.fenv;
import std.range.primitives : isInputRange, ElementType;
import std.traits; // CommonType, isFloatingPoint, isIntegral, isSigned, isUnsigned, Largest, Unqual

version(LDC)
Expand Down Expand Up @@ -7524,6 +7525,9 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
pair of elements.
*/
bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 1e-5)
if ((isNumeric!T || (isInputRange!T && isNumeric!(ElementType!T))) &&
(isNumeric!U || (isInputRange!U && isNumeric!(ElementType!U))) &&
isNumeric!V)
{
import std.range.primitives : empty, front, isInputRange, popFront;
static if (isInputRange!T)
Expand Down

0 comments on commit fcae11f

Please sign in to comment.