.\" Copyright (c) 2012 Apple Inc. .\" All rights reserved. .Dd December 15, 2012 .Dt __SINPI 3 .Os .Sh NAME .Nm __sinpi .Nd sine-pi function .Sh SYNOPSIS .Fd #include .Ft float .Fn __sinpif "float x" .Ft double .Fn __sinpi "double x" .Sh DESCRIPTION The .Fn __sinpi function returns the sine of pi times .Fa x (measured in radians). This can be computed more accurately than .Fn sin "M_PI * x" , because it can implicitly use as many bits of pi as are necessary to deliver a well-rounded result, instead of the 53-bits to which M_PI is limited. For large .Fa x it may also be more efficient, as the argument reduction involved is significantly simpler. .Pp This function may be especially useful for working with degrees; whereas .Fn sin "M_PI * x / 180.0" cannot produce exact results for angles that naively "should" be exact, like 180 degrees, .Fn __sinpi "x / 180.0" can be computed exactly. .Sh SPECIAL VALUES .Fn __sinpi "-x" is the same as - .Fn __sinpi "x" for any finite .Fa x . .br .Fn __sinpi "±0" returns ±0. .br .Fn __sinpi "n" returns +0 for any positive integer .Fa n . .br .Fn __sinpi "n + 0.5" returns +1 for any even integer .Fa n . .br .Fn __sinpi "n + 0.5" returns -1 for any odd integer .Fa n . .br .Fn __sinpi "±infinity" raises the invalid floating-point exception and returns .Fa NaN . .Sh VECTOR OPERATIONS If you need to apply the .Fn __sinpi function to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may be useful: .Pp .Fd #include .Pp .Ft vFloat .Fn vsinpif "vFloat x" ; .br .Ft void .Fn vvsinpif "float *y" "const float *x" "const int *n" ; .br .Ft void .Fn vvsinpi "double *y" "const double *x" "const int *n" ; .Sh SEE ALSO .Xr __cospi 3 , .Xr __tanpi 3 , .Xr __sincospi 3 , .Xr math 3