[Dune] [Dune-Commit] dune-grid r8017 - trunk/dune/grid/genericgeometry/test
Martin Nolte
nolte at mathematik.uni-freiburg.de
Wed May 2 13:56:16 CEST 2012
Is this check really safe? If I remember correctly, -ffast-math lets the
compiler assume that isnan is always false.
Best,
Martin
On 05/02/2012 01:48 PM, sander at dune-project.org wrote:
> Author: sander
> Date: 2012-05-02 13:48:42 +0200 (Wed, 02 May 2012)
> New Revision: 8017
>
> Modified:
> trunk/dune/grid/genericgeometry/test/testbasicgeometry.cc
> Log:
> Use std::isnan instead of a==a to test for NaN-ness.
>
> Because more people will understand what this does.
> And to be on the safe side we even add a comment!
>
>
>
> Modified: trunk/dune/grid/genericgeometry/test/testbasicgeometry.cc
> ===================================================================
> --- trunk/dune/grid/genericgeometry/test/testbasicgeometry.cc 2012-05-02 09:45:59 UTC (rev 8016)
> +++ trunk/dune/grid/genericgeometry/test/testbasicgeometry.cc 2012-05-02 11:48:42 UTC (rev 8017)
> @@ -42,7 +42,9 @@
> {
> typedef typename TestGeometry::ctype ctype;
>
> - if(expectedVolume == expectedVolume) {
> + // If expectedVolume is NaN that is a sign from above
> + // saying we are supposed to skip the test
> + if(not std::isnan(expectedVolume)) {
> ctype volume = geometry.volume();
> if(std::abs(volume - expectedVolume)> 1e-8) {
> std::cerr<< "Volume: "<< volume<< ", but"
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
--
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
Universität Freiburg phone: +49-761-203-5630
Abteilung für angewandte Mathematik fax: +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany
More information about the Dune
mailing list