Skip to content

Commit a6bcf1b

Browse files
committed
Added tests for csc and cscd
1 parent a1d2036 commit a6bcf1b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/trig.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,30 @@ pub mod trig_functions {
277277
}
278278

279279
/// Returns the cosecant of the argument given in radians
280+
/// ```typescript
281+
/// assert_eq(csc(-pi/2), -1.0)
282+
/// ```
283+
/// ```typescript
284+
/// assert_eq(csc(0.0), 1.0/0.0)
285+
/// ```
286+
/// ```typescript
287+
/// assert_eq(csc(pi/2), 1.0)
288+
/// ```
280289
#[rhai_fn(name = "csc")]
281290
pub fn csc(radians: FLOAT) -> FLOAT {
282291
1.0 / FLOAT::sin(radians)
283292
}
284293

285294
/// Returns the cosecant of the argument given in degrees
295+
/// ```typescript
296+
/// assert_eq(cscd(-90.0), -1.0)
297+
/// ```
298+
/// ```typescript
299+
/// assert_eq(cscd(0.0), 1.0/0.0)
300+
/// ```
301+
/// ```typescript
302+
/// assert_eq(cscd(90.0), 1.0)
303+
/// ```
286304
#[rhai_fn(name = "cscd")]
287305
pub fn cscd(degrees: FLOAT) -> FLOAT {
288306
1.0 / FLOAT::sin(deg2rad(degrees))

0 commit comments

Comments
 (0)