Re: [ast-users] A real number arithmetic issue

2014-07-03 Thread Janis Papanagnou
I have to followup on my own post from last week.

The proposed new version of ksh that I installed has a horrible
side effect when using the interactive history functions in vi
mode; misplacing the cursor, displaying control code, and
thus making it impossible to use. (I'm working on 64 bit Linux.)
Has someone observed a similar behaviour?

I switched back to the 2010 version and the history fine again;
modulo that real number bug - but I can do arithmetic using
other tools, still better than a spoiled history function.


From: janis_papanag...@hotmail.com
To: ast-users@lists.research.att.com
Date: Fri, 27 Jun 2014 10:58:28 +0200
Subject: Re: [ast-users] A real number arithmetic issue




Yes, indeed, four years is obviously too old. :-)

I downloaded the binary from http://www2.research.att.com/sw/download/
and can confirm your results from the test case.

Just wondered that the latest precompiled binary for a standalone ksh is
also quite old (2012-08-06  BASE  linux.i386-64); is above download link
still valid? - I noticed you are using a 2014 version.

Thanks!

Date: Thu, 26 Jun 2014 14:48:27 -0400
Subject: Re: [ast-users] A real number arithmetic issue
From: dgk...@gmail.com
To: janis_papanag...@hotmail.com; ast-users@lists.research.att.com

I suspect that this is because you are running a very old ksh93.  Here is what 
I get on ubuntu linux x86_63.13.0-30-generic4  release .
[...]

On Wed, Jun 25, 2014 at 3:59 PM, Janis Papanagnou 
janis_papanag...@hotmail.com wrote:




I've just noticed something strange with real number arithmetic in ksh.
The problem:
It seems that the fractional part in a division is interpreted as integer.


[...]


All done in the LC_ALL=C locale. On a Linux 2.6 platform.


Am I doing something wrong or is this some shell issue? 


Thanks!

  

___

ast-users mailing list

ast-users@lists.research.att.com

http://lists.research.att.com/mailman/listinfo/ast-users



  

___
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users
  ___
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users


Re: [ast-users] A real number arithmetic issue

2014-06-26 Thread David Korn
I suspect that this is because you are running a very old ksh93.  Here is
what I get on ubuntu linux x86_63.13.0-30-generic4  release .

$ print $(( log(2.171828) ))
0.775569209249095711
$ print $(( log(200.0) / log(2.171828) ))
18.7071090052317417
$ print $(( log(200.0) / log(2) ))
20.9315685693241741
$ print $(( log(200.0) / log(3) ))
13.2063493993077651
$ typeset -F a=200
$ typeset -F b=2.71828
$ print $(( log(a) / log(b) ))
14.5086674978188462
$ print $a $b
200.0 2.71828
$ typeset -F b=3.0
$ print $(( log(a) / log(b) ))
13.2063493993077651
$ printf %f\n $(( log(a) / log(b) ))
13.206349
$ typeset -F b=3.1
$ printf %f\n $(( log(a) / log(b) ))
12.823609
$ ksh --version
  version sh (ATT Research) 93v- 2014-06-06



On Wed, Jun 25, 2014 at 3:59 PM, Janis Papanagnou 
janis_papanag...@hotmail.com wrote:

 I've just noticed something strange with real number arithmetic in ksh.
 The problem:
 It seems that the fractional part in a division is interpreted as integer.

 $ print $(( log(2.171828) ))
 0.775569209249095711

 $ print $(( log(200.0) / log(2.171828) ))
 ksh:  log(200.0) / log(2.171828) : divide by zero

 $ print $(( log(200.0) / log(2) ))
 ksh:  log(200.0) / log(2) : divide by zero

 $ print $(( log(200.0) / log(3) ))
 14

 $ typeset -F a=200
 $ typeset -F b=2.71828
 $ print $(( log(a) / log(b) ))
 ksh:  log(a) / log(b) : divide by zero

 $ print $a $b
 200.00 2.718280


 $ typeset -F b=3.0
 $ print $(( log(a) / log(b) ))
 14

 $ printf %f\n $(( log(a) / log(b) ))
 14.00

 $ typeset -F b=3.1
 $ printf %f\n $(( log(a) / log(b) ))
 14.00


 $ ksh --version
   version sh (ATT Research) 93t+ 2010-03-05

 All done in the LC_ALL=C locale. On a Linux 2.6 platform.


 Am I doing something wrong or is this some shell issue?

 Thanks!


 ___
 ast-users mailing list
 ast-users@lists.research.att.com
 http://lists.research.att.com/mailman/listinfo/ast-users


___
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users