Skip to content

Commit ef97b1e

Browse files
committed
So many trig tests
1 parent 6ad636e commit ef97b1e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/trig.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,24 @@ pub mod trig_functions {
139139
}
140140

141141
/// Returns the hyperbolic sine of the argument given in degrees
142+
/// ```typescript
143+
/// assert_eq(sinhd(0.0), 0.0)
144+
/// ```
145+
/// ```typescript
146+
/// assert_eq(sinhd(10.0), sinh(10.0*pi/180.0))
147+
/// ```
142148
#[rhai_fn(name = "sinhd")]
143149
pub fn sinhd(degrees: FLOAT) -> FLOAT {
144150
FLOAT::sinh(deg2rad(degrees))
145151
}
146152

147153
/// Returns the inverse hyperbolic sine in degrees
154+
/// ```typescript
155+
/// assert_eq(asinhd(0.0), 0.0)
156+
/// ```
157+
/// ```typescript
158+
/// assert_eq(asinhd(10.0), 180.0/pi*asinh(10.0))
159+
/// ```
148160
#[rhai_fn(name = "asinhd")]
149161
pub fn asinhd(x: FLOAT) -> FLOAT {
150162
rad2deg(FLOAT::asinh(x))
@@ -322,30 +334,51 @@ pub mod trig_functions {
322334
}
323335

324336
/// Returns the inverse cosecant in degrees
337+
/// ```typescript
338+
/// assert_eq(acscd(-1.0), -90.0)
339+
/// ```
340+
/// ```typescript
341+
/// assert_eq(acscd(inf), 0.0)
342+
/// ```
343+
/// ```typescript
344+
/// assert_eq(acscd(1.0), 90.0)
345+
/// ```
325346
#[rhai_fn(name = "acscd")]
326347
pub fn acscd(x: FLOAT) -> FLOAT {
327348
rad2deg(FLOAT::asin(1.0 / x))
328349
}
329350

330351
/// Returns the hyperbolic cosecant of the argument given in radians
352+
/// ```typescript
353+
/// assert_eq(csch(0.0), inf)
354+
/// ```
331355
#[rhai_fn(name = "csch")]
332356
pub fn csch(radians: FLOAT) -> FLOAT {
333357
1.0 / FLOAT::sinh(radians)
334358
}
335359

336360
/// Returns the hyperbolic cosecant of the argument given in degrees
361+
/// ```typescript
362+
/// assert_eq(cschd(0.0), inf)
363+
/// ```
337364
#[rhai_fn(name = "cschd")]
338365
pub fn cschd(degrees: FLOAT) -> FLOAT {
339366
1.0 / FLOAT::sinh(deg2rad(degrees))
340367
}
341368

342369
/// Returns the inverse hyperbolic cosecant in radians
370+
/// ```typescript
371+
/// assert_eq(acsch(inf), 0.0)
372+
/// ```
343373
#[rhai_fn(name = "acsch")]
344374
pub fn acsch(x: FLOAT) -> FLOAT {
345375
FLOAT::asinh(1.0 / x)
346376
}
347377

348378
/// Returns the inverse hyperbolic cosecant in degrees
379+
/// ```typescript
380+
/// assert_eq(acschd(inf), 0.0)
381+
/// ```
349382
#[rhai_fn(name = "acschd")]
350383
pub fn acschd(x: FLOAT) -> FLOAT {
351384
rad2deg(FLOAT::asinh(1.0 / x))

0 commit comments

Comments
 (0)