libreoffice-5.1.1.3 build fails

Linux Slackware x86_64 current:

[build CXX] xmloff/source/draw/ximplink.cxx
/usr/src/libreoffice-5.1.1.3/xmloff/source/draw/ximp3dscene.cxx: In constructor ‘SdXML3DLightContext::SdXML3DLightContext(SvXMLImport&, sal_uInt16, const rtl::OUString&, const com::sun::star::uno::Referencecom::sun::star::xml::sax::XAttributeList&)’:
/usr/src/libreoffice-5.1.1.3/xmloff/source/draw/ximp3dscene.cxx:69:39: error: ‘isnan’ was not declared in this scope
if (!isnan(aVal.getX()) && !isnan(aVal.getY()) && !isnan(aVal.getZ()))
^
/usr/src/libreoffice-5.1.1.3/xmloff/source/draw/ximp3dscene.cxx:69:39: note: suggested alternative:
In file included from /usr/include/c++/5.3.0/random:38:0,
from /usr/include/c++/5.3.0/bits/stl_algo.h:66,
from /usr/include/c++/5.3.0/algorithm:62,
from /usr/include/boost/core/swap.hpp:25,
from /usr/include/boost/optional/optional.hpp:28,
from /usr/src/libreoffice-5.1.1.3/include/sax/tools/converter.hxx:25,
from /usr/src/libreoffice-5.1.1.3/xmloff/source/draw/ximp3dscene.cxx:20:
/usr/include/c++/5.3.0/cmath:641:5: note: ‘std::isnan’
isnan(_Tp __x)
^
/usr/src/libreoffice-5.1.1.3/solenv/gbuild/LinkTarget.mk:189: recipe for target ‘/usr/src/libreoffice-5.1.1.3/workdir/CxxObject/xmloff/source/draw/ximp3dscene.o’ failed
make[1]: *** [/usr/src/libreoffice-5.1.1.3/workdir/CxxObject/xmloff/source/draw/ximp3dscene.o] Error 1