mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
Rename internal NUM_DIV_INT references to NUM_DIV_FLOOR.
This balances with NUM_DIV_CEIL (which is another form of integer division).
This commit is contained in:
parent
f39f7eda03
commit
2c4a83788c
@ -316,16 +316,16 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
||||
Box::new(SolvedType::Wildcard),
|
||||
);
|
||||
|
||||
// divInt : Int a, Int a -> Int a
|
||||
// divFloor : Int a, Int a -> Int a
|
||||
add_top_level_function_type!(
|
||||
Symbol::NUM_DIV_INT,
|
||||
Symbol::NUM_DIV_FLOOR,
|
||||
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
|
||||
Box::new(int_type(flex(TVAR1)))
|
||||
);
|
||||
|
||||
// divIntChecked : Int a, Int a -> Result (Int a) [ DivByZero ]*
|
||||
// divFloorChecked : Int a, Int a -> Result (Int a) [ DivByZero ]*
|
||||
add_top_level_function_type!(
|
||||
Symbol::NUM_DIV_INT_CHECKED,
|
||||
Symbol::NUM_DIV_FLOOR_CHECKED,
|
||||
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
|
||||
Box::new(result_type(int_type(flex(TVAR1)), div_by_zero.clone())),
|
||||
);
|
||||
|
@ -196,8 +196,8 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
|
||||
NUM_TAN => num_tan,
|
||||
NUM_DIV_FLOAT => num_div_float,
|
||||
NUM_DIV_FLOAT_CHECKED => num_div_float_checked,
|
||||
NUM_DIV_INT => num_div_int,
|
||||
NUM_DIV_INT_CHECKED => num_div_int_checked,
|
||||
NUM_DIV_FLOOR => num_div_floor,
|
||||
NUM_DIV_FLOOR_CHECKED => num_div_floor_checked,
|
||||
NUM_DIV_CEIL => num_div_ceil,
|
||||
NUM_DIV_CEIL_CHECKED => num_div_ceil_checked,
|
||||
NUM_ABS => num_abs,
|
||||
@ -4369,13 +4369,13 @@ fn num_div_float_checked(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
)
|
||||
}
|
||||
|
||||
/// Num.div : Int a, Int a -> Int a
|
||||
fn num_div_int(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
/// Num.divFloor : Int a, Int a -> Int a
|
||||
fn num_div_floor(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
num_binop(symbol, var_store, LowLevel::NumDivUnchecked)
|
||||
}
|
||||
|
||||
/// Num.divChecked : Int a , Int a -> Result (Int a) [ DivByZero ]*
|
||||
fn num_div_int_checked(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
/// Num.divFloorChecked : Int a , Int a -> Result (Int a) [ DivByZero ]*
|
||||
fn num_div_floor_checked(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
let bool_var = var_store.fresh();
|
||||
let num_var = var_store.fresh();
|
||||
let unbound_zero_var = var_store.fresh();
|
||||
|
@ -948,8 +948,8 @@ define_builtins! {
|
||||
39 NUM_REM_CHECKED: "remChecked"
|
||||
40 NUM_DIV_FLOAT: "div"
|
||||
41 NUM_DIV_FLOAT_CHECKED: "divChecked"
|
||||
42 NUM_DIV_INT: "divFloor"
|
||||
43 NUM_DIV_INT_CHECKED: "divFloorChecked"
|
||||
42 NUM_DIV_FLOOR: "divFloor"
|
||||
43 NUM_DIV_FLOOR_CHECKED: "divFloorChecked"
|
||||
44 NUM_MOD_INT: "modInt"
|
||||
45 NUM_MOD_INT_CHECKED: "modIntChecked"
|
||||
46 NUM_MOD_FLOAT: "modFloat"
|
||||
|
@ -1130,7 +1130,7 @@ so calculations involving them take longer.
|
||||
|
||||
Roc does not let floating point calculations result in `Infinity`, `-Infinity`,
|
||||
or `NaN`. Any operation which would result in one of these
|
||||
(such as `sqrt` or `/`) will return a `Result`.
|
||||
(such as `sqrt` or `/`) will panic.
|
||||
|
||||
Similarly to how there are different sizes of floating point numbers,
|
||||
there are also different sizes of integer to choose from:
|
||||
|
Loading…
Reference in New Issue
Block a user