Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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');

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2012a

Was this topic helpful?