compound
Compute the factor of the compound terminal value. The input parameter is a real number.
Interface Definition
C interface:
float compoundf(float x, float y);
double compound(double x, double y);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data |
Input |
y |
|
Floating-point value of the input data |
Input |
Return Value
- If x is greater than –1 and y ∈ (–∞, +∞), the computing result is returned.
- If x is any value and y is ±0, the return value is 0.
- If x is NaN and y is any value, the return value is NaN.
- If x is any value and y is NaN, the return value is NaN.
- If x is +∞ and y is –1, the return value is –1. If y < –1, the return value is –∞. If y ∈ (–1, 0), the return value is –0.
- If x = 0 and y != 0, the return value is y.
- If x is –1 and y < 0, the return value is –1. If y > 0, the return value is +∞.
- If x < –1 and y != 0, the return value is NaN.
- If y is –∞ and x ∈ (–1, 0), the return value is 1.0/x. If x > 0, the return value is –∞.
- If y is +∞ and x ∈ (–1, 0), the return value is +∞. If x > 0, the return value is 1.0/x.
Dependencies
C: "km.h"
Examples
C interface:
printf("compound(1.0, 10.0) = %.15f\n", compound(1.0, 10.0));
printf("compound(0.5, -3.0) = %.15f\n", compound(0.5, -3.0));
printf("compound(0.3, -10.0) = %.15f\n", compound(1.0, 10.0));
printf("compound(4, 2.0) = %.15f\n", compound(0.5, -3.0));
printf("compound(INFINITY, 0) = %.15f\n", compound(INFINITY, 0));
printf("compound(INFINITY, 0) = %.15f\n", compound(INFINITY, 0));
printf("compound(1.0, NAN) = %.15f\n", compound(1.0, NAN));
printf("compound(NAN, 1.0) = %.15f\n", compound(NAN, 1.0));
printf("compound(INFINITY, -1.0) = %.15f\n", compound(INFINITY, -1.0));
printf("compound(INFINITY, -10.0) = %.15f\n", compound(INFINITY, -10.0));
printf("compound(INFINITY, 10.0) = %.15f\n", compound(INFINITY, 10.0));
printf("compound(0, 1.0) = %.15f\n", compound(0, 1.0));
printf("compound(-1.0, -1.0) = %.15f\n", compound(-1.0, -1.0));
printf("compound(-1.0, 1.0) = %.15f\n", compound(-1.0, 1.0));
printf("compound(-10.0, 1.0) = %.15f\n", compound(-10.0, 1.0));
printf("compound(-0.5, -INFINITY) = %.15f\n", compound(-0.5, -INFINITY));
printf("compound(0.5, -INFINITY) = %.15f\n", compound(0.5, -INFINITY));
printf("compound(-0.5, INFINITY) = %.15f\n", compound(-0.5, INFINITY));
printf("compound(0.5, INFINITY) = %.15f\n", compound(0.5, INFINITY));
/**
* compound(1.0, 10.0) = 1024.000000000000000
* compound(0.5, -3.0) = 0.296296296296296
* compound(0.3, -10.0) = 1024.000000000000000
* compound(4, 2.0) = 0.296296296296296
* compound(INFINITY, 0) = 1.000000000000000
* compound(INFINITY, 0) = 1.000000000000000
* compound(1.0, NAN) = nan
* compound(NAN, 1.0) = nan
* compound(INFINITY, -1.0) = 0.000000000000000
* compound(INFINITY, -10.0) = 0.000000000000000
* compound(INFINITY, 10.0) = inf
* compound(0, 1.0) = 1.000000000000000
* compound(-1.0, -1.0) = inf
* compound(-1.0, 1.0) = 0.000000000000000
* compound(-10.0, 1.0) = nan
* compound(-0.5, -INFINITY) = inf
* compound(0.5, -INFINITY) = 0.000000000000000
* compound(-0.5, INFINITY) = 0.000000000000000
* compound(0.5, INFINITY) = inf
*/
Parent topic: Special Functions