Floating Point Questions


I want to port some code to Saturn that makes use of floating point instructions. I've never used floating point before and I understand the Saturn does not have an FPU. In an ideal scenario I would like to be able to link to libm and have everything work even if it's slow. Is that possible?

1) Jo Engine has a math.h file but only in Compiler/WINDOWS/ directory. (I'm on Linux)
2) #include <math.h> does not work
3) Would it make sense to grab the functions I need from a C implementation of libm? At first glance I need sinf(), fmodf(), and lroundf().
4) Would it make more sense to reimplement these functions using Jo Engine's math library? Jo Engine has a number of jo_fixed2float() and jo_float2fixed() routines.

Thanks in advance.
Last edited:


Extra Hard Mid Boss
GCC has an extension that may help:
#include_next <math.h>
IMO it is a bug to shadow standard library headers. If you can afford the overhead of softfp then there's little reason not to use it, but if it's too slow or takes too much space, then you don't have a choice but to reimplement the code using fixed point math. The decreased precision means it's not always an easy job.


Thanks for the reply. I attempted to reimplement the functions I needed using FIXED where possible. All of the functions appear to have the same output with the exception of sinf() which looks like it doesn't quite match but hopefully is close enough for my purposes.