mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Back port ksh93v- float, int, and exp10 changes from math.tab (#299)
src/cmd/ksh93/data/math.tab: - Added exp10(). - Remove int() as being an alias to floor(). - Created entries for local float() and local int() which are defined in features/math.sh. src/cmd/ksh93/features/math.sh: - Backport floor() and int() related code from ksh93v-. src/cmd/ksh93/sh.1: - Sync man page to math.tab's potential functions.
This commit is contained in:
parent
6b3805724d
commit
92f7ca5423
7 changed files with 84 additions and 9 deletions
|
|
@ -849,5 +849,30 @@ got=$(
|
|||
)
|
||||
[[ $got == *recursion* ]] && err_exit "recursion level not reset on readonly error (subshell)"
|
||||
|
||||
# ======
|
||||
# Some math function tests and only error if function exits
|
||||
unset got
|
||||
got=0
|
||||
if ( (( exp10(3) )) ) 2> /dev/null
|
||||
then
|
||||
(( (got=exp10(3)) == 1000 )) || err_exit "exp10(3) != 1000, got '$got'"
|
||||
fi
|
||||
got=0
|
||||
if ( (( int(6.89) )) ) 2> /dev/null
|
||||
then
|
||||
(( (got=int(6.89)) == 6 )) || err_exit "int(6.89) != 6, got '$got'"
|
||||
fi
|
||||
got=0
|
||||
if ( (( int(-6.89) )) ) 2> /dev/null
|
||||
then
|
||||
(( (got=int(-6.89)) == -6 )) || err_exit "int(-6.89) != -6, got '$got'"
|
||||
fi
|
||||
float got=-1
|
||||
if ( (( float(2./3) )) ) 2> /dev/null
|
||||
then
|
||||
(( (got=float(2./3)) == 2./3 )) || err_exit "float(2./3) != 2./3, got '$got'"
|
||||
fi
|
||||
unset got
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue