replace floating point math in kernel code