Add intrinsics for sqrt and round

This commit is contained in:
Richard Feldman 2020-04-23 17:30:24 -04:00
parent 0191910715
commit b43e582c7a
4 changed files with 97 additions and 3 deletions

View file

@ -323,6 +323,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
SolvedType::Func(vec![float_type()], Box::new(float_type())),
);
// round : Float -> Int
add_type(
Symbol::FLOAT_ROUND,
SolvedType::Func(vec![float_type()], Box::new(int_type())),
);
// highest : Float
add_type(Symbol::FLOAT_HIGHEST, float_type());

View file

@ -386,6 +386,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
unique_function(vec![float_type(UVAR1)], float_type(UVAR2)),
);
// round : Float -> Int
add_type(
Symbol::FLOAT_ROUND,
unique_function(vec![float_type(UVAR1)], int_type(UVAR2)),
);
// highest : Float
add_type(Symbol::FLOAT_HIGHEST, float_type(UVAR1));