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:
Kevin Gillette 2022-04-13 00:17:38 -06:00
parent f39f7eda03
commit 2c4a83788c
No known key found for this signature in database
GPG Key ID: 9009F701BBC0D562
4 changed files with 14 additions and 14 deletions

View File

@ -316,16 +316,16 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
Box::new(SolvedType::Wildcard), Box::new(SolvedType::Wildcard),
); );
// divInt : Int a, Int a -> Int a // divFloor : Int a, Int a -> Int a
add_top_level_function_type!( add_top_level_function_type!(
Symbol::NUM_DIV_INT, Symbol::NUM_DIV_FLOOR,
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))], vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
Box::new(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!( add_top_level_function_type!(
Symbol::NUM_DIV_INT_CHECKED, Symbol::NUM_DIV_FLOOR_CHECKED,
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))], vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
Box::new(result_type(int_type(flex(TVAR1)), div_by_zero.clone())), Box::new(result_type(int_type(flex(TVAR1)), div_by_zero.clone())),
); );
@ -337,7 +337,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
Box::new(int_type(flex(TVAR1))) Box::new(int_type(flex(TVAR1)))
); );
//divCeilChecked : Int a, Int a -> Result (Int a) [ DivByZero ]* // divCeilChecked : Int a, Int a -> Result (Int a) [ DivByZero ]*
add_top_level_function_type!( add_top_level_function_type!(
Symbol::NUM_DIV_CEIL_CHECKED, Symbol::NUM_DIV_CEIL_CHECKED,
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))], vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],

View File

@ -196,8 +196,8 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
NUM_TAN => num_tan, NUM_TAN => num_tan,
NUM_DIV_FLOAT => num_div_float, NUM_DIV_FLOAT => num_div_float,
NUM_DIV_FLOAT_CHECKED => num_div_float_checked, NUM_DIV_FLOAT_CHECKED => num_div_float_checked,
NUM_DIV_INT => num_div_int, NUM_DIV_FLOOR => num_div_floor,
NUM_DIV_INT_CHECKED => num_div_int_checked, NUM_DIV_FLOOR_CHECKED => num_div_floor_checked,
NUM_DIV_CEIL => num_div_ceil, NUM_DIV_CEIL => num_div_ceil,
NUM_DIV_CEIL_CHECKED => num_div_ceil_checked, NUM_DIV_CEIL_CHECKED => num_div_ceil_checked,
NUM_ABS => num_abs, 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 /// Num.divFloor : Int a, Int a -> Int a
fn num_div_int(symbol: Symbol, var_store: &mut VarStore) -> Def { fn num_div_floor(symbol: Symbol, var_store: &mut VarStore) -> Def {
num_binop(symbol, var_store, LowLevel::NumDivUnchecked) num_binop(symbol, var_store, LowLevel::NumDivUnchecked)
} }
/// Num.divChecked : Int a , Int a -> Result (Int a) [ DivByZero ]* /// Num.divFloorChecked : Int a , Int a -> Result (Int a) [ DivByZero ]*
fn num_div_int_checked(symbol: Symbol, var_store: &mut VarStore) -> Def { fn num_div_floor_checked(symbol: Symbol, var_store: &mut VarStore) -> Def {
let bool_var = var_store.fresh(); let bool_var = var_store.fresh();
let num_var = var_store.fresh(); let num_var = var_store.fresh();
let unbound_zero_var = var_store.fresh(); let unbound_zero_var = var_store.fresh();

View File

@ -948,8 +948,8 @@ define_builtins! {
39 NUM_REM_CHECKED: "remChecked" 39 NUM_REM_CHECKED: "remChecked"
40 NUM_DIV_FLOAT: "div" 40 NUM_DIV_FLOAT: "div"
41 NUM_DIV_FLOAT_CHECKED: "divChecked" 41 NUM_DIV_FLOAT_CHECKED: "divChecked"
42 NUM_DIV_INT: "divFloor" 42 NUM_DIV_FLOOR: "divFloor"
43 NUM_DIV_INT_CHECKED: "divFloorChecked" 43 NUM_DIV_FLOOR_CHECKED: "divFloorChecked"
44 NUM_MOD_INT: "modInt" 44 NUM_MOD_INT: "modInt"
45 NUM_MOD_INT_CHECKED: "modIntChecked" 45 NUM_MOD_INT_CHECKED: "modIntChecked"
46 NUM_MOD_FLOAT: "modFloat" 46 NUM_MOD_FLOAT: "modFloat"

View File

@ -1130,7 +1130,7 @@ so calculations involving them take longer.
Roc does not let floating point calculations result in `Infinity`, `-Infinity`, Roc does not let floating point calculations result in `Infinity`, `-Infinity`,
or `NaN`. Any operation which would result in one of these 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, Similarly to how there are different sizes of floating point numbers,
there are also different sizes of integer to choose from: there are also different sizes of integer to choose from: