1*0b57cec5SDimitry Andric //===-- MathExtras.cpp - Implement the MathExtras header --------------===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric // 9*0b57cec5SDimitry Andric // This file implements the MathExtras.h header 10*0b57cec5SDimitry Andric // 11*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 12*0b57cec5SDimitry Andric 13*0b57cec5SDimitry Andric #include "llvm/Support/MathExtras.h" 14*0b57cec5SDimitry Andric 15*0b57cec5SDimitry Andric #ifdef _MSC_VER 16*0b57cec5SDimitry Andric #include <limits> 17*0b57cec5SDimitry Andric #else 18*0b57cec5SDimitry Andric #include <math.h> 19*0b57cec5SDimitry Andric #endif 20*0b57cec5SDimitry Andric 21*0b57cec5SDimitry Andric namespace llvm { 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric #if defined(_MSC_VER) 24*0b57cec5SDimitry Andric // Visual Studio defines the HUGE_VAL class of macros using purposeful 25*0b57cec5SDimitry Andric // constant arithmetic overflow, which it then warns on when encountered. 26*0b57cec5SDimitry Andric const float huge_valf = std::numeric_limits<float>::infinity(); 27*0b57cec5SDimitry Andric #else 28*0b57cec5SDimitry Andric const float huge_valf = HUGE_VALF; 29*0b57cec5SDimitry Andric #endif 30*0b57cec5SDimitry Andric 31*0b57cec5SDimitry Andric } 32