Back to index

python3.2  3.2.2
Functions
pymath.c File Reference
#include "Python.h"

Go to the source code of this file.

Functions

double hypot (double x, double y)
double copysign (double x, double y)
double round (double x)

Function Documentation

double copysign ( double  x,
double  y 
)

Definition at line 57 of file pymath.c.

{
    /* use atan2 to distinguish -0. from 0. */
    if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) {
        return fabs(x);
    } else {
        return -fabs(x);
    }
}

Here is the caller graph for this function:

double hypot ( double  x,
double  y 
)

Definition at line 35 of file pymath.c.

{
    double yx;

    x = fabs(x);
    y = fabs(y);
    if (x < y) {
        double temp = x;
        x = y;
        y = temp;
    }
    if (x == 0.)
        return 0.;
    else {
        yx = y/x;
        return x*sqrt(1.+yx*yx);
    }
}

Here is the caller graph for this function:

double round ( double  x)

Definition at line 70 of file pymath.c.

{
    double absx, y;
    absx = fabs(x);
    y = floor(absx);
    if (absx - y >= 0.5)
    y += 1.0;
    return copysign(y, x);
}

Here is the call graph for this function:

Here is the caller graph for this function: