Roland Mainz wrote:
> Is it possible that the builtin fuction "iszero" somehow disappeared in
> ast-ksh/2006-11-22 ?
> 
> $ ./arch/sol11.i386/bin/ksh -o gmacs
> $ (float x=0 ; print $(( iszero(x) )) )
> /home/test001/tmp/build32/arch/sol11.i386/bin/ksh: iszero(x) : unknown
> function
[snip]
> Steps to reproduce (for i386/AMD&4):
> $ wget
> http://svn.genunix.org/repos/on/branches/ksh93/gisburn/scripts/buildksh93.ksh
> $ wget --http-user="I accept www.opensource.org/licenses/cpl"
> --http-passwd="."
> 'http://www.research.att.com/~gsf/download/alpha/INIT.2006-11-22.tgz'
> $ wget --http-user="I accept www.opensource.org/licenses/cpl"
> --http-passwd="."
> 'http://www.research.att.com/~gsf/download/alpha/ast-ksh.2006-11-22.tgz'
> $ mkdir build32 ; cd build32
> $ gunzip -c ../ast-ksh.2006-11-22.tgz | tar -xf -
> $ gunzip -c ../INIT.2006-11-22.tgz | tar -xf -
> $ time nice ksh ../buildksh93.ksh build.solaris.i386.32bit.suncc 2>&1 |
> tee -a buildlog.log
> $ ./arch/sol11.i386/bin/ksh -o gmacs
> $ (float x=0 ; print $(( iszero(x) )) )
> ./arch/sol11.i386/bin/ksh iszero(x) : unknown function
> 
> This looks a little bit weired... "isnormal" is there, "issubnormal"
> isn't... and I don't see a pattern why one is there and the other
> isn't... the "buildksh.ksh" script enforces C99 mode via
> "/opt/SUNWspro/bin/cc -xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
> ..." and should make all these functions accessible to the code... ;-/

Ok... it seems to be the old issue of "libsunmath" (based on Glenn's
feedback). IMO the best option is then to emulate these functions via
|fpclassify()|, e.g.
-- snip --
int isinfinite(long double f)
{
return    fpclassify(f) == FP_INFINITE;
}
int iszero(long double f)
{
return    fpclassify(f) == FP_ZERO;
}
int issubnormal(long double f)
{
return    fpclassify(f) == FP_SUBNORMAL;
}
int isnormal(long double f)
{
return    fpclassify(f) == FP_NORMAL;
}
-- snip --

That should do the trick, is more portable (for example Linux has no
|iszero()| function) and should avoid the trouble that libsunmath.so.1
is in /opt/SUNWspro/prod/lib/ instead of /usr/lib/ (for unknown reasons)
... 

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to