We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4c2bc30 + 1e9ccca commit d76132fCopy full SHA for d76132f
liboctave/numeric/mappers.h
@@ -273,17 +273,13 @@ x_nint (T x)
273
template <>
274
inline double x_nint (double x)
275
{
276
- double fl = std::floor (x);
277
- double frac = x - fl;
278
- return (! isfinite (x) ? x : (frac >= 0.5) ? fl+1 : fl);
+ return std::round (x);
279
}
280
281
282
inline float x_nint (float x)
283
284
- float fl = std::floor (x);
285
- float frac = x - fl;
286
- return (! isfinite (x) ? x : (frac >= 0.5f) ? fl+1 : fl);
287
288
289
extern OCTAVE_API octave_idx_type nint_big (double x);
0 commit comments