diff --git a/core/math.rbs b/core/math.rbs new file mode 100644 index 0000000..a652fa1 --- /dev/null +++ b/core/math.rbs @@ -0,0 +1,53 @@ +module Math + type double = Integer | Float + + E: Float + + PI: Float + + def self.acos: (double x) -> Float + + def self.acosh: (double x) -> Float + + def self.asin: (double x) -> Float + + def self.asinh: (double x) -> Float + + def self.atan: (double x) -> Float + + def self.atan2: (double y, double x) -> Float + + def self.atanh: (double x) -> Float + + def self.cbrt: (double x) -> Float + + def self.cos: (double x) -> Float + + def self.cosh: (double x) -> Float + + def self.erf: (double x) -> Float + + def self.erfc: (double x) -> Float + + def self.exp: (double x) -> Float + + def self.hypot: (double x, double y) -> Float + + def self.ldexp: (double x, double exp) -> Float + + def self.log: (double x) -> Float + + def self.log10: (double x) -> Float + + def self.log2: (double x) -> Float + + def self.sin: (double x) -> Float + + def self.sinh: (double x) -> Float + + def self.sqrt: (double x) -> Float + + def self.tan: (double x) -> Float + + def self.tanh: (double x) -> Float +end diff --git a/test/math.rb b/test/math.rb new file mode 100644 index 0000000..dd5c45f --- /dev/null +++ b/test/math.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +# rubocop:disable Lint/Void + +Math::E + +Math::PI + +Math.acos 0 +Math.acos 0.0 + +Math.acosh 1 +Math.acosh 1.0 + +Math.asin 0 +Math.asin 0.0 + +Math.asinh 0 +Math.asinh 0.0 + +Math.atan 0 +Math.atan 0.0 + +Math.atan2 0, 1 +Math.atan2 0.0, 1.0 + +Math.atanh 0 +Math.atanh 0.0 + +Math.cbrt 0 +Math.cbrt 0.0 + +Math.cos 0 +Math.cos 0.0 + +Math.cosh 0 +Math.cosh 0.0 + +Math.erf 0 +Math.erf 0.0 + +Math.erfc 0 +Math.erfc 0.0 + +Math.exp 0 +Math.exp 0.0 + +Math.hypot 1, 1 +Math.hypot 1.0, 1.0 + +Math.ldexp 0, 0 +Math.ldexp 0.0, 0.0 + +Math.log 1 +Math.log 1.0 + +Math.log10 1 +Math.log10 1.0 + +Math.log2 1 +Math.log2 1.0 + +Math.sin 0 +Math.sin 0.0 + +Math.sinh 0 +Math.sinh 0.0 + +Math.sqrt 0 +Math.sqrt 0.0 + +Math.tan 0 +Math.tan 0.0 + +Math.tanh 0 +Math.tanh 0.0 + +# rubocop:enable all