1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 # a lot of this is technically undefined behavior due to signed 64-bit
15 # integer overflow, but we're testing exception handling here
17 intmax_max=$((2**63 - 1))
18 intmax_min1=$((2**63))
19 intmax_min2=$((-2**63))
22 9223372036854775807) ;;
23 *) echo "warning: your machine does not support 64-bit arithmetic using intmax_t" 2>&1 ;;
26 # these are actually the same
27 echo $(( $intmax_min1 % -1 ))
28 echo $(( $intmax_min2 % -1 ))
30 echo $(( $intmax_max % -1 ))
45 echo $(( $intmax_min1 / -1 ))
46 echo $(( $intmax_min2 / -1 ))
56 echo $(( $intmax_min1 * -1 ))
57 echo $(( $intmax_min2 * -1 ))
67 echo $(( -${intmax_min1} ))
68 echo $(( -${intmax_min2} ))
70 foo1=$(( $intmax_max - 2 ))
72 eval echo \{${foo1}..${intmax_max}\}