On 7 April 2017 at 16:02, Andreas Tille <andr...@fam-tille.de> wrote: > On Wed, Apr 05, 2017 at 10:22:28PM +0200, Iain Buclaw wrote: >> Which compiler? > > $ LANG=C apt-cache policy ldc > ldc: > Installed: 1:1.1.1-1 > >> Are NaNs being honoured? > > Hmmm, no idea how to check this. >
Someone who maintains ldc might know. :-) >> What if you were to replace >> the `(x != x && f != f)` comparison with `(isNaN(x) && isNaN(f))` ? > > If I apply the following patch > > --- a/src/undead/stream.d > +++ b/src/undead/stream.d > @@ -1455,7 +1455,7 @@ class Stream : InputStream, OutputStream > > float f; > assert(s.readf(&f)); > - assert(x == f || (x != x && f != f)); //either equal or both NaN > + assert(x == f || (isNaN(x) && isNaN(f))); //either equal or both NaN > } > > tryFloatRoundtrip(1.0); > > > I get > > ... > [12/25] ldc2 '-Iundead_test@exe' '-I.' '-I..' '-I../src/' '-enable-color' > '-O' '-release' '-g' '-unittest' -of 'undead_test@exe/src_undead_stream.d.o' > -c ../src/undead/stream.d > FAILED: undead_test@exe/src_undead_stream.d.o > ldc2 '-Iundead_test@exe' '-I.' '-I..' '-I../src/' '-enable-color' '-O' > '-release' '-g' '-unittest' -of 'undead_test@exe/src_undead_stream.d.o' -c > ../src/undead/stream.d > ../src/undead/stream.d(1458): Error: undefined identifier 'isNaN' > ../src/undead/stream.d(1458): Error: undefined identifier 'isNaN' > > > I have the feelingt that this meand "no" to your second question. > isNaN is from the std.math module. http://dlang.org/phobos/std_math.html#.isNaN You would need to import it. ;-)