What does it mean to have uselongdouble undefined, but d_longdbl is defined in the Perl build configuration?

Most perl installations that I use have uselongdouble undefined, but d_longdbl are defined. Literally, I assume that this means that long doubles are not used as the default floating point type, but long doubles are "supported". I am confused, though about the fact that this means that for long doublings you need to "support". As far as I know, Perl does not have any mechanism for casting or moving to higher precision by default. How do you get a long double key in a Perl program if the floating point type is double vanilla by default.

+3
source share
2 answers

d_longdbl simply says that there is support for long doubles in the environment that perl built.

This causes the C HAS_LONG_DOUBLE macro to be set, which is a prerequisite for USE_LONG_DOUBLE and includes the L and ll s / printf modifiers.

(It is also available for XS modules that can modify behavior based on it.)

+2
source

You can check the support for long doubles at runtime using the module Config. Here is a sample code from perldoc that shows usage:

  use Config;
    if ($Config{uselongdouble} eq "define") {
    print "long doubles by default\n";
    }

This example is given in the sprintf section (which I just read ...), and there are other examples there.

, , . Perl , . ( use integer)

0

Source: https://habr.com/ru/post/1764999/


All Articles