Skip to content

Commit fe8403c

Browse files
committed
fix rounding
1 parent 7ab1368 commit fe8403c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/_datetimemodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,12 +3351,12 @@ delta_total_seconds(PyObject *op, PyObject *Py_UNUSED(dummy))
33513351
int seconds = GET_TD_SECONDS(self);
33523352
int microseconds = GET_TD_MICROSECONDS(self);
33533353
int nanoseconds = GET_TD_NANOSECONDS(self);
3354-
double total = (double)days * 86400.0
3354+
long double total = (double)days * 86400.0
33553355
+ (double)seconds
33563356
+ (double)microseconds * 1e-6
33573357
+ (double)nanoseconds * 1e-9;
33583358
// round to 9 decimal places
3359-
total = round(total * 1e9) / 1e9;
3359+
total = roundl(total * 1e9) / 1e9;
33603360
return PyFloat_FromDouble(total);
33613361
}
33623362

0 commit comments

Comments
 (0)