Name:

roundcoefficients rounds the coefficients of a polynomial to classical formats.

Usage:

roundcoefficients(p,L) : (function, list) -> function

Parameters:

Description:

Example 1:

   > p=exp(1) + x*(exp(2) + x*exp(3));
   > display=binary!;
   > roundcoefficients(p,[|DD,D,D|]);
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.010000010101111001011011111101101111101100010000011_2 * 2^(4)))
   > roundcoefficients(p,[|DD,D...|]);
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.010000010101111001011011111101101111101100010000011_2 * 2^(4)))

Example 2:

   > f=sin(exp(1)*x);
   > display=binary!;
   > f;
   sin(x * (1.0101101111110000101010001011000101000101011101101001010100110101010111111011100010101100010000000100111001111010011110011110001110110001011100111000101100000111101_2 * 2^(1)))
   > roundcoefficients(f,[|D...|]);
   sin(x * (1.0101101111110000101010001011000101000101011101101001010100110101010111111011100010101100010000000100111001111010011110011110001110110001011100111000101100000111101_2 * 2^(1)))

Example 3:

   > p=exp(1) + x*(exp(2) + x*exp(3));
   > verbosity=1!;
   > display=binary!;
   > roundcoefficients(p,[|DD,D|]);
   Warning: the number of the given formats does not correspond to the degree of the given polynomial.
   Warning: the 0th coefficient of the given polynomial does not evaluate to a floating-point constant without any rounding.
   Will evaluate the coefficient in the current precision in floating-point before rounding to the target format.
   Warning: the 1th coefficient of the given polynomial does not evaluate to a floating-point constant without any rounding.
   Will evaluate the coefficient in the current precision in floating-point before rounding to the target format.
   Warning: rounding may have happened.
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.01000001010111100101101111110110111110110001000001011111001011010100101111011111110001010011011101000100110000111010001110010000010110000101100000111001011100101001_2 * 2^(4)))
See also: halfprecision, single, double, doubleextended, doubledouble, quad, tripledouble, fpminimax, remez, implementpoly, subpoly
Go back to the list of commands