On Jan 21, 2021, Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote:
> Which target properties determine that a-nallfl__wraplf.ads should be > used? The question really is what makes the default a-nallfl.ads unusable for a target. It works when the Ada type Long_Long_Float and the C long double type are nop-convertible. When they aren't, the attempt to compile it will report mismatch between the functions declared with Long_Long_Float, and the C intrinsics they're mapped to. > Can it be used for all targets? It would compile, but it shouldn't be used that way. The wraplf implementation uses wrappers of the Long_Float/C double implementations of trigonometric and transcendental functions. When Long_Long_Float and Long_Float are different names for the same base FP types, that's ok, but when Long_Long_Float is wider, the results may be unacceptably imprecise. in general, you can use wraplf when long double and double use the same representation in C. When they don't, one needs to tell whether GNAT maps Long_Long_Float to long double or to double. GNAT wants Long_Long_Float to be as much of a hardware-supported type as Long_Float, and the heuristics to accomplish that, in gcc/ada/set_targ.adb:C_Type_For is to only use long double if it can represent no more than 18 digits. I believe this heuristics is to be revisited in a not-too-distant future, but it's what it is ATM. -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Vim, Vi, Voltei pro Emacs -- GNUlius Caesar