From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2019-10-14 19:15:03
There seems to be support for 16-bit floats on iOS, when using
Apple's XCode clang. This seems to be a storage-only format
with the only instruction set support being conversions to
and from 32- and 64-bit floats. Quick test:
#if __ARM_FP & 2
#warning "Have 16-bit FP"
__fp16 a = 1.234;
__fp16 b = 2.345;
auto sum = a+b;
There doesn't seem to be a std::numeric_limits specialisation.
I suspect that other platforms have something similar. It would be
good to have a boost::float16_t typedef and a portable feature-test
macro (and maybe a software fallback). As far as I can see,
boost/math/cstdfloat/cstdfloat_types.hpp checks the sizes of
float, double and long double, and checks for 128-bit floats provided
by the compiler. Can this be extended to check for __fp16 ?
(P.S. it seems that gcc also has support, see
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk