Skip to content

Commit d76132f

Browse files
author
Rik
committed
maint: merge stable to default
2 parents 4c2bc30 + 1e9ccca commit d76132f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

liboctave/numeric/mappers.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,13 @@ x_nint (T x)
273273
template <>
274274
inline double x_nint (double x)
275275
{
276-
double fl = std::floor (x);
277-
double frac = x - fl;
278-
return (! isfinite (x) ? x : (frac >= 0.5) ? fl+1 : fl);
276+
return std::round (x);
279277
}
280278

281279
template <>
282280
inline float x_nint (float x)
283281
{
284-
float fl = std::floor (x);
285-
float frac = x - fl;
286-
return (! isfinite (x) ? x : (frac >= 0.5f) ? fl+1 : fl);
282+
return std::round (x);
287283
}
288284

289285
extern OCTAVE_API octave_idx_type nint_big (double x);

0 commit comments

Comments
 (0)