scale10(3C)
_________________________________________________________________
scale10 function
Multiply a number by a power of 10.
_________________________________________________________________
Calling Sequence
double sn, num, scale10();
int pow;
sn = scale10(num, pow);
where sn and num are of type double.
pow is of type int.
Description
Use the scale10 function to multiply a number by a power of 10.
The include file math.h defines this entry.
Returns
The scale10 function returns the value of num multiplied by
10**pow.
Related Functions
See also the pow and exp functions.
Example
/* Program test for the scale10() function */
#include <math.h>
int i = 1, pwr;
double sn, num, atof(), scale10();
main(argc, argv)
int argc;
char *argv[];
{
while (i+1 < argc) {
num = atof(argv[i++]);
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
scale10(3C)
pwr = atoi(argv[i]);
printf("%f times 10 to the %d = %f\n",
num, pwr, sn = scale10(num, pwr));
i++;
}
}
A call to the program test with
x test [inputnos]
where the file input_nos contains
.00007 5 &
.006 4 &
.5 3 &
4 2
generates the output
0.000070 times 10 to the 5 = 7.000000
0.006000 times 10 to the 4 = 60.000000
0.500000 times 10 to the 3 = 500.000000
4.000000 times 10 to the 2 = 400.000000
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)