Litipk\BigNumbers\DecimalConstants::goldenRatio PHP Method

goldenRatio() public static method

Returns the Golden Ration, also named Phi.
public static goldenRatio ( ) : Decimal
return Decimal
    public static function goldenRatio()
    {
        if (self::$GoldenRatio === null) {
            self::$GoldenRatio = Decimal::fromString("1.61803398874989484820458683436564");
        }
        return self::$GoldenRatio;
    }

Usage Example

 public function testFiniteAbs()
 {
     $this->assertTrue(DecimalConstants::pi()->equals(Decimal::fromString("3.14159265358979323846264338327950")));
     $this->assertTrue(DecimalConstants::eulerMascheroni()->equals(Decimal::fromString("0.57721566490153286060651209008240")));
     $this->assertTrue(DecimalConstants::goldenRatio()->equals(Decimal::fromString("1.61803398874989484820458683436564")));
     $this->assertTrue(DecimalConstants::lightSpeed()->equals(Decimal::fromInteger(299792458)));
 }