AnsweredAssumed Answered

Floating-Point to Int32 conversion problems

Question asked by DanaGood on Aug 11, 2009
Latest reply on Jul 17, 2017 by Rajkumar.K

In order to more closely match a Matlab implementation, much of our low-frequency work is done in floats.  However, the conversion of floating point numbers to fract32s is emerging as a problem.

 

The default rounding done when converting from float (single) to fract32 appears to be of the type "_float32_to_int32_round_to_zero".  As I understand it from documentation elsewhere, this means that the conversion is performed according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic, except that the conversion is always rounded toward zero.

 

Is there a way to change this default?  In particular, the Matlab implementation I need to match always rounds *away* from zero.

 

Thanks,

 

Dana Good

Outcomes