discovered another mysql trick
if you are experiencing underflow with mysql fixed point arithmetic, you may need to force a floating point evaluation. cast() does not support cast to floating point so multiply by 1e0 instead
e.g.
select 1000000000000000000000000000000 * ( 1 / ( 1000000000000000000000000000000 ));
returns the wrong answer, whereas :
select 1000000000000000000000000000000 * ( 1 / ( 1e0 * 1000000000000000000000000000000 ));
is fine and dandy
