AnsweredAssumed Answered

Problems with saturation arithmetic on SHARC

Question asked by snoopy on Sep 13, 2011
Latest reply on Sep 16, 2011 by Mitesh

Hello

 

I am assigning a float to a fract and want it to truncate the value (or clip) if it overflows but it seems to want to wrap it back to zero when the float exceeds the max fract values in both directions.

 

I've tried adding the #pragma FX_ROUNDING_MODE TRUNCATION but the compiler issues a warning that such a pragma does not exist. I then tried the compiler switch -fx-rounding-mode-truncation but it does not do anything.

 

Is there anyway around this ?

 

BTW the help and comipler manuals contain a lot of stale old information that doesn't seem to be relevant to the current compiler. For example the function set_saturate_mode() is no longer available even though the manuals describe it.

 

regards

david

Outcomes