Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions core/math.rbs
Original file line number Diff line number Diff line change
@@ -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
78 changes: 78 additions & 0 deletions test/math.rb
Original file line number Diff line number Diff line change
@@ -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