Main Content

fi Constructor Does Not Follow globalfimath Rules

Issue

If no fimath properties are used in the argument of the fi constructor, or the Value property of the fi constructor is specified, then it always uses nearest rounding and saturates on overflow for the creation of the fi object, regardless of any globalfimath settings.

Possible Solutions

If this behavior is undesirable for your application, you can do one of the following:

Use the cast Function to Create a fi Object Using the globalfimathrules

G = globalfimath('RoundingMethod', 'Floor', 'OverflowAction','Wrap');
cast(x, 'like', fi([],1,16,10))

When you create a fi object using the cast function, the resulting fi object does not have a local fimath unless the prototype value has a local fimath. For example,

cast(3.6,'like',fi([],1,16,10,'RoundingMethod','floor')).

Specify fimath Properties in the fi Constructor

fi(x,1,16,10,'RoundingMethod','Floor','OverflowAction','Wrap');

When you create a fi object with fimath properties in the constructor, the fi object does have a local fimath.

See Also

| |