Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Aina Niemetz, Martin Brain, Andres Noetzli 4 : : * 5 : : * This file is part of the cvc5 project. 6 : : * 7 : : * Copyright (c) 2009-2025 by the authors listed in the file AUTHORS 8 : : * in the top-level source directory and their institutional affiliations. 9 : : * All rights reserved. See the file COPYING in the top-level source 10 : : * directory for licensing information. 11 : : * **************************************************************************** 12 : : * 13 : : * The definition of rounding mode values. 14 : : */ 15 : : #include "cvc5_public.h" 16 : : 17 : : #ifndef CVC5__ROUNDINGMODE_H 18 : : #define CVC5__ROUNDINGMODE_H 19 : : 20 : : #include <fenv.h> 21 : : 22 : : #include <iosfwd> 23 : : 24 : : namespace cvc5::internal { 25 : : 26 : : #define CVC5_NUM_ROUNDING_MODES 5 27 : : 28 : : /** 29 : : * A concrete instance of the rounding mode sort 30 : : */ 31 : : enum class RoundingMode 32 : : { 33 : : ROUND_NEAREST_TIES_TO_EVEN = FE_TONEAREST, 34 : : ROUND_TOWARD_POSITIVE = FE_UPWARD, 35 : : ROUND_TOWARD_NEGATIVE = FE_DOWNWARD, 36 : : ROUND_TOWARD_ZERO = FE_TOWARDZERO, 37 : : // Initializes this to the diagonalization of the 4 other values. 38 : : ROUND_NEAREST_TIES_TO_AWAY = 39 : : (((~FE_TONEAREST) & 0x1) | ((~FE_UPWARD) & 0x2) | ((~FE_DOWNWARD) & 0x4) 40 : : | ((~FE_TOWARDZERO) & 0x8)) 41 : : }; /* enum RoundingMode */ 42 : : 43 : : /** 44 : : * Hash function for rounding mode values. 45 : : */ 46 : : struct RoundingModeHashFunction 47 : : { 48 : 386731 : inline size_t operator()(const RoundingMode& rm) const { return size_t(rm); } 49 : : }; /* struct RoundingModeHashFunction */ 50 : : 51 : : std::ostream& operator<<(std::ostream& os, RoundingMode s); 52 : : 53 : : } // namespace cvc5::internal 54 : : 55 : : #endif