From c70d98dbdd282c3aaa38eb1d1a1d3fab490b5eec Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 14 Oct 2013 13:40:10 +0100 Subject: [PATCH] Added some trigonometry functions that are missing from MSVC's C library. --- modules/juce_core/maths/juce_MathsFunctions.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index 4c39ac8f08..3469c6c949 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -295,6 +295,12 @@ inline int64 abs64 (const int64 n) noexcept return (n >= 0) ? n : -n; } +#if JUCE_MSVC && ! defined (DOXYGEN) // The MSVC libraries omit these functions for some reason... + template Type asinh (Type x) noexcept { return std::log (x + std::sqrt (x * x + (Type) 1)); } + template Type acosh (Type x) noexcept { return std::log (x + std::sqrt (x * x - (Type) 1)); } + template Type atanh (Type x) noexcept { return (std::log (x + (Type) 1) - std::log (((Type) 1) - x)) / (Type) 2; } +#endif + //============================================================================== /** A predefined value for Pi, at double-precision. @see float_Pi