From 2a756a36ab46315937425f492c58e9804367b6c8 Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 25 May 2026 12:15:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20`Math`=20=E3=82=92=E5=AE=9A?= =?UTF-8?q?=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/math.rbs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 core/math.rbs 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 From 00b582be35d6e1f94f5eaf4dc3f5be1f269402ed Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 25 May 2026 12:15:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/math.rb | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 test/math.rb 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