mirror of https://github.com/python/cpython.git
answer lint's complaints
This commit is contained in:
parent
f1aeab7f81
commit
3132a5a7dc
|
@ -64,6 +64,13 @@ newfloatobject(fval)
|
||||||
return (object *) op;
|
return (object *) op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
float_dealloc(op)
|
||||||
|
object *op;
|
||||||
|
{
|
||||||
|
DEL(op);
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
getfloatvalue(op)
|
getfloatvalue(op)
|
||||||
object *op;
|
object *op;
|
||||||
|
@ -106,11 +113,12 @@ float_buf_repr(buf, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
static int
|
static int
|
||||||
float_print(v, fp, flags)
|
float_print(v, fp, flags)
|
||||||
floatobject *v;
|
floatobject *v;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int flags;
|
int flags; /* Not used but required by interface */
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
float_buf_repr(buf, v);
|
float_buf_repr(buf, v);
|
||||||
|
@ -178,7 +186,7 @@ float_rem(v, w)
|
||||||
floatobject *w;
|
floatobject *w;
|
||||||
{
|
{
|
||||||
double vx, wx;
|
double vx, wx;
|
||||||
double div, mod;
|
double /* div, */ mod;
|
||||||
wx = w->ob_fval;
|
wx = w->ob_fval;
|
||||||
if (wx == 0.0) {
|
if (wx == 0.0) {
|
||||||
err_setstr(ZeroDivisionError, "float modulo");
|
err_setstr(ZeroDivisionError, "float modulo");
|
||||||
|
@ -186,10 +194,10 @@ float_rem(v, w)
|
||||||
}
|
}
|
||||||
vx = v->ob_fval;
|
vx = v->ob_fval;
|
||||||
mod = fmod(vx, wx);
|
mod = fmod(vx, wx);
|
||||||
div = (vx - mod) / wx;
|
/* div = (vx - mod) / wx; */
|
||||||
if (wx*mod < 0) {
|
if (wx*mod < 0) {
|
||||||
mod += wx;
|
mod += wx;
|
||||||
div -= 1.0;
|
/* div -= 1.0; */
|
||||||
}
|
}
|
||||||
return newfloatobject(mod);
|
return newfloatobject(mod);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +325,7 @@ typeobject Floattype = {
|
||||||
"float",
|
"float",
|
||||||
sizeof(floatobject),
|
sizeof(floatobject),
|
||||||
0,
|
0,
|
||||||
free, /*tp_dealloc*/
|
float_dealloc, /*tp_dealloc*/
|
||||||
float_print, /*tp_print*/
|
float_print, /*tp_print*/
|
||||||
0, /*tp_getattr*/
|
0, /*tp_getattr*/
|
||||||
0, /*tp_setattr*/
|
0, /*tp_setattr*/
|
||||||
|
|
Loading…
Reference in New Issue