mostNegative

Returns the most negative value of the numeric type T.

template mostNegative (
T
) if (
isNumeric!T ||
isSomeChar!T
||
isBoolean!T
) {
enum mostNegative;
enum byte mostNegative;
enum mostNegative;
}

Examples

static assert(mostNegative!float == -float.max);
static assert(mostNegative!double == -double.max);
static assert(mostNegative!real == -real.max);
static assert(mostNegative!bool == false);
import std.meta : AliasSeq;

static foreach (T; AliasSeq!(bool, byte, short, int, long))
    static assert(mostNegative!T == T.min);

static foreach (T; AliasSeq!(ubyte, ushort, uint, ulong, char, wchar, dchar))
    static assert(mostNegative!T == 0);

Meta

Suggestion Box / Bug Report