Skip to content

Commit 18f3f56

Browse files
authored
Use Math.CopySign in CalendricalCalculationsHelper (dotnet#60776)
1 parent 3146533 commit 18f3f56

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/libraries/System.Private.CoreLib/src/System/Globalization/CalendricalCalculationsHelper.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,6 @@ public static double JulianCenturies(double moment)
224224
return (dynamicalMoment - Noon2000Jan01) / DaysInUniformLengthCentury;
225225
}
226226

227-
private static bool IsNegative(double value)
228-
{
229-
return Math.Sign(value) == -1;
230-
}
231-
232-
private static double CopySign(double value, double sign)
233-
{
234-
return (IsNegative(value) == IsNegative(sign)) ? value : -value;
235-
}
236-
237227
// equation-of-time; approximate the difference between apparent solar time and mean solar time
238228
// formal definition is EOT = GHA - GMHA
239229
// GHA is the Greenwich Hour Angle of the apparent (actual) Sun
@@ -261,7 +251,7 @@ private static double EquationOfTime(double time)
261251

262252
// approximation of equation of time is not valid for dates that are many millennia in the past or future
263253
// thus limited to a half day
264-
return CopySign(Math.Min(Math.Abs(equation), TwelveHours), equation);
254+
return Math.CopySign(Math.Min(Math.Abs(equation), TwelveHours), equation);
265255
}
266256

267257
private static double AsLocalTime(double apparentMidday, double longitude)

0 commit comments

Comments
 (0)