1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Jim Winstead <jimw@php.net> | 14 | Stig Sæther Bakken <ssb@php.net> | 15 +----------------------------------------------------------------------+ 16 */ 17 18 #include "php.h" 19 20 /* Define rounding modes (all are round-to-nearest) */ 21 #ifndef PHP_ROUND_HALF_UP 22 #define PHP_ROUND_HALF_UP 0x01 /* Arithmetic rounding, up == away from zero */ 23 #endif 24 25 #ifndef PHP_ROUND_HALF_DOWN 26 #define PHP_ROUND_HALF_DOWN 0x02 /* Arithmetic rounding, down == towards zero */ 27 #endif 28 29 #ifndef PHP_ROUND_HALF_EVEN 30 #define PHP_ROUND_HALF_EVEN 0x03 /* Banker's rounding */ 31 #endif 32 33 #ifndef PHP_ROUND_HALF_ODD 34 #define PHP_ROUND_HALF_ODD 0x04 35 #endif 36 37 #ifndef PHP_ROUND_CEILING 38 #define PHP_ROUND_CEILING 0x05 39 #endif 40 41 #ifndef PHP_ROUND_FLOOR 42 #define PHP_ROUND_FLOOR 0x06 43 #endif 44 45 #ifndef PHP_ROUND_TOWARD_ZERO 46 #define PHP_ROUND_TOWARD_ZERO 0x07 47 #endif 48 49 #ifndef PHP_ROUND_AWAY_FROM_ZERO 50 #define PHP_ROUND_AWAY_FROM_ZERO 0x08 51 #endif 52 53 extern PHPAPI zend_class_entry *rounding_mode_ce; 54 55 PHPAPI int php_math_round_mode_from_enum(zend_object *mode); 56