zcc +rc2014 -subtype=cpm -clib=new --math16 -lm
zcc +rc2014 -subtype=cpm -clib=new --math16 --math32
zcc +hbios -clib=new --math16 -lm
zcc +hbios -clib=new --math16 --math32half_t f16_f48(double_t x);
double_t f48_f16(half_t x);
half_t f16_f32(float_t x);
float_t f32_f16(half_t x);
int16_t i16_f16(half_t x);
uint16_t u16_f16(half_t x);
int32_t i32_f16(half_t x);
uint32_t u32_f16(half_t x);
half_t f16_i8(int8_t x);
half_t f16_i16(int16_t x);
half_t f16_i32(int32_t x);
half_t f16_u8(uint8_t x);
half_t f16_u16(uint16_t x);
half_t f16_u32(uint32_t x);
half_t addf16(half_t x,half_t y);
half_t subf16(half_t x,half_t y);
half_t mulf16(half_t x,half_t y);
half_t divf16(half_t x,half_t y);
half_t fmaf16(half_t x,half_t y,half_t z);
half_t hypotf16(half_t x,half_t y);
half_t invf16(half_t x);
half_t invsqrtf16(half_t x);
half_t sqrtf16(half_t x);
half_t div2f16(half_t x);
half_t mul2f16(half_t x);
half_t mul10f16(half_t x);
half_t frexpf16(half_t x,int8_t *exp);
half_t ldexpf16(half_t x,int16_t exp);
half_t fabsf16(half_t x);
half_t negf16(half_t x);
half_t ceilf16(half_t x);
half_t floorf16(half_t x);Over the past two weeks, we've worked out some issues, and added the basis of trigonometric, logarithmic, and exponential functions.
So to update, I've worked on the n-body benchmark. And the results are pretty good. I'm quite happy with the outcome so far. We're about 6x faster than the standard maths library.
It is pretty easy to use the math16 library. On the command line --math16 needs to be specified, along with one of the other maths libraries -lm if you want to do printing.
zcc +rc2014 -clib=new -O3 --opt-code-speed=inlineints --math16 -lm myprogram.c -o myprogram -create-app
What are the applications for 16-bit floating point? Perhaps if you were trying to build a real-time Startrek game? Or some other game with graphics.
I don't think we ever used FP in a graphical game. 3D stuff generally used an angle system with 256 'degrees' to a circle and page aligned look up tables for fixed point maths.