Documentation/Calc Functions/RAWSUBTRACT
Jump to navigation
Jump to search
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Function name:
RAWSUBTRACT
Category:
Mathematical
Summary:
Subtracts a set of numbers and gives the result without eliminating small roundoff errors.
Syntax:
RAWSUBTRACT(Minuend; Subtrahend 1[; Subtrahend 2][; … ;[ Subtrahend 254]])
Returns:
Subtracts the subtrahend(s) from the Minuend without eliminating roundoff errors and returns a real number.
Arguments:
Minuend is a real number or a reference to a cell containing that number from which numbers are to be subtracted.
Subtrahend 1[; Subtrahend 2][; ... ;[ Subtrahend 254]] are real numbers or references to cells containing those numbers which will be subtracted from Minuend.
At least one subtrahend is required.
Additional details:
- =RAWSUBTRACT(a,b,c) is like =a-b-c, but the - minus operator cancels out small roundoff errors that are due to the fact that not every decimal number can be exactly represented as a binary floating point number and effectively the operation snaps to zero. RAWSUBTRACT uses the IEEE754 operation the platform/compiler provides. For example, =0.3-0.2-0.1 results in 0, whereas =RAWSUBTRACT(0.3,0.2,0.1) results in 2.77555756156289E-17. Uncheck Tools > Options > Calc > Calculate > Limit decimals for general number format to get this result.
- This can be used to compare whether a result exactly matches an expected number, i.e. if =RAWSUBTRACT(result,expected) equals 0.0
Examples:
Formula | Description | Returns |
---|---|---|
=RAWSUBTRACT(0.987654321098765;0.9876543210987) | difference between two numbers | 6.50590692430342E-14 |
=RAWSUBTRACT(6.50590692430342) | at least 2 arguments required so function returns an error value | Err:511 |
Related LibreOffice functions:
ODF standard:
None
Equivalent Excel functions:
None