Software floats instead of fixed point?
Posted: Sun Oct 19, 2014 6:06 pm
I'm starting to get crazy while fixing all those over/underflows in galaxy generation. All of those are fixable, but the code doesn't get more readable by that. Galaxy generation code isn't exactly simple anyway and burying the algorithms below a layer of numeric tricks to avoid over- or underflows does not really help it.
So, I started thinking (I know, I should have done that earlier ;)). The fact, that we have quite large ranges of values in galaxy generation and already need some dirty tricks for that (e.g. different mass units for planets/stars) calls for using floating points.
We are not using (hardware) floating points in generation code, because they are not portable across platforms (or even on the same platform) and thus would yield different galaxies. However, a software floating point implementation would not suffer from this disadvantage. The implementation is not much more complex than our "fixed" implementation and I don't think it would be much slower than our (software) fixed point implementation. If we save overflow checking here and there by using floating instead of fixed point it might be not slower at all or even faster. I'm not thinking about implementing IEEE 754 (different rounding modes etc.), just what we need and mostly already have in "fixed".
Before I start such a work and implement software floats based on our "fixed" implementation I would like to ask into the round
So, I started thinking (I know, I should have done that earlier ;)). The fact, that we have quite large ranges of values in galaxy generation and already need some dirty tricks for that (e.g. different mass units for planets/stars) calls for using floating points.
We are not using (hardware) floating points in generation code, because they are not portable across platforms (or even on the same platform) and thus would yield different galaxies. However, a software floating point implementation would not suffer from this disadvantage. The implementation is not much more complex than our "fixed" implementation and I don't think it would be much slower than our (software) fixed point implementation. If we save overflow checking here and there by using floating instead of fixed point it might be not slower at all or even faster. I'm not thinking about implementing IEEE 754 (different rounding modes etc.), just what we need and mostly already have in "fixed".
Before I start such a work and implement software floats based on our "fixed" implementation I would like to ask into the round
- If anyone has a better idea than replacing fixed point by software floating point?
- If anyone knows a little, portable (and license compatible) library/module that we could re-use instead of re-inventing the wheel?