code: function encodeHalf(f32){
    EHBuffer[0] = f32;
    var fltInt32 = EHIBuffer[0];
  
    var fltInt16 = (fltInt32 >> 31) << 5;
    var tmp = (fltInt32 >> 23) & 0xff;
    tmp = (tmp - 0x70) & (( (0x70 - tmp) >> 4) >> 27);
    fltInt16 = (fltInt16 | tmp) << 10;
    fltInt16 |= (fltInt32 >> 13) & 0x3ff;
    return fltInt16;
  }
docs: http://stackoverflow.com/questions/3026441/float32-to-float16