#[cfg(all(not(feature = "std"), not(feature = "libm")))]
compile_error!("`gemath` built without `std` requires feature `libm` for floating-point math. Try: --no-default-features --features libm (and optionally alloc).");
#[inline]
pub fn sqrt(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.sqrt()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::sqrtf(x)
}
}
#[inline]
pub fn sin(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.sin()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::sinf(x)
}
}
#[inline]
pub fn cos(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.cos()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::cosf(x)
}
}
#[inline]
pub fn sin_cos(x: f32) -> (f32, f32) {
#[cfg(feature = "std")]
{
x.sin_cos()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
(libm::sinf(x), libm::cosf(x))
}
}
#[inline]
pub fn tan(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.tan()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::tanf(x)
}
}
#[inline]
pub fn acos(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.acos()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::acosf(x)
}
}
#[inline]
pub fn asin(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.asin()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::asinf(x)
}
}
#[inline]
pub fn atan2(y: f32, x: f32) -> f32 {
#[cfg(feature = "std")]
{
y.atan2(x)
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::atan2f(y, x)
}
}
#[inline]
pub fn exp(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.exp()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::expf(x)
}
}
#[inline]
pub fn floor(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.floor()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::floorf(x)
}
}
#[inline]
pub fn ceil(x: f32) -> f32 {
#[cfg(feature = "std")]
{
x.ceil()
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::ceilf(x)
}
}
#[inline]
pub fn copysign(x: f32, sign: f32) -> f32 {
#[cfg(feature = "std")]
{
x.copysign(sign)
}
#[cfg(all(not(feature = "std"), feature = "libm"))]
{
libm::copysignf(x, sign)
}
}