The open source OpenXR runtime
at main 37 lines 739 B view raw
1// Copyright 2020, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3/*! 4 * @file 5 * @brief Wrapper header for <math.h> to ensure pi-related math constants are 6 * defined. 7 * 8 * Use this instead of directly including <math.H> in headers and when 9 * you need M_PI and its friends. 10 * @author Rylie Pavlik <rylie.pavlik@collabora.com> 11 * 12 * @ingroup aux_math 13 */ 14 15#pragma once 16 17#define _USE_MATH_DEFINES // for M_PI // NOLINT 18#ifdef __cplusplus 19#include <cmath> 20#endif 21 22#include <math.h> 23 24 25// Might be missing on Windows. 26#ifndef M_PI 27#define M_PI (3.14159265358979323846) 28#endif 29 30// Might be missing on Windows. 31#ifndef M_PIl 32#define M_PIl (3.14159265358979323846264338327950288) 33#endif 34 35#ifndef M_1_PI 36#define M_1_PI (1. / M_PI) 37#endif