-
Notifications
You must be signed in to change notification settings - Fork 6
Math
Rugen Heidbuchel edited this page Apr 30, 2015
·
3 revisions
First of all the math file lists some important constants:
-
PI
: π: The ratio of a circle's circumference to it's diameter. ≈ 3.14159 -
GOLDEN_RATIO
: Φ: The golden ratio. ≈ 1.618 -
INVERSE_GOLDEN_RATIO
: φ: The inverse golden ratio. ≈ 0.618 -
E
: e: Euler's number, base of the natural logarithm. ≈ 2.71828 -
EULER_MASCHERONI
: 𝛾: Euler-Mascheroni constant. ≈ 0.57721 -
GELFOND
: e^π: Gelfond's constant. Also (-1)^(-i), where i is the imaginary unit. ≈ 23.14 -
GELFOND_SCHNEIDER
: 2^√2: Gelfond-Schneider constant, also called Hilbert number. ≈ 2.665
The Math file defines general math protocols for the different numeric types.
func + (left: Self, right: Self) -> Self
prefix func - (instance: Self) -> Self
func - (left: Self, right: Self) -> Self
func * (left: Self, right: Self) -> Self
func / (left: Self, right: Self) -> Self
func % (left: Self, right: Self) -> Self
Math Eagle defines a power operator: **
typealias PowerType
func ** (left: Self, right: Double) -> PowerType
init(PowerType)
var isNatural: Bool { get }
var isInteger: Bool { get }
This means it adopts the following protocols:
- Equatable
- Comparable
- Addable
- Substractable
- Multiplicable
- Dividable
- SetCompliant
- IntegerLiteralConvertible
This means it adopts the following protocols:
- Equatable
- Comparable
- Addable
- Negatable
- Substractable
- Multiplicable
- Dividable
- Powerable
- SetCompliant
- IntegerLiteralConvertible