Skip to content

Commit

Permalink
Fix functions (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreffs authored Sep 21, 2021
1 parent 71bc25e commit 126cdc2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Sources/FirebladeMath/Functions/sqrt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import Glibc
/// If a domain error occurs, an implementation-defined value is returned (NaN where supported).
/// If a range error occurs due to underflow, the correct result (after rounding) is returned.
public func sqrt(_ float: Float) -> Float {
sqrtf(float)
#if FRB_MATH_DARWIN
return Darwin.sqrtf(float)
#endif

#if FRB_MATH_GLIBC
return Glibc.sqrtf(float)
#endif
}

/// Computes square root of arg.
Expand Down
8 changes: 7 additions & 1 deletion Sources/FirebladeMath/Functions/tan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import Glibc
/// If a domain error occurs, an implementation-defined value is returned (NaN where supported).
/// If a range error occurs due to underflow, the correct result (after rounding) is returned.
public func tan(_ angleRad: Float) -> Float {
tanf(angleRad)
#if FRB_MATH_DARWIN
return Darwin.tanf(angleRad)
#endif

#if FRB_MATH_GLIBC
return Glibc.tanf(angleRad)
#endif
}

/// Computes the tangent of arg (measured in radians).
Expand Down
8 changes: 7 additions & 1 deletion Sources/FirebladeMath/Functions/tanh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import Glibc
/// - Returns: If no errors occur, the hyperbolic tangent of arg (tanh(arg), or (e^arg*-e^-arg)/(e^arg*+e^-arg)) is returned.
/// If a range error occurs due to underflow, the correct result (after rounding) is returned.
public func tanh(_ float: Float) -> Float {
tanhf(float)
#if FRB_MATH_DARWIN
return Darwin.tanhf(float)
#endif

#if FRB_MATH_GLIBC
return Glibc.tanhf(float)
#endif
}

/// Computes the hyperbolic tangent of arg.
Expand Down

0 comments on commit 126cdc2

Please sign in to comment.