PS-Trainer C - Entwicklung
Mathematik: Wurzel und Potenz
Homepage von PS-Trainer - C-Entwicklung - Mathematik - an PS-Trainer
PS-Trainer PS-Trainer

Math and related Root and Power
pow Calculate x raised to the power of y.
sqrt Calculate the square root.


pow
Calculates x raised to the power of y.
double pow( double x, double y );

Routine Required Header Compatibility
pow <math.h> ANSI, Win 95, Win NT

Remarks
The pow function computes x raised to the power of y.
pow does not recognize integral floating-point values greater than 264, such as 1.0E100.

Subject: Floating-Point Support Routines
Keywords: See also exp, log, sqrt
Return Value
pow returns the value of x^y. No error message is printed on overflow or underflow.
Values of x and y Return Value of pow

x < > 0 and y = 0.0 1
x = 0.0 and y = 0.0 1
x = 0.0 and y < 0 INF

Parameters
x Base
y Exponent

Example
/* POW.C
*
*/

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

void main( void )
{
double x = 2.0, y = 3.0, z;

z = pow( x, y );
printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}


Output
2.0 to the power of 3.0 is 8.0


sqrt
Calculates the square root.
double sqrt( double x );

Routine Required Header Compatibility
sqrt <math.h> ANSI, Win 95, Win NT

Subject: Floating-Point Support Routines
Keywords: See also exp, log, pow
Return Value
The sqrt function returns the square-root of x. If x is negative, sqrt returns an indefinite (same as a quiet NaN). You can modify error handling with _matherr.

Parameter
x Nonnegative floating-point value
Example
/* SQRT.C: This program calculates a square root. */

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

void main( void )
{
double question = 45.35, answer;

answer = sqrt( question );
if( question < 0 )
printf( "Error: sqrt returns %.2f\n, answer" );
else
printf( "The square root of %.2f is %.2f\n", question, answer );
}


Output
The square root of 45.35 is 6.73


Homepage von PS-Trainer - C-Entwicklung - Mathematik - an PS-Trainer

Aktuelle Daten dieser Seite Letzte Änderung:
  Geocities

 

 

 

Hosted by www.Geocities.ws

1