MathExtras.cpp 930 B

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