Skip to content
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.

Addable

func + (left: Self, right: Self) -> Self

Negatable

prefix func - (instance: Self) -> Self

Substractable

func - (left: Self, right: Self) -> Self

Multiplicable

func * (left: Self, right: Self) -> Self

Dividable

func / (left: Self, right: Self) -> Self

Modulable

func % (left: Self, right: Self) -> Self

Powerable

Math Eagle defines a power operator: **

typealias PowerType
func ** (left: Self, right: Double) -> PowerType
init(PowerType)

SetCompliant

var isNatural: Bool { get }
var isInteger: Bool { get }

BasicMathValue

This means it adopts the following protocols:

  • Equatable
  • Comparable
  • Addable
  • Substractable
  • Multiplicable
  • Dividable
  • SetCompliant
  • IntegerLiteralConvertible

FullMathValue

This means it adopts the following protocols:

  • Equatable
  • Comparable
  • Addable
  • Negatable
  • Substractable
  • Multiplicable
  • Dividable
  • Powerable
  • SetCompliant
  • IntegerLiteralConvertible
Clone this wiki locally