[SunHELP] decimals and ksh division

Sandwich Maker adh at an.bradford.ma.us
Wed Oct 22 14:38:04 CDT 2003


"From: "Markham, Richard" <RLMarkham at hafeleamericas.com>
"
"How can I show decimals in ksh?
"
"example: 
"$ print $((45/10))
"4
"
"I want to show 
"4.5

you can't, on the built-in ksh.

you -could-, if sun would turn the FLOAT compile-time option on, the
next time they release a ksh patch.  it -was- flaky until ksh88i, but
worked then.

imho, they should also set BRACEPAT and 3DFS [aka viewpath].

ksh93, available from research.att.com, does floating point.  come to
think of it, dtksh is based on ksh93...  quick experiment:
print $((45/10))
gives 4, but
print $((45.0/10))
gives 4.5  shazam!
________________________________________________________________________
Andrew Hay                                  the genius nature
internet rambler                            is to see what all have seen
adh at an.bradford.ma.us                       and think what none thought



More information about the SunHELP mailing list