1 /** 2 * Rounding modes. 3 * 4 * @author Kai Burjack 5 */ 6 module doml.rounding_mode; 7 8 /* 9 * The MIT License 10 * 11 * Copyright (c) 2020-2021 DOML 12 $@#$#@ Translated by jordan4ibanez 13 * 14 * Permission is hereby granted, free of charge, to any person obtaining a copy 15 * of this software and associated documentation files (the "Software"), to deal 16 * in the Software without restriction, including without limitation the rights 17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 * copies of the Software, and to permit persons to whom the Software is 19 * furnished to do so, subject to the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be included in 22 * all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 * THE SOFTWARE. 31 */ 32 33 /** 34 * Rounding modes. 35 * 36 * @author Kai Burjack 37 */ 38 enum RoundingMode { 39 /** 40 * Discards the fractional part. 41 */ 42 TRUNCATE = 0, 43 /** 44 * Round towards positive infinity. 45 */ 46 CEILING = 1, 47 /** 48 * Round towards negative infinity. 49 */ 50 FLOOR = 2, 51 /** 52 * Round towards the nearest neighbor. If both neighbors are equidistant, round 53 * towards the even neighbor. 54 */ 55 HALF_EVEN = 3, 56 /** 57 * Round towards the nearest neighbor. If both neighbors are equidistant, round 58 * down. 59 */ 60 HALF_DOWN = 4, 61 /** 62 * Round towards the nearest neighbor. If both neighbors are equidistant, round 63 * up. 64 */ 65 HALF_UP = 5 66 }