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