CBRT

This function evaluates the cube root.

Function Return Value

CBRT — Function value. (Output)

Required Arguments

X Argument for which the cube root is desired. (Input)

FORTRAN 90 Interface

Generic: CBRT (X)

Specific: The specific interface names are S_CBRT, D_CBRT, C_CBRT, and Z_CBRT.

FORTRAN 77 Interface

Single: CBRT (X)

Double: The double precision name is DCBRT.

Complex: The complex precision name is CCBRT.

Double Complex: The double complex precision name is ZCBRT.

Description

The function CBRT(X) evaluates x1/3. All arguments are legal. For complex argument, x, the value of x must not overflow.

Comments

For complex arguments, the branch cut for the cube root is taken along the negative real axis. The argument of the result, therefore, is greater than –π/3 and less than or equal to π/3. The other two roots are obtained by rotating the principal root by 3 π/3 and π/3.

Examples

Example 1

In this example, the cube root of 3.45 is computed and printed.

 

USE CBRT_INT

USE UMACH_INT

 

IMPLICIT NONE

! Declare variables

INTEGER NOUT

REAL VALUE, X

! Compute

X = 3.45

VALUE = CBRT(X)

! Print the results

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) X, VALUE

99999 FORMAT (' CBRT(', F6.3, ') = ', F6.3)

END

Output

 

CBRT( 3.450) = 1.511

Example 2

In this example, the cube root of –3 + 0.0076i is computed and printed.

 

USE UMACH_INT

USE CBRT_INT

IMPLICIT NONE

 

! Declare variables

INTEGER NOUT

COMPLEX VALUE, Z

! Compute

Z = (-3.0, 0.0076)

VALUE = CBRT(Z)

! Print the results

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) Z, VALUE

99999 FORMAT (’ CBRT((’, F7.4, ’,’, F7.4, ’)) = (’, &

F6.3, ’,’, F6.3, ’)’)

END

Output

 

CBRT((-3.0000, 0.0076)) = ( 0.722, 1.248)