Math Scalar Library
Programming Reference Manual Fortran
Version 1.1 DD-00003-111

Math Scalar Library 1.1
Reference Manual (Fortran)
DD-00003-111

Jan Adelsbach

February 17, 2025
Contents
1 About this Guide
1.1 Legal Information
1.2 Feedback and Contact
1.3 Introduction
1.4 Audience for This Guide
1.5 How to Use This Guide
1.6 Conventions Used in This Guide
2 Overview
2.1 Introduction
2.2 Function Naming Scheme
2.3 Thread Safety
2.4 FPU Signaling
3 Utility
3.1 mscaver - Version query
4 Rounding
4.1 sfloor - Round down to nearest integral part
4.2 sceil - Round up to nearest integral part
4.3 strunc - Truncate to nearest integral part
4.4 sround - Round to nearest integral part
5 Roots
5.1 ssqrt - Square root ⎷-
 x
5.2 srsqrt - Inverse square root   ⎷-
1/ x
5.3 scbrt - Cube root ⎷3-
  x
5.4 srcbrt - Inverse cube root   3⎷-
1/ x
6 Trigonometric Functions
6.1 ssin - Sine sin(x)
6.2 scos - Cosine cos(x)
6.3 stan - Tangent tan(x)
6.4 scsc - Cosecant csc(x)
6.5 ssec - Secant sec(x)
6.6 scot - Cotangent cot(x)
6.7 sasin - Arcsine   -1
sin  (x)
6.8 sacos - Arccosine    -1
cos (x)
6.9 satan - Arctangent   -1
tan  (x)
6.10 sacsc - Arccosecant   -1
csc  (x)
6.11 sasec - Arcsecant    -1
sec  (x)
6.12 sacot - Arcotangent    -1
cot (x)
7 Trigonometric Functions (Half-Cycle)
7.1 ssinpi - Half-Cycle Sine sin(πx)
7.2 scospi - Half-Cycle Cosine cos(πx)
7.3 stanpi - Half-Cycle Tangent tan(πx)
7.4 scscpi - Half-Cycle Cosecant csc(πx)
7.5 ssecpi - Half-Cycle Secant sec(πx)
7.6 scotpi - Half-Cycle Cotangent cot(πx)
7.7 sasinpi - Half-Cycle Arcsine   -1
sin  (x)/π
7.8 sacospi - Half-Cycle Arccosine    -1
cos  (x)/π
7.9 satanpi - Half-Cycle Arctangent   -1
tan  (x)/π
7.10 sacscpi - Half-Cycle Arccosecant   -1
csc (x)/π
7.11 sasecpi - Half-Cycle Arcsecant    -1
sec  (x)/π
7.12 sacotpi - Half-Cycle Arcotangent    -1
cot  (x)/π
8 Trigonometric Functions (Degrees)
8.1 ssind - Degree Sine sin(x)
8.2 scosd - Degree Cosine cos(x)
8.3 stand - Degree Tangent tan(x)
8.4 scscd - Degree Cosecant csc(x)
8.5 ssecd - Degree Secant sec(x)
8.6 scotd - Degree Cotangent cot(x)
8.7 sasind - Degree Arcsine   -1
sin  (x)
8.8 sacosd - Degree Arccosine    -1
cos  (x)
8.9 satand - Degree Arctangent    -1
tan  (x)
8.10 sacscd - Degree Arccosecant    -1
csc (x)
8.11 sasecd - Degree Arcsecant    -1
sec  (x)
8.12 sacotd - Degree Arcotangent    -1
cot  (x)
9 Hypergeometric Functions
9.1 ssinh - Hypergeometric sine sinh(x)
9.2 scosh - Hypergeometric cosine cosh(x)
9.3 stanh - Hypergeometric tangent tanh(x)
9.4 scsch - Hypergeometric Cosecant csch(x)
9.5 scsch - Hypergeometric Secant csech(x)
9.6 scsch - Hypergeometric Cotangent ccoth(x)
9.7 sasinh - Hypergeometric arcsine    -1
sinh  (x)
9.8 sacosh - Hypergeometric arccosine    -1
cosh  (x)
9.9 satanh - Hypergeometric arctangent     -1
tanh (x)
9.10 sacsch - Hypergeometric arccosecant     -1
csch (x)
9.11 sasech - Hypergeometric arcsecant    -1
sech  (x)
9.12 sacoth - Hypergeometric arccotangent     -1
coth  (x)
10 Hypergeometric Functions Minus X
10.1 ssinhmx - Hypergeometric sine minus x sinh(x)-x
10.2 scoshmx - Hypergeometric cosine minux x cosh(x)-x
10.3 stanhmx - Hypergeometric tangent minus x tanh(x)-x
11 Versine Functions
11.1 sver - Versine ver(x)
11.2 svcs - Vercosine vcs(x)
11.3 scvs - Coversine cvs(x)
11.4 scvc - Covercone cvc(x)
11.5 shav - Haversine hav(x)
11.6 shac - Havercosine hac(x)
11.7 shcv - Hacoversine hcv(x)
11.8 shcc - Hacovercosine hcc(x)
11.9 saver - Arcversine    -1
ver (x)
11.10 savcs - Arcvercosine   -1
vcs  (x)
11.11 sacvs - Arccoversine   -1
cvs  (x)
11.12 sacvc - Arccovercone   -1
cvc (x)
11.13 sahav - Archaversine    -1
hav  (x)
11.14 sahac - Archavercosine   -1
hac (x)
11.15 sahcv - Archacoversine   -1
hcv (x)
11.16 sahcc - Archacovercosine    -1
hcc  (x)
12 Versines (Half-Cycle)
12.1 sverpi - Half-Cycle Versine ver(πx)
12.2 svcspi - Half-Cycle Vercosine vcs(πx)
12.3 scvspi - Half-Cycle Coversine cvs(πx)
12.4 scvcpi - Half-Cycle Covercosine cvc(πx)
12.5 shavpi - Half-Cycle Haversine hav(πx)
12.6 shacpi - Half-Cycle Havercosine hac(πx)
12.7 shcvpi - Half-Cycle Hacoversine hcv(πx)
12.8 shccpi - Half-Cycle Hacovercosine hcc(πx)
12.9 saverpi - Half-Cycle Arcversine    -1
ver (x)/π
12.10 savcspi - Half-Cycle Arcvercosine   -1
vcs  (x)/π
12.11 sacvspi - Half-Cycle Arccoversine   -1
cvs  (x)/π
12.12 sacvcpi - Half-Cycle Arccovercone    -1
cvc (x)/π
12.13 sahavpi - Half-Cycle Archaversine    -1
hav  (x)/π
12.14 sahacpi - Half-Cycle Archavercosine    -1
hac (x)/π
12.15 sahcvpi - Half-Cycle Archacoversine    -1
hcv (x)/π
12.16 sahccpi - Half-Cycle Archacovercosine    -1
hcc  (x)/π
13 Versines (Degree)
13.1 sverd - Versine ver(x)
13.2 svcsd - Vercosine vcs(x)
13.3 scvsd - Coversine cvs(x)
13.4 scvcd - Covercosine cvc(x)
13.5 shavd - Haversine hav(x)
13.6 shacd - Havercosine hac(x)
13.7 shcvd - Hacoversine hcv(x)
13.8 shccd - Hacovercosine hcc(x)
13.9 saverd - Arcversine    -1
ver (x)
13.10 savcsd - Arcvercosine   -1
vcs  (x)
13.11 sacvsd - Arccoversine   -1
cvs  (x)
13.12 sacvcd - Arccovercone   -1
cvc (x)
13.13 sahavd - Archaversine    -1
hav  (x)
13.14 sahacd - Archavercosine   -1
hac (x)
13.15 sahcvd - Archacoversine   -1
hcv (x)
13.16 sahccd - Archacovercosine    -1
hcc  (x)
14 Exsecant and Excosecant
14.1 sexs - Exsecant exs(x)
14.2 sexc - Excosecant exc(x)
14.3 saexs - Arcexsecant    -1
exs  (x)
14.4 saexc - Arcexcosecant   -1
exc (x)
15 Exsecant and Excosecant (Half-Cycle)
15.1 sexspi - Half-Cycle Exsecant exs(πx)
15.2 sexcpi - Half-Cycle Excosecant exc(πx)
15.3 saexspi - Half-Cycle Arcexsecant    -1
exs  (x)/π
15.4 saexcpi - Half-Cycle Arcexcosecant   -1
exc (x)/π
16 Exsecant and Excosecant (Degrees)
16.1 sexsd - Exsecant exs(x)
16.2 sexcd - Excosecant exc(x)
16.3 saexsd - Arcexsecant    -1
exs  (x)
16.4 saexcd - Arcexcosecant   -1
exc (x)
17 Other Trigonometric functions
17.1 sgd - Gudermannian function gd(x)
17.2 sagd - Inverse Gudermannian function   -1
gd  (x)
17.3 scrd - Chord crd(x)
17.4 sacrd - Inverse Chord   -1
crd  (x)
18 Cardinal Trigonometric Functions
18.1 ssinc - Cardinal Sine sinc(x)
18.2 scosc - Cardinal Cosine cosc(x)
18.3 stanc - Cardinal Tangent tanc(x)
19 Cardinal Normalized Trigonometric Functions
19.1 ssincpi - Cardinal Normalized Sine sincπ(x)
19.2 scoscpi - Cardinal Normalized Cosine coscπ(x)
19.3 stancpi - Cardinal Normalized Tangent tancπ(x)
20 Cardinal Hyperbolic Trigonometric Functions
20.1 ssinhc - Cardinal Hyperbolic Sine sinhc(x)
20.2 scoshc - Cardinal Hyperbolic Cosine coshc(x)
20.3 stanhc - Cardinal Hyperbolic Tangent tanhc(x)
21 Expoentials and Logarithms
21.1 sexp - Exponentiation  x
e
21.2 sexpm1 - Exponentiation  x
e -1
21.3 sexp2 - Binary exponentiation  x
2
21.4 sexp2m1 - Binary exponentiation minus one  x
2 -1
21.5 sexp10 - Natural exponentiation   x
10
21.6 sexp10m1 - Natural exponentiation minus one   x
10 -1
21.7 slog - Natural logarithm log(x)
21.8 slog2 - Base-2 logarithm log2(x)
21.9 slog10 - Base-10 logarithm log10(x)
21.10 slog1p - Natural logarithm plus one log(x+1)
21.11 spow - Raise  y
x
21.12 sfmod - Remainder mod(x,y)
22 Special Functions
22.1 serf - Error function erf(x)
22.2 serfinv - Inverse Error function   -1
erf  (x)
22.3 serfc - Complementary error function erfc(x)
22.4 serfcinv - Inverse Complementary error function    -1
erfc  (x)
22.5 sj0 - Bessel function J0(x)
22.6 sy0 - Bessel function Y0(x)
22.7 sj1 - Bessel function J1(x)
22.8 sy1 - Bessel function Y1(x)
22.9 sjn - Bessel function Jn(x)
22.10 syn - Bessel function Yn(x)
22.11 slgamma - Log-Gamma function logΓ (x)
22.12 seinst1 - Einstein function E1(x)
22.13 seinst2 - Einstein function E2(x)
22.14 seinst3 - Einstein function E3(x)
22.15 seinst4 - Einstein function E4(x)
22.16 ssi - Sine Integral Si(x)
22.17 sci - Cosine Integral Ci(x)
22.18 sti2 - Inverse Tangent Integral Ti2(x)
23 Other Functions
23.1 sfabs - Absolute value |x|
23.2 scopysign - Copy sign
23.3 shypot - Euclidean distance √︁-2---2
 x + y
23.4 sremainder - Remainder
24 Complex Numbers
24.1 screal - Complex real component Re(x)
24.2 scimag - Complex imaginary component Im(x)
24.3 scabs - Complex absolute value |x|
24.4 scarg - Complex argument arg(x)
24.5 sconj - Complex conjugate -
x
24.6 scproj - Complex Riemann sphere projection proj(x)
24.7 scexp - Complex exponentiation exp(x)
24.8 sclog - Complex logarithm log(x)
24.9 scsqrt - Complex square root ⎷-
 x
24.10 scpow - Complex power  y
x
24.11 sccis - Complex Euler’s Formula exp(ix)
25 Complex Trigonometry
25.1 scsin - Complex sine sin(x)
25.2 sccos - Complex cosine cos(x)
25.3 sctan - Complex tangent tan(x)
25.4 scasin - Complex arcsine   -1
sin  (x)
25.5 scacos - Complex arccosine   -1
cos  (x)
25.6 scatan - Complex arctangent    -1
tan (x)
25.7 scsinh - Complex hyperbolic sine sinh(x)
25.8 sccosh - Complex hyperbolic cosine cosh(x)
25.9 sctanh - Complex hyperbolic tangent tanh(x)
25.10 sccsch - Complex hyperbolic cosecant csch(x)
25.11 scsech - Complex hyperbolic secant sech(x)
25.12 sccoth - Complex hyperbolic cotangent coth(x)
25.13 scasinh - Complex hyperbolic arcsine    -1
sinh  (x)
25.14 scacosh - Complex hyperbolic arccosine     -1
cosh  (x)
25.15 scatanh - Complex hyperbolic arctangent     -1
tanh (x)
25.16 scacsch - Complex hyperbolic arccosecant     -1
csch (x)
25.17 scasech - Complex hyperbolic arcsecant    -1
sech  (x)
25.18 scacoth - Complex hyperbolic arccotangent     -1
coth  (x)
25.19 scgd - Complex Gudermannian gd(x)
25.20 scagd - Complex inverse Gudermannian   -1
gd (x)
26 Complex Versines
26.1 scver - Complex Versine ver(x)
26.2 scvcs - Complex Vercosine vcs(x)
26.3 sccvs - Complex Coversine cvs(x)
26.4 sccvc - Complex Covercone cvc(x)
26.5 schav - Complex Haversine hav(x)
26.6 schac - Complex Havercosine hac(x)
26.7 schcv - Complex Hacoversine hcv(x)
26.8 schcc - Complex Hacovercosine hcc(x)
26.9 scaver - Complex Arcversine   -1
ver  (x)
26.10 scavcs - Complex Arcvercosine    -1
vcs  (x)
26.11 scacvs - Complex Arccoversine    -1
cvs  (x)
26.12 scacvc - Complex Arccovercone   -1
cvc  (x)
26.13 scahav - Complex Archaversine    -1
hav (x)
26.14 scahac - Complex Archavercosine    -1
hac  (x)
26.15 scahcv - Complex Archacoversine    -1
hcv  (x)
26.16 scahcc - Complex Archacovercosine    -1
hcc (x)
27 Complex Cardinal Trigonometric Functions
27.1 scsinc - Complex Cardinal Sine sinc(x)
27.2 sccosc - Complex Cardinal Cosine cosc(x)
27.3 sctanc - Complex Cardinal Tangent tanc(x)
28 Complex Cardinal Hyperbolic Trigonometric Functions
28.1 scsinhc - Complex Cardinal Hyperbolic Sine sinhc(x)
28.2 sccoshc - Complex Cardinal Hyperbolic Cosine coshc(x)
28.3 sctanhc - Complex Cardinal Hyperbolic Tangent tanhc(x)
29 Acknowledgements

[next]