Page 1 of 1

Floating-point/fixed-point arithmetic

Posted: Tue Oct 15, 2013 6:39 pm
by Zontar
In coding my port of Ken Perlin's noise generator, I discovered there are no library functions for floating-point or fixed-point arithmetic (or my setup is configured incorrectly.) For example, the following reveals no __divdf3 implementation upon compilation:

Code: Select all

double divide(double x, double y) {
	return x / y;
}
With this in mind, what options do I have for decimal point arithmetic? I understand floating-point emulation is slow, however, this will be used for a map generator that runs once (with a waiting screen) so speed is not too much an issue. Is there a library I can use for real number arithmetic, either fixed-point or floating-point arithmetic?

Posted: Tue Oct 15, 2013 8:52 pm
by Stef
Indeed there is no support for float and double operation in SGDK as the 68000 is really not suited for floating point types.
You can still use the fix32 type (fixed point decimal) with SGDK if your decimal numbers are not too small nor too big.