From 210949f2dded452276cd41266c3e244e8ae4038e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 16 Oct 2016 01:09:46 +0200 Subject: [PATCH] Math: long double is the same as double also on Android. --- src/Magnum/Math/Test/TypeTraitsTest.cpp | 10 +++++----- src/Magnum/Math/TypeTraits.h | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Magnum/Math/Test/TypeTraitsTest.cpp b/src/Magnum/Math/Test/TypeTraitsTest.cpp index cf7aa6ebe..f12c40a3e 100644 --- a/src/Magnum/Math/Test/TypeTraitsTest.cpp +++ b/src/Magnum/Math/Test/TypeTraitsTest.cpp @@ -70,21 +70,21 @@ struct { long double getStep(long double) const { return cStep; } } EqualsZeroData[EqualsZeroDataCount] = { {"", -3.141592653589793f, 5.0e-5f, -3.141592653589793, 5.0e-14, -3.141592653589793l, - #ifndef _MSC_VER + #if !defined(_MSC_VER) && !defined(CORRADE_TARGET_ANDROID) 5.0e-17l #else 5.0e-14 #endif }, {"small", 1.0e-6f, 5.0e-6f, -1.0e-15, 5.0e-15, 1.0e-18l, - #ifndef _MSC_VER + #if !defined(_MSC_VER) && !defined(CORRADE_TARGET_ANDROID) 5.0e-18l #else 5.0e-15 #endif }, {"large", 12345.0f, 0.2f, 12345678901234.0, 0.2, - #ifndef _MSC_VER + #if !defined(_MSC_VER) && !defined(CORRADE_TARGET_ANDROID) -12345678901234567.0l, #else -12345678901234.0l, @@ -154,9 +154,9 @@ void TypeTraitsTest::sizeOfLongDouble() { #ifdef CORRADE_TARGET_EMSCRIPTEN CORRADE_SKIP("Not defined in Emscripten."); #else - #ifdef _MSC_VER + #if defined(_MSC_VER) || defined(CORRADE_TARGET_ANDROID) CORRADE_COMPARE(sizeof(long double), 8); - CORRADE_EXPECT_FAIL("long double is equivalent to double on MSVC."); + CORRADE_EXPECT_FAIL("long double is equivalent to double on MSVC and Android."); #endif /* It's 80 bit, but has to be aligned somehow, so 128 bits / 16 bytes */ diff --git a/src/Magnum/Math/TypeTraits.h b/src/Magnum/Math/TypeTraits.h index ae42fdfe0..13d47bbde 100644 --- a/src/Magnum/Math/TypeTraits.h +++ b/src/Magnum/Math/TypeTraits.h @@ -59,12 +59,13 @@ for more headroom. They have "at least" 18 significant digits of precision, taking one digit less for more headroom. -@attention On MSVC the precision is the same as for doubles, because - they are internally the same type. Source: - https://msdn.microsoft.com/en-us/library/9cx8xs15.aspx +@attention On MSVC the precision is the same as for doubles, because they are + internally the same type (source: https://msdn.microsoft.com/en-us/library/9cx8xs15.aspx). + The same is apparently for @ref CORRADE_TARGET_ANDROID "Android", but I + couldn't find any source for that. */ #ifndef LONG_DOUBLE_EQUALITY_PRECISION -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(CORRADE_TARGET_ANDROID) #define LONG_DOUBLE_EQUALITY_PRECISION 1.0e-17l #else #define LONG_DOUBLE_EQUALITY_PRECISION 1.0e-14l