Discussion:
[ast-developers] ksh suffices f, F, l, and L for floating point constants not working
Tina Harriott
2013-10-22 22:53:59 UTC
Permalink
ast-ksh 2013-10-10 introduced suffices for floating point constants:
13-10-08 The shell arithmetic now recognized suffices f,F, l, and L for
floating point constants.

However, they do not work:
./arch/linux.i386-64/bin/ksh -c 'print $((1.1f))'
./arch/linux.i386-64/bin/ksh: 1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1F))'
./arch/linux.i386-64/bin/ksh: x=1.1F: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; ((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error

If possible, can ksh please get the same kind of suffices for integer
constants, to have parity?

Tina
--
Tina Harriott - Women in Mathematics
Contact: tina.harriott.math at gmail.com
Tina Harriott
2013-10-23 01:05:26 UTC
Permalink
Post by Tina Harriott
13-10-08 The shell arithmetic now recognized suffices f,F, l, and L for
floating point constants.
./arch/linux.i386-64/bin/ksh -c 'print $((1.1f))'
./arch/linux.i386-64/bin/ksh: 1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1F))'
./arch/linux.i386-64/bin/ksh: x=1.1F: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; ((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error
If possible, can ksh please get the same kind of suffices for integer
constants, to have parity?
Math suffices do not work in printf either:

ksh -c 'builtin printf ; printf "%f\n" 1.1f;:'
/home/thm/bin/ksh: printf: 1.1f: arithmetic syntax error
/home/thm/bin/ksh: printf: 1.1f: arithmetic syntax error
/home/thm/bin/ksh: printf: warning: invalid argument of type f
1.100000

Tina
--
Tina Harriott - Women in Mathematics
Contact: tina.harriott.math at gmail.com
Tina Harriott
2013-11-18 22:44:28 UTC
Permalink
Post by Tina Harriott
Post by Tina Harriott
13-10-08 The shell arithmetic now recognized suffices f,F, l, and L for
floating point constants.
./arch/linux.i386-64/bin/ksh -c 'print $((1.1f))'
./arch/linux.i386-64/bin/ksh: 1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1f))'
./arch/linux.i386-64/bin/ksh: x=1.1f: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1F))'
./arch/linux.i386-64/bin/ksh: x=1.1F: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; print $((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error
./arch/linux.i386-64/bin/ksh -c 'float x ; ((x=1.1l))'
./arch/linux.i386-64/bin/ksh: x=1.1l: arithmetic syntax error
If possible, can ksh please get the same kind of suffices for integer
constants, to have parity?
ksh -c 'builtin printf ; printf "%f\n" 1.1f;:'
/home/thm/bin/ksh: printf: 1.1f: arithmetic syntax error
/home/thm/bin/ksh: printf: 1.1f: arithmetic syntax error
/home/thm/bin/ksh: printf: warning: invalid argument of type f
1.100000
Tina
Is this going to be fixed in the next alpha?

Tina
--
Tina Harriott - Women in Mathematics
Contact: tina.harriott.math at gmail.com
Loading...