feat: add Math.sin, Math.cos, Math.atan2 trig functions
Adds trigonometric functions to the Math module across interpreter, type system, and C backend. JS backend already supported them. Also adds #include <math.h> to C preamble and handles Math module calls through both Call and EffectOp paths in C backend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
12
src/types.rs
12
src/types.rs
@@ -1887,6 +1887,18 @@ impl TypeEnv {
|
||||
"round".to_string(),
|
||||
Type::function(vec![Type::var()], Type::Int),
|
||||
),
|
||||
(
|
||||
"sin".to_string(),
|
||||
Type::function(vec![Type::Float], Type::Float),
|
||||
),
|
||||
(
|
||||
"cos".to_string(),
|
||||
Type::function(vec![Type::Float], Type::Float),
|
||||
),
|
||||
(
|
||||
"atan2".to_string(),
|
||||
Type::function(vec![Type::Float, Type::Float], Type::Float),
|
||||
),
|
||||
]);
|
||||
env.bind("Math", TypeScheme::mono(math_module_type));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user