Mercurial > hg > octave-terminal
changeset 11748:63e048203ed3 release-3-0-x
changeset: 7800:9828eda04f24
tag: tip
user: Michael Goffioul <michael.goffioul@gmail.com>
date: Wed Apr 09 15:50:56 2008 +0200
files: liboctave/ChangeLog liboctave/lo-mappers.cc
description:
Fix xround implementation under Win32 (use gnulib version).
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 09 Apr 2008 13:31:42 -0400 |
parents | 8b77c3a5d87a |
children | b172a66c7433 |
files | liboctave/ChangeLog liboctave/lo-mappers.cc |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,8 @@ 2008-04-09 Michael Goffioul <michael.goffioul@gmail.com> + * lo-mappers.cc (xround): Avoid floating-point overflow when input + value is equal to bitmax implementation taken from gnulib). + * file-stat.cc (file_stat::update_internal): Do not strip trailing file separator when path length is equal to 1 (handle case '\') under __WIN32__ platforms.
--- a/liboctave/lo-mappers.cc +++ b/liboctave/lo-mappers.cc @@ -75,7 +75,24 @@ #if defined (HAVE_ROUND) return round (x); #else - return x > 0 ? floor (x + 0.5) : ceil (x - 0.5); + if (x >= 0) + { + double y = floor (x); + + if ((x - y) >= 0.5) + y += 1.0; + + return y; + } + else + { + double y = ceil (x); + + if ((y - x) >= 0.5) + y -= 1.0; + + return y; + } #endif }