Closed
Description
Initial prototype:
<*
Ceil which works with comptime constant values
*>
macro ceil_comptime($input)
{
$if $input - (int128)$input == 0 || $input == 0:
return $input;
$endif
// Positive numbers
$if $input > 0:
// Example
// 5.7 - 5 = 0.7
// 5.7 + (1 - 0.7) = 6
return $input + ( 1 - ($input - (double)(int128)$input) );
$endif
// record the sign of the input and take absolute value
$if $input < 0:
// Example
// -5.7 + 5 = 0.7
// -5.7 + 0.7 = -5
return $input + ($input + -1 * (double)(int128)$input);
$endif
}