Mercurial > hg > octave-nkf
changeset 20174:d20dd211cc89
Enable float truncation by default for octave builds.
* NEWS: Announce change.
* configure.ac: Change configure option to --disable-float-truncate, and enable
float truncation by default.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 19 Mar 2015 07:00:11 -0700 |
parents | 23c0f89700a4 |
children | 40b2c4323c16 |
files | NEWS configure.ac |
diffstat | 2 files changed, 20 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -316,6 +316,17 @@ advantage of OpenMP if desired. This can be disabled when building Octave with the configure option --disable-openmp. + ** Octave now automatically truncates intermediate calculations done with + floating point values to 64 bits. Some hardware math co-processors, such + as the x87, maintain extra precision, but this leads to disagreements in + calculations when compared to reference implementations in software using + the IEEE standard for double precision. There was no measurable + performance impact to this change, but it may be disabled with the + configure option --disable-float-truncate. MinGW and Cygwin platforms, + as well as GCC compilers >= 5.0 require this feature. Non-x87 hardware, + or hardware using SSE options exclusively, can disable float truncation + if desired. + --------------------------------------------------------- See NEWS.3 for old news.
--- a/configure.ac +++ b/configure.ac @@ -465,35 +465,19 @@ ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits. ### Generally, storing the result in a local volatile variable forces a ### truncation back to 64 bits, but it also degrades performance. -### Thus, we provide a FLOAT_TRUNCATE macro that may be defined to "volatile" -### when compiling for x87 target, or left empty for modern SSE math, that -### doesn't suffer from this problem at all. -### FIXME: If no option value is given, configure uses a default heuristic -### which assumes that truncation should occur for MinGW and Cygwin -### systems and not for any others. It would be marginally nicer -### to replace this with a test that checks whether the problem arises -### and only sets the flag if necessary. However, the principal -### scenario for those two systems is a cross-build where we can't -### run an executable so the test wouldn't be too useful most of the -### time (only native builds on MinGW and Cygwin *might* benefit). -### Maybe, one could generate assembly code with -S option and inspect -### it without having to run an executable, but this sounds pretty dicey. +### However, this performance degradation is very minimal, if indeed measurable. +### Therefore, it has been enabled for all platforms and compilers. +### Reported bugs indicate that --enable-float-truncate is required for MinGW +### and Cygwin platforms and for GCC compilers >= 5.0. It should not be +### necessary for non-x87 targets or when using modern SSE math. +ac_float_truncate=volatile AC_ARG_ENABLE([float-truncate], - [AS_HELP_STRING([--enable-float-truncate], + [AS_HELP_STRING([--disable-float-truncate], [truncate intermediate FP results])], - [if test "$enableval" = yes; then - ac_float_truncate=volatile - else + [if test "$enableval" = no; then ac_float_truncate= fi], - [case $host_os in - mingw* | cygwin*) - ac_float_truncate=volatile - ;; - *) - ac_float_truncate= - ;; - esac]) + []) AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate], [Define to volatile if you need to truncate intermediate FP results.])