StrictMath Class
The StrictMath
Class is a subset of the Math Class that focuses on providing highly precise mathematical functions. It includes methods for calculating trigonometric functions like sine, cosine, and tangent, as well as their inverse functions like arcsine and arccosine. StrictMath is ideal for situations where accuracy is of utmost importance, ensuring reliable and consistent mathematical calculations.
Methods
StrictMath.sin(a: Double): Double
-Calculates the sine of the argument a
.
var angleInRadians = 1.0; // Angle in radians
var sineValue = StrictMath.sin(angleInRadians);
// sineValue is now approximately 0.8414709848078965
StrictMath.cos(a: Double): Double
- Calculates the cosine of the argument a
.
var angleInRadians = 1.0; // Angle in radians
var cosineValue = StrictMath.cos(angleInRadians);
// cosineValue is now approximately 0.5403023058681398
StrictMath.tan(a: Double): Double
-Calculates the tangent of the argument a
.
var angleInRadians = 1.0; // Angle in radians
var tangentValue = StrictMath.tan(angleInRadians);
// tangentValue is now approximately 1.5574077246549023
StrictMath.asin(a: Double): Double
-Calculates the arcsine of the argument a
.
var sineValue = 0.8414709848078965; // Sine value
var arcsineValue = StrictMath.asin(sineValue);
// arcsineValue is now approximately 1.0 (in radians)
StrictMath.acos(a: Double): Double
-Calculates the arccosine of the argument a
.
var cosineValue = 0.5403023058681398; // Cosine value
var arccosineValue = StrictMath.acos(cosineValue);
// arccosineValue is now approximately 1.0 (in radians)
Was this helpful?