Skip to content

Commit bdeaa40

Browse files
triallaxsharkdp
authored andcommitted
Add csc, sec, cot, and friends
The package set was upgraded in this commit to get these functions in the new `purescript-decimals` version, and PureScript was upgraded with the package set accordingly.
1 parent 173b88d commit bdeaa40

4 files changed

Lines changed: 55 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- uses: purescript-contrib/setup-purescript@main
1515
with:
16-
purescript: "0.15.0"
16+
purescript: "0.15.4"
1717

1818
- uses: actions/setup-node@v3
1919
with:

packages.dhall

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ in upstream
105105
-------------------------------
106106
-}
107107
let upstream =
108-
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220509/packages.dhall
109-
sha256:d4c1a03606efdbb7bb7745a9d3aa908cb1ba5611921373659a4c7bf1c41c106c
108+
https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20220718/packages.dhall
109+
sha256:a6d66723b6109f1e3eaf6575910f1c51aa545965ce313024ba329360e2f009ac
110110

111111
in upstream

src/Data/Quantity/Math.purs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,32 @@
44
-- | to a scalar fails, they will return a `ConversionError`.
55
module Data.Quantity.Math
66
( acos
7+
, asec
78
, asin
9+
, acsc
810
, atan
11+
, acot
912
, atan2
1013
, cos
14+
, sec
1115
, exp
1216
, ln
1317
, sin
18+
, csc
1419
, tan
20+
, cot
1521
, sinh
22+
, csch
1623
, cosh
24+
, sech
1725
, tanh
26+
, coth
1827
, asinh
28+
, acsch
1929
, acosh
30+
, asech
2031
, atanh
32+
, acoth
2133
, ceil
2234
, floor
2335
, log10
@@ -60,12 +72,21 @@ lift2 f q1 q2 = do
6072
acos Quantity Result
6173
acos = lift Decimal.acos
6274

75+
asec Quantity Result
76+
asec = lift Decimal.asec
77+
6378
asin Quantity Result
6479
asin = lift Decimal.asin
6580

81+
acsc Quantity Result
82+
acsc = lift Decimal.acsc
83+
6684
atan Quantity Result
6785
atan = lift Decimal.atan
6886

87+
acot Quantity Result
88+
acot = lift Decimal.acot
89+
6990
atan2 Quantity Quantity Result
7091
atan2 x y = removeDims <$> lift2 Decimal.atan2 x y
7192
where
@@ -74,6 +95,9 @@ atan2 x y = removeDims <$> lift2 Decimal.atan2 x y
7495
cos Quantity Result
7596
cos = lift Decimal.cos
7697

98+
sec Quantity Result
99+
sec = lift Decimal.sec
100+
77101
exp Quantity Result
78102
exp = lift Decimal.exp
79103

@@ -83,27 +107,51 @@ ln = lift Decimal.ln
83107
sin Quantity Result
84108
sin = lift Decimal.sin
85109

110+
csc Quantity Result
111+
csc = lift Decimal.csc
112+
86113
tan Quantity Result
87114
tan = lift Decimal.tan
88115

116+
cot Quantity Result
117+
cot = lift Decimal.cot
118+
89119
sinh Quantity Result
90120
sinh = lift Decimal.sinh
91121

122+
csch Quantity Result
123+
csch = lift Decimal.csch
124+
92125
cosh Quantity Result
93126
cosh = lift Decimal.cosh
94127

128+
sech Quantity Result
129+
sech = lift Decimal.sech
130+
95131
tanh Quantity Result
96132
tanh = lift Decimal.tanh
97133

134+
coth Quantity Result
135+
coth = lift Decimal.coth
136+
98137
asinh Quantity Result
99138
asinh = lift Decimal.asinh
100139

140+
acsch Quantity Result
141+
acsch = lift Decimal.acsch
142+
101143
acosh Quantity Result
102144
acosh = lift Decimal.acosh
103145

146+
asech Quantity Result
147+
asech = lift Decimal.asech
148+
104149
atanh Quantity Result
105150
atanh = lift Decimal.atanh
106151

152+
acoth Quantity Result
153+
acoth = lift Decimal.acoth
154+
107155
ceil Quantity Result
108156
ceil = lift Decimal.ceil
109157

src/Quantities.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ import Data.Quantity (ConversionError(..), Quantity, abs, approximatelyEqual, as
2424
isFinite, pow, prettyPrint, prettyPrint', qAdd, qDivide, qMultiply,
2525
qNegate, qSubtract, quantity, quantity', scalar, scalar', showResult,
2626
sqrt, toScalar, toScalar', toStandard, (.*), (⊕), (⊖), (⊗), (⊘)) as DQ
27-
import Data.Quantity.Math (acos, acosh, asin, asinh, atan, atan2, atanh, ceil, cos, cosh, e,
28-
exp, factorial, floor, gamma, ln, log10, max, max2, mean, min,
29-
min2, modulo, pi, round, sin, sinh, tan, tanh, tau, phi) as DQM
27+
import Data.Quantity.Math (acos, acosh, acot, acoth, acsc, acsch, asec, asech, asin, asinh, atan,
28+
atan2, atanh, ceil, cos, cosh, cot, coth, csc, csch, e, exp, factorial,
29+
floor, gamma, ln, log10, max, max2, mean, min, min2, modulo, pi, round,
30+
sec, sech, sin, sinh, tan, tanh, tau, phi) as DQM
3031
import Data.Quantity.Physics (avogadroConstant, electronCharge, electronMass, g0,
3132
gravitationalConstant, kB, planckConstant, protonMass,
3233
idealGasConstant, speedOfLight, µ0, µB, α, ε0, ℏ) as DQP

0 commit comments

Comments
 (0)