?RCS: $Id$
?RCS:
-?RCS: Copyright (c) 1999 Jarkko Hietaniemi
+?RCS: Copyright (c) 1999-2016 Jarkko Hietaniemi
?RCS:
?RCS: You may distribute under the terms of either the GNU General Public
?RCS: License or the Artistic License, as specified in the README file.
?RCS:
?MAKE:d_PRIfldbl sPRIfldbl d_PRIgldbl d_PRIFUldbl sPRIGUldbl d_PRIEUldbl \
sPRIgldbl d_PRIeldbl sPRIeldbl sPRIFUldbl d_PRIGUldbl sPRIEUldbl \
- d_SCNfldbl \
+ d_SCNfldbl d_double_style_vax d_double_style_ieee \
+ d_double_style_ibm d_double_style_cray d_double_has_subnormals \
+ d_double_has_inf d_double_has_nan d_double_has_negative_zero \
sSCNfldbl doublekind: \
d_longdbl longdblsize doublesize uselongdouble test echo cat rm_try \
Setvar Compile run i_stdlib osname gccversion ccflags
?MAKE: -pick add $@ %<
?S:doublekind:
?S: This variable, if defined, encodes the type of a double:
-?S: 1 = IEEE 754 32-bit big little endian,
-?S: 2 = IEEE 754 32-bit big big endian,
-?S: 3 = IEEE 754 64-bit big little endian,
-?S: 4 = IEEE 754 64-bit big big endian,
-?S: 5 = IEEE 754 128-bit big little endian,
-?S: 6 = IEEE 754 128-bit big big endian,
-?S: 7 = IEEE 754 64-bit big mixed endian le-be,
-?S: 8 = IEEE 754 64-bit big mixed endian be-le,
+?S: 1 = IEEE 754 32-bit little endian,
+?S: 2 = IEEE 754 32-bit big endian,
+?S: 3 = IEEE 754 64-bit little endian,
+?S: 4 = IEEE 754 64-bit big endian,
+?S: 5 = IEEE 754 128-bit little endian,
+?S: 6 = IEEE 754 128-bit big endian,
+?S: 7 = IEEE 754 64-bit mixed endian le-be,
+?S: 8 = IEEE 754 64-bit mixed endian be-le,
+?S: 9 = VAX 32bit little endian F float format
+?S: 10 = VAX 64bit little endian D float format
+?S: 11 = VAX 64bit little endian G float format
+?S: 12 = IBM 32bit format
+?S: 13 = IBM 64bit format
+?S: 14 = Cray 64bit format
?S: -1 = unknown format.
?S:.
?S:d_PRIfldbl:
?S: This variable, if defined, contains the string used by stdio to
?S: format long doubles (format 'f') for input.
?S:.
+?S:d_double_has_inf:
+?S: This variable conditionally defines the symbol DOUBLE_HAS_INF
+?S: which indicates that the double type has an infinity.
+?S:.
+?S:d_double_has_nan:
+?S: This variable conditionally defines the symbol DOUBLE_HAS_NAN
+?S: which indicates that the double type has a not-a-number.
+?S:.
+?S:d_double_has_negative_zero:
+?S: This variable conditionally defines the symbol DOUBLE_HAS_NEGATIVE_ZERO
+?S: which indicates that the double type has a negative zero.
+?S:.
+?S:d_double_has_subnormals:
+?S: This variable conditionally defines the symbol DOUBLE_HAS_SUBNORMALS
+?S: which indicates that the double type has subnormals (denormals).
+?S:.
+?S:d_double_style_cray:
+?S: This variable conditionally defines the symbol DOUBLE_STYLE_CRAY
+?S: which indicates that the double is the 64-bit CRAY mainframe format.
+?S:.
+?S:d_double_style_ibm:
+?S: This variable conditionally defines the symbol DOUBLE_STYLE_IBM,
+?S: which indicates that the double is the 64-bit IBM mainframe format.
+?S:.
+?S:d_double_style_ieee:
+?S: This variable conditionally defines the symbol DOUBLE_STYLE_IEEE,
+?S: which indicates that the double is the 64-bit IEEE 754.
+?S:.
+?S:d_double_style_vax:
+?S: This variable conditionally defines the symbol DOUBLE_STYLE_VAX,
+?S: which indicates that the double is the 64-bit VAX format D or G.
+?S:.
?C:PERL_PRIfldbl:
?C: This symbol, if defined, contains the string used by stdio to
?C: format long doubles (format 'f') for output.
?C: DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN
?C: DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE
?C: DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE
+?C: DOUBLE_IS_VAX_F_FLOAT
+?C: DOUBLE_IS_VAX_D_FLOAT
+?C: DOUBLE_IS_VAX_G_FLOAT
+?C: DOUBLE_IS_IBM_SINGLE_32_BIT
+?C: DOUBLE_IS_IBM_DOUBLE_64_BIT
+?C: DOUBLE_IS_CRAY_SINGLE_64_BIT
?C: DOUBLE_IS_UNKNOWN_FORMAT
?C:.
+?C:DOUBLE_HAS_INF:
+?C: This symbol, if defined, indicates that the double has
+?C: the infinity.
+?C:.
+?C:DOUBLE_HAS_NAN:
+?C: This symbol, if defined, indicates that the double has
+?C: the not-a-number.
+?C:.
+?C:DOUBLE_HAS_NEGATIVE_ZERO:
+?C: This symbol, if defined, indicates that the double has
+?C: the negative_zero.
+?C:.
+?C:DOUBLE_HAS_SUBNORMALS:
+?C: This symbol, if defined, indicates that the double has
+?C: the subnormals (denormals).
+?C:.
+?C:DOUBLE_STYLE_CRAY:
+?C: This symbol, if defined, indicates that the double is
+?C: the 64-bit CRAY mainframe format.
+?C:.
+?C:DOUBLE_STYLE_IBM:
+?C: This symbol, if defined, indicates that the double is
+?C: the 64-bit IBM mainframe format.
+?C:.
+?C:DOUBLE_STYLE_IEEE:
+?C: This symbol, if defined, indicates that the double is
+?C: the 64-bit IEEE 754.
+?C:.
+?C:DOUBLE_STYLE_VAX:
+?C: This symbol, if defined, indicates that the double is
+?C: the 64-bit VAX format D or G.
+?C:.
?LINT:known DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN
?LINT:known DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN
?LINT:known DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN
?LINT:known DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN
?LINT:known DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE
?LINT:known DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE
+?LINT:known DOUBLE_IS_VAX_F_FLOAT
+?LINT:known DOUBLE_IS_VAX_D_FLOAT
+?LINT:known DOUBLE_IS_VAX_G_FLOAT
+?LINT:known DOUBLE_IS_IBM_SINGLE_32_BIT
+?LINT:known DOUBLE_IS_IBM_DOUBLE_64_BIT
+?LINT:known DOUBLE_IS_CRAY_SINGLE_64_BIT
?LINT:known DOUBLE_IS_UNKNOWN_FORMAT
?H:#define DOUBLEKIND $doublekind /**/
?H:?DOUBLEKIND:#define DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN 1
?H:?DOUBLEKIND:#define DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN 6
?H:?DOUBLEKIND:#define DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE 7
?H:?DOUBLEKIND:#define DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE 8
+?H:?DOUBLEKIND:#define DOUBLE_IS_VAX_F_FLOAT 9
+?H:?DOUBLEKIND:#define DOUBLE_IS_VAX_D_FLOAT 10
+?H:?DOUBLEKIND:#define DOUBLE_IS_VAX_G_FLOAT 11
+?H:?DOUBLEKIND:#define DOUBLE_IS_IBM_SINGLE_32_BIT 12
+?H:?DOUBLEKIND:#define DOUBLE_IS_IBM_DOUBLE_64_BIT 13
+?H:?DOUBLEKIND:#define DOUBLE_IS_CRAY_SINGLE_64_BIT 14
?H:?DOUBLEKIND:#define DOUBLE_IS_UNKNOWN_FORMAT -1
?H:#$d_PRIfldbl PERL_PRIfldbl $sPRIfldbl /**/
?H:#$d_PRIgldbl PERL_PRIgldbl $sPRIgldbl /**/
?H:#$d_PRIGUldbl PERL_PRIGldbl $sPRIGUldbl /**/
?H:#$d_PRIEUldbl PERL_PRIEldbl $sPRIEUldbl /**/
?H:#$d_SCNfldbl PERL_SCNfldbl $sSCNfldbl /**/
+?H:#$d_double_has_inf DOUBLE_HAS_INF
+?H:#$d_double_has_nan DOUBLE_HAS_NAN
+?H:#$d_double_has_negative_zero DOUBLE_HAS_NEGATIVE_ZERO
+?H:#$d_double_has_subnormals DOUBLE_HAS_SUBNORMALS
+?H:#$d_double_style_cray DOUBLE_STYLE_CRAY
+?H:#$d_double_style_ibm DOUBLE_STYLE_IBM
+?H:#$d_double_style_ieee DOUBLE_STYLE_IEEE
+?H:#$d_double_style_vax DOUBLE_STYLE_VAX
?H:.
?T:yyy message saveccflags
?F:!try
printf("2\n");
exit(0);
}
+ if (b[0] == 0xCC && b[3] == 0xCC) {
+ /* VAX format F, 32-bit PDP-style mixed endian. */
+ printf("9\n");
+ exit(0);
+ }
+ if (b[0] == 0xC0 && b[3] == 0x9A) {
+ /* IBM single 32-bit */
+ printf("12\n");
+ exit(0);
+ }
#endif
#if DOUBLESIZE == 8
if (b[0] == 0x9A && b[7] == 0xBF) {
printf("8\n");
exit(0);
}
+ if (b[0] == 0xCC && b[7] == 0xCC) {
+ /* VAX format D, 64-bit PDP-style mixed endian. */
+ printf("10\n");
+ exit(0);
+ }
+ if (b[0] == 0xD9 && b[7] == 0x99) {
+ /* VAX format G, 64-bit PDP-style mixed endian. */
+ printf("11\n");
+ exit(0);
+ }
+ if (b[0] == 0xC0 && b[7] == 0x9A) {
+ /* IBM double 64-bit */
+ printf("13\n");
+ exit(0);
+ }
+ if (b[0] == 0xBF && b[7] == 0xCD) {
+ /* CRAY single 64-bit */
+ printf("14\n");
+ exit(0);
+ }
#endif
#if DOUBLESIZE == 16
if (b[0] == 0x9A && b[15] == 0xBF) {
exit(0);
}
#endif
- /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
+ /* Then there are old mainframe/miniframe formats like IBM and CRAY.
* Whether those environments can still build Perl is debatable. */
printf("-1\n"); /* unknown */
exit(0);
6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
-*) echo "Cannot figure out your double. You VAX, or something?" >&4 ;;
+9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
+10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
+11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
+12) echo "You have IBM short 32-bit doubles." >&4 ;;
+13) echo "You have IBM long 64-bit doubles." >&4 ;;
+14) echo "You have Cray single 64-bit doubles." >&4 ;;
+*) echo "Cannot figure out your double. You Cyber, or something?" >&4 ;;
+esac
+d_double_style_ieee=$undef
+d_double_style_vax=$undef
+d_double_style_ibm=$undef
+d_double_style_cray=$undef
+case "$doublekind" in
+1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
+9|10|11) d_double_style_vax=$define ;;
+12|13) d_double_style_ibm=$define ;;
+14) d_double_style_cray=$define ;;
+esac
+case "$d_double_style_ieee" in
+$define)
+ d_double_has_inf=$define
+ d_double_has_nan=$define
+ d_double_has_negative_zero=$define
+ d_double_has_subnormals=$define
+ ;;
+*)
+ d_double_has_inf=$undef
+ d_double_has_nan=$undef
+ d_double_has_negative_zero=$undef
+ d_double_has_subnormals=$undef
+ ;;
esac
$rm_try