floating point encoding fixes, prevent overflows, integer shift etc