 ### math.sk

Created by Shroob

Other available versions. Ordered by newest to oldest versions:

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

``````

function Math_IsFinite(n: number) :: boolean: # what do ya think this is
return false if {_n} is infinity value
return true

function Math_Sign(n: number) :: number: # returns 0 if n = 0, returns 1 if {_n} is positive, returns -1 if {_n} is negative
return -1 if {_n} < 0
return 1 if {_n} > 0
return 0

function Math_Factorial(n: number) :: number: # stirling's approximation
if {_n} < 0: # this complex bro pretty sure it's not even a real number at this point
return NaN value
return 1 if {_n} = 0
if {_n} < 5: # stirling's approximation for low numbers is bad
return Math_Factorial({_n}+5)/({_n}+5)/({_n}+4)/({_n}+3)/({_n}+2)/({_n}+1)
set {_r} to ((2*Math_Pi()*{_n})^0.5*(({_n}/Math_e())^{_n}))^1 # ^1 to force a double
set {_n2} to {_n}
add 1 to {_r2} # a LOT of math
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}
set {_n2} to {_n2}*{_n}