cbrtd32(), cbrtd64(), cbrtd128() — Calculate the cube root

Standards

Standards / Extensions C or C++ Dependencies
C/C++ DFP both z/OS® V1.11

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>

_Decimal32  cbrtd32(_Decimal32 x); 
_Decimal64  cbrtd64(_Decimal64 x); 
_Decimal128 cbrtd128(_Decimal128 x); 

_Decimal32  cbrt(_Decimal32 x);      /* C++ only */
_Decimal64  cbrt(_Decimal64 x);      /* C++ only */
_Decimal128 cbrt(_Decimal128 x);     /* C++ only */

General description

The cbrt() function calculates the real cube root of its argument x.

Notes:
  1. These functions work in IEEE decimal floating-point format. See IEEE decimal floating-pointIEEE Decimal Floating-Point for more information.
  2. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.

Example

⁄* CELEBC52

   This example illustrates the cbrtd64() function.

*⁄

#define  __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>

void main(void)
{
   _Decimal64 x, y;

   x = 1000.0DD;
   y = cbrtd64(x);

   printf("cbrtd64( %Df ) = %Df\n", x, y);
}

Returned value

The cbrt functions return x to the 1/3 power.

cbrt() does not fail.

Related information