fi Constructor Does Not Follow globalfimath Rules

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

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 globalfimath rules.

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

  • Specify fimath properties in the fi constructor.

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

Note

When you create a fi object using the cast function, the resulting fi object does not have a local fimath. When you create a fi object with fimath properties in the constructor, the fi object does have a local fimath.

See Also

| |