got the floating point arithmetic working with some very bloated code