Library Bugs
strtoll(3)/strtoull(3) is missing in libc
Use strtoq/strtouq instead. Their prototypes are:
#ifdef __cplusplus
extern "C" {
#endif
#include
extern quad_t __cdecl strtoq(const char *, char **, int);
extern u_quad_t __cdecl strtouq(const char *, char **, int);
#ifdef __cplusplus
}
#endif
You may compile with:
gcc -Dstrtoll=strtoq -Dstrtoull=strtouq ...
see also:
http://www.interopsystems.com/tools/tm.aspx?m=3697
libm's expf(3) is broken
expf(3) is broken, see the following
sample program:
#include
#include
int main(void)
{
float a, b;
a = 1;
b = expf(a);
printf("expf(%f)\n", a);
printf("expected: 2.718282\n");
printf(" got: %f\n", b);
return 0;
}
When run on Interix, ouput is as follows:
expf(1.000000)
expected: 2.718282
got: 1.000000
see also:
http://www.interopsystems.com/tools/tm.aspx?m=6107
Workaroud
On Debian/Interix, use libm-newlib.so from package libm-newlib-dev.
libm's frexp(3) is broken
frexp(3) is broken, see the following
sample program:
#include
#include
int main(void)
{
int exp;
double frac;
double dval = 1179431913.979666L;
printf("frexp(%lf)\n", dval);
printf("expected: 0.549216, 31\n");
frac = frexp(dval, &exp);
printf(" got: %lf, %d\n\n", frac, exp);
dval = -1;
printf("frexp(%lf)\n", dval);
printf("expected: -0.5, 1\n");
frac = frexp(dval, &exp);
printf(" got: %lf, %d\n\n", frac, exp);
return 0;
}
When run on Interix, ouput is as follows:
frexp(1179431913.979666)
expected: 0.549216, 31
got: 1.098432, 30
frexp(-1.000000)
expected: -0.5, 1
got: -1.000000, 0
see also:
http://www.interopsystems.com/tools/tm.aspx?m=11820
Workaroud
On Debian/Interix, use libm-newlib.so from package libm-newlib-dev.
libc's poll(3) doesn't work for all files (documented)
man 3 poll says:
On Interix, poll() is supported only for use with ctl files
(located in /proc/procID). No other file types are allowed.
libc's atof(3) doesn't support NaNs, atof("NaN") returns 0 instead of a NaN
libc's sscanf(3) doesn't support 64-bit ints
see:
http://www.interopsystems.com/tools/tm.aspx?m=3653
Reportedly, on SUA 6.0 both sscanf "%qd" and "%lld" are supported.
atoll(3) is missing in libc
Use strtoq instead. Its prototype is:
#ifdef __cplusplus
extern "C" {
#endif
#include
extern quad_t __cdecl strtoq(const char *, char **, int);
#ifdef __cplusplus
}
#endif
You may define this macro:
#define atoll(p) strtoq(p,NULL,10)
Bug database
Debian Interix home
Last update of this document: Saturday, 04-Oct-2008 13:08:57 CEST
Copyright 2007-2008 Martin Köppe <mkoeppe 'at' gmx . de>