_f2xm1 -- Calculate (2**x) - 1

Format

#include <builtin.h>
double _f2xm1(double x);

Language Level: Extension
_f2xm1 calculates 2 raised to the power of x, minus 1 ((2**x)-1). The variable x must be in the range -1 to 1. This instruction is designed to produce very accurate results when x is close to 0. Large errors may occur for operands with magnitudes close to 1. You can exponentiate values other than 2 by using the formula x**y = 2**(y * log2(x)).

Because it is a built-in function and has no backing code in the library:

Return Value
This function returns the value of the formula (2**x)-1.

Example
This example calculates (2**x)-1 after prompting the user for a value for x.

#include <builtin.h>
#include <stdio.h>
int main(void)
{
   double x;
   printf("Enter a value for x:\n");
   scanf("%lf", &x);
   printf("(2**(%lf)) - 1 is %lf.\n", x, _f2xm1(x));
   return 0;
   /**************************************************
      Assuming you enter : 0.001
      The output should be :
      (2**(0.001000)) - 1 is 0.000693.
   **************************************************/
}



_fyl2x -- Calculate y * log2(x)
_fyl2xp1 -- Calculate y * log2(x + 1)
<builtin.h>