Hi!

----

Another bug we hit today in ast-ksh.2008-02-02 when developing an
application:
It seems that ksh93 has problems with the sign then converting something
like "Inf" (floating-point Infinite) to an integer variable.
Example:
-- snip --
$ ksh93 -c 'integer x=+Inf ; printf "%d\n" x'
-9223372036854775808
$ ksh93 -c 'integer x ; (( x=+Inf )) ; printf "%d\n" x'
-9223372036854775808
-- snip --
... AFAIK "x" should have a positive sign, e.g. the following C99 test
case...
-- snip --
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <math.h>

int main(int ac, char *av[])
{
    long double fp;
    long long   i;
    
    fp=INFINITY;
    i=fp;
    
    printf("fp=%Lf\n", fp);
    printf("i=%lld\n", i);
    return EXIT_SUCCESS;
}
-- snip --
...returns:
-- snip --
$ cc -xc99=%all c99_float_infinity_to_int.c
$ ./a.out                                  
fp=inf
i=9223372036854775807
-- snip --

----

bye,
ROland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to