Some examples from other OS implementations, which show (even within a
vendor) differing results. Is AIX right or is SLES 10 right? I'm not
sure.
SuSE (or probably the level of Korn Shell) changed (I think) between
SLES 9 and SLES 10. AIX and Solaris seem to be acting "as a human
expects."
--------------------
# ksh poo.ksh
3
# cat poo.ksh
date=0600
((mm=${date}/100))
echo ${mm}
exit 0
# uname -a
Linux usilap13 2.6.16.60-0.39.3-smp #1 SMP Mon May 11 11:46:34 UTC 2009
x86_64 x86_64 x86_64 GNU/Linux
---------------------
> ksh poo.ksh
3
> cat poo.ksh
date=0600
((mm=${date}/100))
echo ${mm}
exit 0
> uname -a
Linux usilscuwi01 2.6.16.60-0.39.3-default #1 Mon May 11 11:46:34 UTC
2009 i686 i686 i386 GNU/Linux
------------------------------
> ksh poo.ksh
6
> cat poo.ksh
date=0600
((mm=${date}/100))
echo ${mm}
exit 0
> uname -a
Linux usild40a 2.4.21-278-default #1 SMP Mon Mar 7 18:07:14 UTC 2005
s390 unknown
-------------------------------
$ ksh poo.ksh
6
$ cat poo.ksh
date=0600
((mm=${date}/100))
echo ${mm}
exit 0
$ uname -a
AIX usil0c20 3 5 00CC15EE4C00
-----------------------------------
$ ksh poo.ksh
6
$ cat poo.ksh
date=0600
((mm=${date}/100))
echo ${mm}
exit 0
$ uname -a
SunOS new-usilsg00 5.9 Generic_122300-08 sun4u sparc SUNW,Ultra-60
-----Original Message-----
From: Linux on 390 Port [mailto:[email protected]] On Behalf Of
Mark Post
Sent: Friday, October 09, 2009 10:01 AM
To: [email protected]
Subject: Re: Math Error
>>> On 10/9/2009 at 9:38 AM, Neale Ferguson <[email protected]>
wrote:
> 0605 as an octal number is 389. So 389/100 = 3 when truncated.
And just to be explicit about _why_ it's being interpreted as an octal
number, it's because of the leading zero.
Mark Post
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390