cc: [email protected]
Subject: Re: [ast-users] ksh $((2**63 / -1)) hangs on x86_64
--------
Thanks for reporting this. The next ksh93 alpha should have these resolved.
> Following on some recent internet discussion on INT_MIN/-1 [0][1], I tried
> some
> examples using ksh. On x86_64, where unrepresentable integer division results
> raise a fault,
>
> $ echo $((2**63 / -1))
Fixed in the next update.
>
> hangs the shell with 100% cpu, apparently forever retrying the idiv.
>
> I also noticed some other odd behaviour around the int/float boundary:
>
> $ echo ${.sh.version}
> Version AJM 93u+ 2012-08-01
> $
> $ echo $((2 ** 63))
> 9.22337203685477581e+18
> $ echo $((2 ** 63 * 1))
> 9.22337203685477581e+18
> $ echo $((2 ** 63 / 1)) # surprise
> -9223372036854775808
Fixed in the next update
> $
> $ ((n = 2**63))
> $ echo $n
> 9.22337203685477581e+18
> $ echo $(((n + 0) / -1))
> -9.22337203685477581e+18
> $ echo $(((0 + n) / -1)) # surprise
> 0
> $
>
>
> Kevin Schoedel <[email protected]> VA3TCS
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users