10b57cec5SDimitry Andric //===-- MathExtras.cpp - Implement the MathExtras header --------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file implements the MathExtras.h header 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #include "llvm/Support/MathExtras.h" 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric #ifdef _MSC_VER 160b57cec5SDimitry Andric #include <limits> 170b57cec5SDimitry Andric #else 18*81ad6265SDimitry Andric #include <cmath> 190b57cec5SDimitry Andric #endif 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric namespace llvm { 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric #if defined(_MSC_VER) 240b57cec5SDimitry Andric // Visual Studio defines the HUGE_VAL class of macros using purposeful 250b57cec5SDimitry Andric // constant arithmetic overflow, which it then warns on when encountered. 260b57cec5SDimitry Andric const float huge_valf = std::numeric_limits<float>::infinity(); 270b57cec5SDimitry Andric #else 280b57cec5SDimitry Andric const float huge_valf = HUGE_VALF; 290b57cec5SDimitry Andric #endif 300b57cec5SDimitry Andric 31fe6060f1SDimitry Andric } // namespace llvm 32