Function in prelude::math auto-imported

sin

fn sin(float x) -> float
Source: compiler/src/builtin_docs/prelude/math.hy

Returns the sine of x (in radians).

Like every scalar function in prelude::math, it takes and returns float and follows IEEE-754: invalid inputs give NaN and overflow gives infinity, never a clamped value. Auto-imported.

Parameters#

NameType
xfloat

Returns#

float

Examples#

use tests::assert;
let pi = 3.141592653589793;
assert!(sin(0.0) == 0.0);
assert!(sin(pi / 2.0) == 1.0);

See also#

  • prelude::math
  • float
  • cos: Returns the cosine of x (in radians).
  • tan: Returns the tangent of x (in radians).
  • sqrt: Returns the square root of x.
  • floor: Returns the largest whole number less than or equal to x, as a float.
  • ceil: Returns the smallest whole number greater than or equal to x, as a float.
  • exp: Returns e raised to the power x.
↑ ↓ navigate ↵ open