191d3cfedSDuncan P. N. Exon Smith //===-- MathExtras.cpp - Implement the MathExtras header --------------===//
27b4133acSYaron Keren //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67b4133acSYaron Keren //
77b4133acSYaron Keren //===----------------------------------------------------------------------===//
87b4133acSYaron Keren //
97b4133acSYaron Keren // This file implements the MathExtras.h header
107b4133acSYaron Keren //
117b4133acSYaron Keren //===----------------------------------------------------------------------===//
127b4133acSYaron Keren 
137b4133acSYaron Keren #include "llvm/Support/MathExtras.h"
147b4133acSYaron Keren 
157b4133acSYaron Keren #ifdef _MSC_VER
167b4133acSYaron Keren #include <limits>
177b4133acSYaron Keren #else
18*fbbc41f8Sserge-sans-paille #include <cmath>
197b4133acSYaron Keren #endif
207b4133acSYaron Keren 
217b4133acSYaron Keren namespace llvm {
227b4133acSYaron Keren 
237b4133acSYaron Keren #if defined(_MSC_VER)
247b4133acSYaron Keren   // Visual Studio defines the HUGE_VAL class of macros using purposeful
257b4133acSYaron Keren   // constant arithmetic overflow, which it then warns on when encountered.
267b4133acSYaron Keren   const float huge_valf = std::numeric_limits<float>::infinity();
277b4133acSYaron Keren #else
287b4133acSYaron Keren   const float huge_valf = HUGE_VALF;
297b4133acSYaron Keren #endif
307b4133acSYaron Keren 
310164d546SSimon Pilgrim } // namespace llvm
32