addaptic

Reference Trigonometry

lz_sine

The sine of an angle.

long lz_sine( CLZNumber* leftOperand, CLZNumber* targetNumber = nullptr );

Correctly rounded. In radians the argument is reduced modulo 2π against a constant carried far enough for the argument's size, so even the sine of 1020 keeps every place. It is then folded into [0, π/4] and summed as a Taylor series, at wide widths by binary splitting.

In degrees, grads or millicles the angle is reduced by whole turns exactly, and an angle whose sine is a rational number is answered exactly: sin 30° is 0.5, and 100 grads is a right angle.

Examples

CallAnswer
lz_sine( 1 )0.841470984807896506652502321630299000
lz_sine( 30 ) degrees0.5
lz_sine( 1E20 )−0.645251285265780844205811711312523007
lz_sine( 100 ) grads1

Each answer is what Addaptic printed for the call, in radians, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also

  • lz_cosine The cosine of an angle.
  • lz_sine_cosine The sine and the cosine of one angle together, for about half the cost of the two.
  • lz_arcsine The angle whose sine is the number.
  • lzc_sine The sine of a complex angle.