Documentation Center

  • Trial Software
  • Product Updates

accumneg

Subtract two fi objects or values

Syntax

c = accumneg(a,b)
c = accumneg(a,b,RoundingMethod)
c = accumneg(a,b,RoundingMethod,OverflowAction)

Description

c = accumneg(a,b) subtracts b from a using a's data type. b is cast into a's data type. If a is a fi object, the default 'Floor' rounding method and default 'Wrap' overflow action are used. The fimath properties of a and b are ignored.

c = accumneg(a,b,RoundingMethod) uses the rounding method specified in RoundingMethod.

c = accumneg(a,b,RoundingMethod,OverflowAction) uses the overflow action specified in OverflowAction.

Input Arguments

a

Number from which to subtract. a can be fi object or double, single, logical, or integer value. The data type of a is used to compute the output data type.

b

Number to subtract. b can be fi object or double, single, logical, or integer value. .

RoundingMethod

Rounding method to use if a is a fi object. Valid values are 'Ceiling', 'Convergent', 'Floor', 'Nearest', 'Round' and 'Zero'.

Default: Floor

OverflowAction

Overflow action to take if a is a fi object. Valid values are 'Saturate' and 'Wrap',

Default: Wrap

Output Arguments

c

Result of subtracting input b from input a.

Examples

Subtract fi numbers using default accumneg settings and then, using non-default rounding method and overflow action.

a = fi(pi,1,16,13);
b = fi(1.5,1,16,14);
subtr_default  = accumneg(a,b);
subtr_custom = accumneg(a,b,'Nearest','Saturate');

See Also

Related Examples

Was this topic helpful?