| Contents | Index |
Only rounding and overflow modes set prior to an operation with fi objects affect the outcome of those operations. Once you create a fi object in MATLAB, changing its rounding or overflow mode does not affect its value. For example, consider the fi objects a and b:
p = fipref('NumberDisplay', 'RealWorldValue',... 'NumericTypeDisplay', 'none', 'FimathDisplay', 'none'); T = numerictype('WordLength',8,'FractionLength',7); F = fimath('RoundMode','floor','OverflowMode','wrap'); a = fi(1,T,F) a = -1 b = fi(1,T) b = 0.9922
Because you create a with a fimath object F that has OverflowMode set to wrap, the value of a wraps to -1. Conversely, because you create b with the default OverflowMode value of saturate, its value saturates to 0.9922.
Now, assign the fimath object F to b:
b.fimath = F
b =
0.9922Because the assignment operation and corresponding overflow and saturation happened when you created b, its value does not change when you assign it the new fimath object F.
Note fi objects that are associated with the global fimath and created from a floating-point value always get constructed with a RoundMode of nearest and an OverflowMode of saturate. To construct fi objects with different RoundMode and OverflowMode properties, specify the desired RoundMode and OverflowMode properties in the fi constructor. |
![]() | Using fimath Properties to Perform Fixed-Point Arithmetic | Using fimath to Share Arithmetic Rules | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |