This repository was archived by the owner on Dec 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ final class DecimalConstants
22
22
23
23
private static $ GoldenRatio = null ;
24
24
25
+ private static $ SilverRatio = null ;
26
+
25
27
private static $ LightSpeed = null ;
26
28
27
29
/**
@@ -123,6 +125,20 @@ public static function goldenRatio()
123
125
return self ::$ GoldenRatio ;
124
126
}
125
127
128
+ /**
129
+ * Returns the Silver Ratio.
130
+ * @return Decimal
131
+ */
132
+ public static function silverRatio ()
133
+ {
134
+ if (self ::$ SilverRatio === null ) {
135
+ self ::$ SilverRatio = Decimal::fromString (
136
+ "2.41421356237309504880168872420970 "
137
+ );
138
+ }
139
+ return self ::$ SilverRatio ;
140
+ }
141
+
126
142
/**
127
143
* Returns the Light of Speed measured in meters / second.
128
144
* @return Decimal
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ public function testFiniteAbs()
23
23
Decimal::fromString ("1.61803398874989484820458683436564 " )
24
24
));
25
25
26
+ $ this ->assertTrue (DecimalConstants::silverRatio ()->equals (
27
+ Decimal::fromString ("2.41421356237309504880168872420970 " )
28
+ ));
29
+
26
30
$ this ->assertTrue (DecimalConstants::lightSpeed ()->equals (
27
31
Decimal::fromInteger (299792458 )
28
32
));
You can’t perform that action at this time.
0 commit comments