vpa
Variable-precision arithmetic (arbitrary-precision arithmetic)
Description
,
when yVpa = vpa(___,BoostPrecision=tf)y is double precision, specifies whether to
increase the precision of y when converting it to a
symbolic number with variable precision. By default, when you pass a
double-precision input to vpa, the function
attempts to increase the precision during conversion. To preserve the
original bit pattern of the double-precision input, set
BoostPrecision to false.
You can use this option in addition to any of the input argument
combinations in previous syntaxes. (since R2026a)
Examples
Input Arguments
Output Arguments
Tips
vpadoes not convert fractions in the exponent to floating point. For example,vpa(a^sym(2/5))returnsa^(2/5).vpainternally uses more digits than the number of digits specified bydigits. These extra digits guard against round-off errors in subsequent calculations. For an example, see vpa Uses Guard Digits to Maintain Precision.When you call
vpaon a numeric input, such as1/3,2^(-5), orsin(pi/4), the expression is first evaluated as a double-precision number, providing 64 bits or approximately 16 digits of precision.vpathen increases the precision to the specified number of significant digits. For more accurate results, define symbolic inputs instead by usingsym. For example, to approximateexp(1)to 32 significant digits, usevpa(exp(sym(1))).By default,
vpaincreases the precision for numeric inputs that match the forms p/q, pπ/q, (p/q)1/2, 2q, and 10q, where p and q are modest-sized integers. For more information, see Maintain Precision of Common Double-Precision Inputs.Variable-precision arithmetic is different from IEEE® Floating-Point Standard 754 in these ways:
Inside computations, division by zero throws an error.
The exponent range is larger than in any predefined IEEE mode.
vpaunderflows below approximately10^(-323228496).Denormalized numbers are not implemented.
Zeros are not signed.
The number of binary digits in the mantissa of a result might differ between variable-precision arithmetic and IEEE predefined types.
There is only one
NaNrepresentation. No distinction is made between quiet and signalingNaN.No floating-point number exceptions are available.