import std.math.operations : isClose; assert(isClose(12345.6789L.quantize!10(-2), 12345.68L)); assert(isClose(12345.6789L.quantize!(10, -2), 12345.68L)); assert(isClose(12345.6789L.quantize!(10, floor)(-2), 12345.67L)); assert(isClose(12345.6789L.quantize!(10, -2, floor), 12345.67L)); assert(isClose(12345.6789L.quantize!22(1), 12342.0L)); assert(isClose(12345.6789L.quantize!22, 12342.0L));
Round val to a multiple of pow(base, exp). rfunc specifies the rounding function to use; by default this is rint, which uses the current rounding mode.