Code: Select all
#pragma printf %f
#include <stdio.h>
#include <math.h>
#ifdef __MATH_MATH16
#define DOUBLE half_t
#else
#define DOUBLE float
#endif
int main(void)
{
DOUBLE t1 = (DOUBLE)10000.0;
DOUBLE t2 = (DOUBLE)100000.0;
printf("t1 = %f, t2 = %f\n",(float)t1,(float)t2);
return 0;
}
Code: Select all
zcc +zx -vn -SO3 --max-allocs-per-node200000 -clib=sdcc_iy -startup=1 --math16 --math32 math16_simple.c -o m16s -create-app
Code: Select all
t1 = 9999.999000 t2 = -31071.990000
If I remove the --math16 it works correctly, so the 32 bit float library seems OK.
P.S. My z88dk is a few months old. Do I need to update?