[core] experimentally add --floatval=float failing Tests (mostly because of wrong tests): t/steps/auto_jit-01 (Wstat: 256 Tests: 50 Failed: 1) Failed test: 12 Non-zero exit status: 1 t/compilers/imcc/imcpasm/opt1 (Wstat: 256 Tests: 78 Failed: 1) Failed test: 75 Non-zero exit status: 1 t/op/arithmetics (Wstat: 1024 Tests: 30 Failed: 4) Failed tests: 8-9, 18-19 Non-zero exit status: 4 t/op/integer (Wstat: 256 Tests: 56 Failed: 1) Failed test: 33 Non-zero exit status: 1 t/op/number (Wstat: 1280 Tests: 56 Failed: 5) Failed tests: 1, 27, 32-33, 40 Non-zero exit status: 5 t/op/sprintf (Wstat: 0 Tests: 308 Failed: 17) Failed tests: 11-12, 14-15, 102, 104, 122-123, 162-165 167, 178-179, 185-186 t/op/sysinfo (Wstat: 512 Tests: 14 Failed: 2) Failed tests: 3-4 Non-zero exit status: 2 t/op/time (Wstat: 256 Tests: 7 Failed: 1) Failed test: 3 Non-zero exit status: 1 t/pmc/bigint (Wstat: 256 Tests: 44 Failed: 1) Failed test: 4 Non-zero exit status: 1 t/pmc/complex (Wstat: 139 Tests: 0 Failed: 0) Parse errors: Bad plan. You planned 467 tests but ran 0. t/pmc/float (Wstat: 4864 Tests: 61 Failed: 19) Failed tests: 4, 14, 44-53, 55-61 Non-zero exit status: 19 t/pmc/nci (Wstat: 512 Tests: 69 Failed: 2) Failed tests: 5-6 Non-zero exit status: 2 t/pmc/string (Wstat: 0 Tests: 164 Failed: 1) Failed test: 5 t/pmc/sub (Wstat: 256 Tests: 64 Failed: 1) Failed test: 40 Non-zero exit status: 1 t/pmc/timer (Wstat: 512 Tests: 6 Failed: 2) Failed tests: 4-5 Non-zero exit status: 2 t/native_pbc/number (Wstat: 512 Tests: 7 Failed: 2) Failed tests: 1-2 Non-zero exit status: 2 t/dynoplibs/myops (Wstat: 256 Tests: 10 Failed: 1) Failed test: 5 Non-zero exit status: 1 t/library/dumper (Wstat: 256 Tests: 26 Failed: 1) Failed test: 17 Non-zero exit status: 1 t/library/mt19937ar (Wstat: 256 Tests: 10 Failed: 1) Failed test: 10 Non-zero exit status: 1 t/library/pcre (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 t/library/yaml_dumper (Wstat: 256 Tests: 26 Failed: 1) Failed test: 17 Non-zero exit status: 1 t/tools/pbc_merge (Wstat: 256 Tests: 4 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=397, Tests=11203, 1677 wallclock secs ( 7.78 usr 3.80 sys + 499.64 cusr 495.17 csys = 1006.38 CPU) Result: FAIL make: *** [test] Error 1 Index: parrot-svn/compilers/imcc/optimizer.c =================================================================== --- parrot-svn.orig/compilers/imcc/optimizer.c +++ parrot-svn/compilers/imcc/optimizer.c @@ -916,7 +916,8 @@ IMCC_subst_constants(PARROT_INTERP, ARGM The value of '16' for NUMVAL_SIZE == 8 was one larger than the default FLOATVAL_FMT of '15' determined by Configure.pl. The reason for this difference, if there is one, should be documented. - The values of.18Lg and .31Lg are guesses. + The values of.18Lg and .31Lg are guesses. .7g is from + http://www.keil.com/support/docs/2191.htm */ #if NUMVAL_SIZE == 8 fmt = "%0.16g"; @@ -924,6 +925,8 @@ IMCC_subst_constants(PARROT_INTERP, ARGM fmt = "%0.18Lg"; #elif NUMVAL_SIZE == 16 fmt = "%0.31Lg"; +#elif NUMVAL_SIZE == 4 + fmt = "%0.7g"; #else fmt = FLOATVAL_FMT; /* Since it's not clear why this is needed, it's not clear what to Index: parrot-svn/include/parrot/packfile.h =================================================================== --- parrot-svn.orig/include/parrot/packfile.h +++ parrot-svn/include/parrot/packfile.h @@ -30,20 +30,22 @@ #define FLOATTYPE_12_NAME "x86 little endian 12 byte long double" #define FLOATTYPE_16 2 #define FLOATTYPE_16_NAME "IEEE-754 16 byte long double" +#define FLOATTYPE_4 3 +#define FLOATTYPE_4_NAME "IEEE-754 4-byte float" /* Supported until here. */ -#define FLOATTYPE_MAX 2 +#define FLOATTYPE_MAX 3 + /* Non IEEE-754 versions, yet unsupported. */ /* NaN difference, but patches welcome */ -#define FLOATTYPE_16MIPS 3 +#define FLOATTYPE_16MIPS 4 #define FLOATTYPE_16MIPS_NAME "MIPS 16 byte long double" /* See http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/share/man/info/en_US/a_doc_lib/aixprggd/genprogc/128bit_long_double_floating-point_datatype.htm */ -#define FLOATTYPE_16AIX 4 +#define FLOATTYPE_16AIX 5 #define FLOATTYPE_16AIX_NAME "AIX 16 byte long double" -/* IEEE-754 old and tiny, yet unsupported */ -#define FLOATTYPE_4 5 -#define FLOATTYPE_4_NAME "4-byte float" +#define FLOATTYPE_32 6 +#define FLOATTYPE_32_NAME "32-byte huge double" -#define TRACE_PACKFILE 0 +#define TRACE_PACKFILE 2 #if TRACE_PACKFILE /* Here we pass multipe args to a macro so the args may not be bracketed here! */ @@ -1030,7 +1032,11 @@ STRING * PF_fetch_string(PARROT_INTERP, __attribute__nonnull__(1) __attribute__nonnull__(3); +PARROT_WARN_UNUSED_RESULT +int PF_floattype_size(const int floattype); + PARROT_PURE_FUNCTION +PARROT_WARN_UNUSED_RESULT size_t PF_size_cstring(ARGIN(const char *s)) __attribute__nonnull__(1); @@ -1096,6 +1102,7 @@ opcode_t* PF_store_string(ARGOUT(opcode_ #define ASSERT_ARGS_PF_fetch_string __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(interp) \ || PARROT_ASSERT_ARG(cursor) +#define ASSERT_ARGS_PF_floattype_size __attribute__unused__ int _ASSERT_ARGS_CHECK = 0 #define ASSERT_ARGS_PF_size_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(s) #define ASSERT_ARGS_PF_size_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = 0 @@ -1163,6 +1170,15 @@ void fetch_buf_be_8( __attribute__nonnull__(2) FUNC_MODIFIES(*rb); +void fetch_buf_generic( + ARGOUT(unsigned char *rb), + ARGIN(const unsigned char *b), + const int size, + const int byteorder) + __attribute__nonnull__(1) + __attribute__nonnull__(2) + FUNC_MODIFIES(*rb); + void fetch_buf_le_12( ARGOUT(unsigned char *rb), ARGIN(const unsigned char *b)) @@ -1229,6 +1245,9 @@ opcode_t fetch_op_le(opcode_t w); #define ASSERT_ARGS_fetch_buf_be_8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(rb) \ || PARROT_ASSERT_ARG(b) +#define ASSERT_ARGS_fetch_buf_generic __attribute__unused__ int _ASSERT_ARGS_CHECK = \ + PARROT_ASSERT_ARG(rb) \ + || PARROT_ASSERT_ARG(b) #define ASSERT_ARGS_fetch_buf_le_12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(rb) \ || PARROT_ASSERT_ARG(b) Index: parrot-svn/config/auto/format.pm =================================================================== --- parrot-svn.orig/config/auto/format.pm +++ parrot-svn/config/auto/format.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2003, Parrot Foundation. +# Copyright (C) 2001-2003, 2009 Parrot Foundation. # $Id: format.pm 36833 2009-02-17 20:09:26Z allison $ =head1 NAME @@ -41,6 +41,7 @@ sub runstep { _set_floatvalmaxmin($conf); + $conf->cc_clean(); return 1; } @@ -97,8 +98,9 @@ sub _set_intvalmaxmin { if ( $@ ) { $ivmin = '0'; $ivmax = '0'; + $conf->data->set( intvalmin => $ivmin ); + $conf->data->set( intvalmax => $ivmax ); } - } sub _set_floatvalfmt_nvsize { @@ -124,6 +126,10 @@ sub _set_floatvalfmt_nvsize { die qq{Configure.pl: Can't find a printf-style format specifier for type '$nv'\n}; } } + elsif ( $nv eq "float" ) { + $nvsize = 4; + $nvformat = "%.7g"; + } else { die qq{Configure.pl: Can't find a printf-style format specifier for type '$nv'\n}; } @@ -146,12 +152,13 @@ sub _set_floatvalmaxmin { $nvmax = 'DBL_MAX'; } elsif ( $nv eq "long double" ) { - - # Stay way from long double for now (it may be 64 or 80 bits) - # die "long double not supported at this time, use double."; $nvmin = 'LDBL_MIN'; $nvmax = 'LDBL_MAX'; } + elsif ( $nv eq "float" ) { + $nvmin = 'FLOAT_MIN'; + $nvmax = 'FLOAT_MAX'; + } else { die qq{Configure.pl: Can't find limits for type '$nv'\n}; } @@ -164,6 +171,8 @@ sub _set_floatvalmaxmin { if ( $@ ) { $nvmin = '0'; $nvmax = '0'; + $conf->data->set( floatvalmin => $nvmin ); + $conf->data->set( floatvalmax => $nvmax ); } } Index: parrot-svn/src/byteorder.c =================================================================== --- parrot-svn.orig/src/byteorder.c +++ parrot-svn/src/byteorder.c @@ -312,7 +312,7 @@ fetch_buf_le_8(ARGOUT(unsigned char *rb) =item C -Converts a 12-byte little-endian buffer C into a big-endian buffer C. +Converts a 12-byte little-endian buffer C into a big-endian buffer C. =cut @@ -344,7 +344,7 @@ fetch_buf_le_12(ARGOUT(unsigned char *rb =item C -Converts a 12-byte big-endian buffer C into a little-endian buffer C. +Converts a 12-byte big-endian buffer C into a little-endian buffer C. =cut @@ -376,7 +376,7 @@ fetch_buf_be_12(ARGOUT(unsigned char *rb =item C -Converts a 16-byte little-endian buffer C into a big-endian buffer C. +Converts a 16-byte little-endian buffer C into a big-endian buffer C. =cut @@ -412,7 +412,7 @@ fetch_buf_le_16(ARGOUT(unsigned char *rb =item C -Converts a 16-byte big-endian buffer C into a little-endian buffer C. +Converts a 16-byte big-endian buffer C into a little-endian buffer C. =cut @@ -448,7 +448,7 @@ fetch_buf_be_16(ARGOUT(unsigned char *rb =item C -Converts a 32-byte little-endian buffer C into a big-endian buffer C. +Converts a 32-byte little-endian buffer C into a big-endian buffer C. =cut @@ -500,7 +500,7 @@ fetch_buf_le_32(ARGOUT(unsigned char *rb =item C -Converts a 32-byte big-endian buffer C into a little-endian buffer C. +Converts a 32-byte big-endian buffer C into a little-endian buffer C. =cut @@ -550,12 +550,75 @@ fetch_buf_be_32(ARGOUT(unsigned char *rb /* +=item C + +Generic byteorder conversion from C to C, +with given bytesize and source endian-ness. + +This is used for the numeric converters in F + +=cut + +*/ + +void +fetch_buf_generic(ARGOUT(unsigned char *rb), + ARGIN(const unsigned char *b), + const int size, + const int byteorder) +{ + ASSERT_ARGS(fetch_buf_generic) + + /* 0==0 or 1==1 */ + if (byteorder == PARROT_BIGENDIAN) { + memcpy(rb, b, size); + } + else { + switch (size) { +#if PARROT_BIGENDIAN + case 4: + fetch_buf_le_4(rb, b); break; + case 8: + fetch_buf_le_8(rb, b); break; + case 12: + fetch_buf_le_12(rb, b); break; + case 16: + fetch_buf_le_16(rb, b); break; + case 32: + fetch_buf_le_32(rb, b); break; +#else + case 4: + fetch_buf_be_4(rb, b); break; + case 8: + fetch_buf_be_8(rb, b); break; + case 12: + fetch_buf_be_12(rb, b); break; + case 16: + fetch_buf_be_16(rb, b); break; + case 32: + fetch_buf_be_32(rb, b); break; +#endif + default: + exit_fatal(1, + "fetch_buf_generic: unsupported size=%d, byteorder=%d, " + "PARROT_BIGENDIAN=%d\n", + size, byteorder, PARROT_BIGENDIAN); + break; + } + } +} + + +/* + =back =head1 HISTORY Initial version by Melvin on 2002/05/01 +Extended by Reini Urban 2009 + =cut */ Index: parrot-svn/src/packfile.c =================================================================== --- parrot-svn.orig/src/packfile.c +++ parrot-svn/src/packfile.c @@ -1237,18 +1237,16 @@ PackFile_set_header(ARGOUT(PackFile_Head header->bc_minor = PARROT_PBC_MINOR; #if NUMVAL_SIZE == 8 header->floattype = FLOATTYPE_8; -#else -# if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN +#elif (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN header->floattype = FLOATTYPE_12; -# else -# if (NUMVAL_SIZE == 16) +#elif NUMVAL_SIZE == 16 header->floattype = FLOATTYPE_16; -# else +#elif NUMVAL_SIZE == 4 + header->floattype = FLOATTYPE_4; +#else exit_fatal(1, "PackFile_set_header: Unsupported floattype NUMVAL_SIZE=%d," " PARROT_BIGENDIAN=%d\n", NUMVAL_SIZE, PARROT_BIGENDIAN ? "big-endian" : "little-endian"); -# endif -# endif #endif } @@ -4654,8 +4652,8 @@ PackFile_fixup_subs(PARROT_INTERP, pbc_a =head1 HISTORY -Parrot_readbc and Parrot_loadbc renamed. Trace macros, long double and -64-bit conversion work by Reini Urban 2009. +Parrot_readbc and Parrot_loadbc renamed. Trace macros, long double, +float and 64-bit conversion work by Reini Urban 2009. Rework by Melvin; new bytecode format, make bytecode portable. (Do endian conversion and wordsize transforms on the fly.) Index: parrot-svn/src/packfile/pf_items.c =================================================================== --- parrot-svn.orig/src/packfile/pf_items.c +++ parrot-svn/src/packfile/pf_items.c @@ -46,7 +46,7 @@ static void cvt_num12_num16( __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num12_num16_le( +static void cvt_num12_num4( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) @@ -60,13 +60,6 @@ static void cvt_num12_num8( __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num12_num8_le( - ARGOUT(unsigned char *dest), - ARGIN(unsigned char *src)) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*dest); - static void cvt_num16_num12( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) @@ -74,7 +67,7 @@ static void cvt_num16_num12( __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num16_num12_be( +static void cvt_num16_num4( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) @@ -88,49 +81,42 @@ static void cvt_num16_num8( __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num16_num8_be( +static void cvt_num4_num12( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num16_num8_le( - ARGOUT(unsigned char *dest), - ARGIN(unsigned char *src)) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*dest); - -static void cvt_num8_num12( +static void cvt_num4_num16( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num8_num12_be( +static void cvt_num4_num8( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num8_num16( +static void cvt_num8_num12( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num8_num16_be( +static void cvt_num8_num16( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) __attribute__nonnull__(2) FUNC_MODIFIES(*dest); -static void cvt_num8_num16_le( +static void cvt_num8_num4( ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) __attribute__nonnull__(1) @@ -164,43 +150,37 @@ static opcode_t fetch_op_mixed_le(ARGIN( #define ASSERT_ARGS_cvt_num12_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num12_num16_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num12_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) #define ASSERT_ARGS_cvt_num12_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num12_num8_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \ - PARROT_ASSERT_ARG(dest) \ - || PARROT_ASSERT_ARG(src) #define ASSERT_ARGS_cvt_num16_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num16_num12_be __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num16_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) #define ASSERT_ARGS_cvt_num16_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num16_num8_be __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num4_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num16_num8_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num4_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num8_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num4_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num8_num12_be __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num8_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) #define ASSERT_ARGS_cvt_num8_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num8_num16_be __attribute__unused__ int _ASSERT_ARGS_CHECK = \ - PARROT_ASSERT_ARG(dest) \ - || PARROT_ASSERT_ARG(src) -#define ASSERT_ARGS_cvt_num8_num16_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \ +#define ASSERT_ARGS_cvt_num8_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(dest) \ || PARROT_ASSERT_ARG(src) #define ASSERT_ARGS_fetch_op_be_4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ @@ -239,6 +219,7 @@ static opcode_t fetch_op_mixed_le(ARGIN( * Floattype 0 = IEEE-754 8 byte double * Floattype 1 = x86 little endian 12 byte long double * Floattype 2 = IEEE-754 16 byte long double + * Floattype 3 = IEEE-754 4 byte single float * */ @@ -254,6 +235,7 @@ Tested ok. */ +#if NUMVAL_SIZE == 8 static void cvt_num12_num8(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { @@ -331,127 +313,6 @@ nul: /* -=item C - -Converts IEEE 754 LE 16-byte long double to i386 LE 12-byte long double . -See http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml - -Untested. - -=cut - -*/ - -#if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN -static void -cvt_num16_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) -{ - ASSERT_ARGS(cvt_num16_num12) - - /* - 16-byte double (128 bits): - sign 1 bit 127 - exp 15 bits 126-112 - man 112 bits 111-0 - to 12-byte double (96 bits): - sign 1 bit 95 - exp 15 bits 94-80 - man 80 bits 79-0 - - +-------+-------+-------+-------+-------+-------+--...--+-------+ - |src[15]|src[14]|src[13]|src[12]|src[11]|src[10]| ... |src[0] | - S| E | F | - +-------+-------+-------+-------+-------+-------+--...--+-------+ - 1|<-----15----->|<----------------112 bits--------------------->| - <---------------------------128 bits----------------------------> - 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) - - +-------+-------+-------+-------+-------+-------+--...--+-------+ - |dest[11]dest[10]dest[9]|dest[8]|dest[7]|dest[6]| ... |dest[0]| - S| E | F | - +-------+-------+-------+-------+-------+-------+--...--+-------+ - 1|<-----15----->|<----------------80 bits---------------------->| - <----------------------------96 bits----------------------------> - 12-byte LONG DOUBLE FLOATING-POINT (i386 special) - - */ - - memset(dest, 0, 12); - /* simply copy over sign + exp */ - TRACE_PRINTF_2((" cvt_num16_num12: sign+exp=0x%2x\n", src[15])); - dest[11] = src[15]; - dest[12] = src[14]; - /* and trunc the rest */ - memcpy(&dest[10], &src[13], 10); - TRACE_PRINTF_2((" cvt_num16_num12: mantissa=0x%10x, double=%lf\n", - src[13], (long double)*dest)); -} -#endif - -/* - -=item C - -Converts i386 LE 12-byte long double to IEEE 754 LE 16-byte long double. - -Untested. -Fallback 12->8->16 disabled. - -=cut - -*/ - -#if (NUMVAL_SIZE == 16) -static void -cvt_num12_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) -{ - ASSERT_ARGS(cvt_num12_num16) -# if 0 - unsigned char b[8]; - cvt_num12_num8(b, src); - cvt_num8_num16(dest, b); -# endif - /* - 12-byte double (96 bits): - sign 1 bit 95 - exp 15 bits 94-80 - man 80 bits 79-0 - to 16-byte double (128 bits): - sign 1 bit 127 - exp 15 bits 126-112 - man 112 bits 111-0 - - +-------+-------+-------+-------+-------+-------+--...--+-------+ - |src[11]|src[10]| src[9]| src[8]| src[7]| src[6]| ... | src[0]| - S| E | F | - +-------+-------+-------+-------+-------+-------+--...--+-------+ - 1|<-----15----->|<----------------80 bits---------------------->| - <----------------------------96 bits----------------------------> - 12-byte LONG DOUBLE FLOATING-POINT (i386 special) - - +-------+-------+-------+-------+-------+-------+--...--+-------+ - |dest[15]dest[14]dest[13]dest[12]dest[11]dest[10] ... |dest[0]| - S| E | F | - +-------+-------+-------+-------+-------+-------+--...--+-------+ - 1|<-----15----->|<----------------112 bits--------------------->| - <---------------------------128 bits----------------------------> - 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) - - */ - - memset(dest, 0, 16); - /* simply copy over sign + exp */ - TRACE_PRINTF_2((" cvt_num12_num16: sign+exp=0x%2x\n", src[11])); - dest[15] = src[11]; - dest[14] = src[12]; - /* and trunc the rest */ - memcpy(&dest[13], &src[9], 10); - TRACE_PRINTF_2((" cvt_num12_num15: mantissa=0x%10x, double=%lf\n", - src[19], (long double)*dest)); -} -#endif -/* - =item C Converts IEEE 754 16-byte long double to IEEE 754 8 byte double. @@ -554,12 +415,11 @@ cvt_num16_num8(ARGOUT(unsigned char *des dest[0] |= src[1] >> 3; } } - /* -=item C +=item C -Converts IEEE 754 8-byte double to IEEE 754 16 byte long double. +Converts IEEE 754 4-byte single-float to IEEE 754 8 byte double. Untested. @@ -567,28 +427,30 @@ Untested. */ -#if (NUMVAL_SIZE == 16) static void -cvt_num8_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num4_num8(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num8_num16) + ASSERT_ARGS(cvt_num4_num8) /* The compiler can do this for us */ - long double ld; double d; - memcpy(&d, src, 8); - ld = (long double)d; /* TODO: test compiler cast */ - /*TRACE_PRINTF_2((" cvt_num8_num16: d=%f, ld=%lf\n", d, ld));*/ - memcpy(dest, &ld, 16); + float f; + + memcpy(&f, src, 4); + d = (double)f; /* TODO: test compiler cast */ + TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%f\n", f, d));*/ + memcpy(dest, &d, 8); } + #endif /* -=item C +=item C -Converts i386 8-byte double to i386 12 byte long double. +Converts IEEE 754 LE 16-byte long double to i386 LE 12-byte long double . +See http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml -Tested ok. +Untested. =cut @@ -596,24 +458,55 @@ Tested ok. #if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN static void -cvt_num8_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num16_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num8_num12) - long double ld; - double d; - memcpy(&d, src, 8); - ld = (long double)d; /* compiler cast */ - /*TRACE_PRINTF_2((" cvt_num8_num12: ld=%lf, d=%f\n", ld, d));*/ - memcpy(dest, &ld, 12); + ASSERT_ARGS(cvt_num16_num12) + + /* + 16-byte double (128 bits): + sign 1 bit 127 + exp 15 bits 126-112 + man 112 bits 111-0 + to 12-byte double (96 bits): + sign 1 bit 95 + exp 15 bits 94-80 + man 80 bits 79-0 + + +-------+-------+-------+-------+-------+-------+--...--+-------+ + |src[15]|src[14]|src[13]|src[12]|src[11]|src[10]| ... |src[0] | + S| E | F | + +-------+-------+-------+-------+-------+-------+--...--+-------+ + 1|<-----15----->|<----------------112 bits--------------------->| + <---------------------------128 bits----------------------------> + 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) + + +-------+-------+-------+-------+-------+-------+--...--+-------+ + |dest[11]dest[10]dest[9]|dest[8]|dest[7]|dest[6]| ... |dest[0]| + S| E | F | + +-------+-------+-------+-------+-------+-------+--...--+-------+ + 1|<-----15----->|<----------------80 bits---------------------->| + <----------------------------96 bits----------------------------> + 12-byte LONG DOUBLE FLOATING-POINT (i386 special) + + */ + + memset(dest, 0, 12); + /* simply copy over sign + exp */ + TRACE_PRINTF_2((" cvt_num16_num12: sign+exp=0x%2x\n", src[15])); + dest[11] = src[15]; + dest[12] = src[14]; + /* and trunc the rest */ + memcpy(&dest[10], &src[13], 10); + TRACE_PRINTF_2((" cvt_num16_num12: mantissa=0x%10x, double=%lf\n", + src[13], (long double)*dest)); } -#endif /* -=item C +=item C -Converts a big-endian IEEE 754 8-byte double to i386 LE 12-byte long double. +Converts i386 8-byte double to i386 12 byte long double. Tested ok. @@ -621,23 +514,23 @@ Tested ok. */ -#if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN static void -cvt_num8_num12_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num8_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num8_num12_be) - unsigned char b[8]; - fetch_buf_be_8(b, src); - /*TRACE_PRINTF_2((" cvt_num8_num12_be: 0x%8x\n", b));*/ - cvt_num8_num12(dest, b); + ASSERT_ARGS(cvt_num8_num12) + long double ld; + double d; + memcpy(&d, src, 8); + ld = (long double)d; /* compiler cast */ + /*TRACE_PRINTF_2((" cvt_num8_num12: ld=%lf, d=%f\n", ld, d));*/ + memcpy(dest, &ld, 12); } -#endif /* -=item C +=item C -Converts a little-endian IEEE 754 8-byte double to big-endian 16-byte long double. +Converts IEEE 754 4-byte single-float to ix86 12 byte double. Untested. @@ -645,72 +538,89 @@ Untested. */ -#if (NUMVAL_SIZE == 16) && PARROT_BIGENDIAN static void -cvt_num8_num16_le(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num4_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num8_num16_le) - unsigned char b[8]; - fetch_buf_be_8(b, src); /* TODO test endianize */ - TRACE_PRINTF_2((" cvt_num8_num16_le: 0x%8x\n", b)); - cvt_num8_num16(dest, b); + ASSERT_ARGS(cvt_num4_num12) + /* The compiler can do this for us */ + long double ld; + float f; + + memcpy(&f, src, 4); + ld = (long double)f; /* TODO: test compiler cast */ + TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%lf\n", f, ld));*/ + memcpy(dest, &ld, 12); } + #endif /* -=item C +=item C -Converts a little-endian 12-byte double to big-endian 16-byte long double. +Converts i386 LE 12-byte long double to IEEE 754 LE 16-byte long double. Untested. +Fallback 12->8->16 disabled. =cut */ -#if (NUMVAL_SIZE == 16) && PARROT_BIGENDIAN +#if NUMVAL_SIZE == 16 static void -cvt_num12_num16_le(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num12_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num12_num16_le) - unsigned char b[12]; - fetch_buf_be_12(b, src); /* TODO test endianize */ - TRACE_PRINTF_2((" cvt_num12_num16_le: 0x%8x\n", b)); - cvt_num12_num16(dest, b); -} -#endif - -/* - -=item C - -Converts a little-endian 12-byte i386 long double into a IEEE 754 8-byte double. + ASSERT_ARGS(cvt_num12_num16) +# if 0 + unsigned char b[8]; + cvt_num12_num8(b, src); + cvt_num8_num16(dest, b); +# endif + /* + 12-byte double (96 bits): + sign 1 bit 95 + exp 15 bits 94-80 + man 80 bits 79-0 + to 16-byte double (128 bits): + sign 1 bit 127 + exp 15 bits 126-112 + man 112 bits 111-0 -Untested. + +-------+-------+-------+-------+-------+-------+--...--+-------+ + |src[11]|src[10]| src[9]| src[8]| src[7]| src[6]| ... | src[0]| + S| E | F | + +-------+-------+-------+-------+-------+-------+--...--+-------+ + 1|<-----15----->|<----------------80 bits---------------------->| + <----------------------------96 bits----------------------------> + 12-byte LONG DOUBLE FLOATING-POINT (i386 special) -=cut + +-------+-------+-------+-------+-------+-------+--...--+-------+ + |dest[15]dest[14]dest[13]dest[12]dest[11]dest[10] ... |dest[0]| + S| E | F | + +-------+-------+-------+-------+-------+-------+--...--+-------+ + 1|<-----15----->|<----------------112 bits--------------------->| + <---------------------------128 bits----------------------------> + 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) -*/ + */ -#if PARROT_BIGENDIAN -static void -cvt_num12_num8_le(ARGOUT(unsigned char *dest), ARGIN(unsigned char *src)) -{ - ASSERT_ARGS(cvt_num12_num8_le) - unsigned char b[12]; - fetch_buf_le_12(b, src); /* TODO test endianize */ - TRACE_PRINTF_2((" cvt_num12_num8_le: 0x%12x\n", b)); - cvt_num12_num8(dest, b); + memset(dest, 0, 16); + /* simply copy over sign + exp */ + TRACE_PRINTF_2((" cvt_num12_num16: sign+exp=0x%2x\n", src[11])); + dest[15] = src[11]; + dest[14] = src[12]; + /* and trunc the rest */ + memcpy(&dest[13], &src[9], 10); + TRACE_PRINTF_2((" cvt_num12_num15: mantissa=0x%10x, double=%lf\n", + src[19], (long double)*dest)); } -#endif /* -=item C +=item C -Converts a little-endian IEEE 754 intel 16-byte long double into a -big-endian IEEE 754 8-byte double. +Converts IEEE 754 8-byte double to IEEE 754 16 byte long double. Untested. @@ -718,23 +628,24 @@ Untested. */ -#if PARROT_BIGENDIAN static void -cvt_num16_num8_le(ARGOUT(unsigned char *dest), ARGIN(unsigned char *src)) +cvt_num8_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num16_num8_le) - unsigned char b[16]; - fetch_buf_le_16(b, src); - TRACE_PRINTF_2((" cvt_num16_num8_le: 0x%16x\n", b)); - cvt_num16_num8(dest, b); + ASSERT_ARGS(cvt_num8_num16) + /* The compiler can do this for us */ + long double ld; + double d; + memcpy(&d, src, 8); + ld = (long double)d; /* TODO: test compiler cast */ + /*TRACE_PRINTF_2((" cvt_num8_num16: d=%f, ld=%lf\n", d, ld));*/ + memcpy(dest, &ld, 16); } -#endif /* -=item C +=item C -Converts a big-endian IEEE 754 16-byte long double into a IEEE 754 8-byte double. +Converts IEEE 754 4-byte single-float to IEEE 754 16 byte long double. Untested. @@ -742,23 +653,28 @@ Untested. */ -#if !PARROT_BIGENDIAN static void -cvt_num16_num8_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num4_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num16_num8_be) - unsigned char b[16]; - fetch_buf_be_16(b, src); - TRACE_PRINTF_2((" cvt_num16_num8_be: 0x%16x\n", b)); - cvt_num16_num8(dest, b); + ASSERT_ARGS(cvt_num4_num8) + /* The compiler can do this for us */ + long double ld; + float f; + + memcpy(&f, src, 4); + ld = (long double)f; /* TODO: test compiler cast */ + TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%lf\n", f, ld));*/ + memcpy(dest, &ld, 16); } + #endif /* -=item C +=item C -Converts a big-endian IEEE 754 16-byte long double into a 12-byte i386 long double. +Converts IEEE 754 8-byte double to IEEE 754 4-byte double. +See also http://www.mrob.com/pub/math/floatformats.html Untested. @@ -766,42 +682,108 @@ Untested. */ -#if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN +#if NUMVAL_SIZE == 4 static void -cvt_num16_num12_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num8_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num16_num12_be) - unsigned char b[16]; - fetch_buf_be_16(b, src); - TRACE_PRINTF_2((" cvt_num16_num12_be: 0x%16x\n", b)); - cvt_num16_num12(dest, b); -} -#endif + ASSERT_ARGS(cvt_num8_num4) + /* if we are lucky and this cpu can do double */ +#if DOUBLE_SIZE == 8 -/* + double d; + float f; -=item C + memcpy(&d, src, 8); + f = (float)d; /* compiler cast */ + memcpy(dest, &f, 4); -Converts a big-endian IEEE 754 8-byte double to little-endian IEEE 754 16 byte -long double. +#else -Untested. + int expo, i, s; +# ifdef __LCC__ + int expo2; +# endif -=cut + /* + 8-byte double (64 bits): + sign 1 bit 63 + exp 11 bits 62-52 + man 52 bits 51-0 + to 4-byte double (32 bits): + sign 1 bit 31 + exp 8 bits 30-23 + man 23 bits 22-0 -*/ + +-------+-------+-------+-------+-------+-------+-------+-------+ + |src[7] | src[6]| src[5]| src[4]| src[3]|src[2] |src[1] |src[0] | + S| E | F | + +-------+-------+-------+-------+-------+-------+-------+-------+ + 1|<---11--->|<------|-------|-------|------52 bits------------->| + <----------------------------64 bits----------------------------> + 8-byte DOUBLE FLOATING-POINT + + +-------+-------+-------+-------+ + |dest[3]|dest[2]|dest[1]|dest[0]| + S| E | F | + +-------+-------+-------+-------+ + 1|<--8-->|<------|--23bit|----->| + <------------32 bits------------> + 4-byte single float + */ + + memset(dest, 0, 4); + /* exponents 11 -> 7 bits */ + s = src[7] & 0x80; /* sign */ + + expo = (((src[7] & 0x7f)<< 8) | (src[6] & 0xf0)); /* 11110000 */ + if (expo == 0) { +nul: + if (s) + dest[3] |= 0x80; + return; + } +# ifdef __LCC__ + expo2 = expo - 1023; + expo = expo2; +# else + expo -= 1023; /* - bias 8byte */ +# endif + expo += 127; /* + bias 4byte */ + if (expo <= 0) /* underflow */ + goto nul; + if (expo > 0x7ff) { /* inf/nan */ + dest[3] = 0x7f; + dest[2] = src[7] == 0xc0 ? 0xf8 : 0xf0 ; /* XXX */ + goto nul; + } + expo <<= 4; + dest[2] = (expo & 0x80); + dest[3] = (expo & 0x7f00) >> 8; + if (s) + dest[3] |= 0x80; + /* copy the mantissa: 52 bits => 23 bits */ + dest[2] |= src[6] >> 4; + dest[1] |= src[6] << 7 | src[5] >> 4; + dest[0] |= src[5] << 4 | src[4] >> 4; +#endif +} -#if (NUMVAL_SIZE == 16) && !PARROT_BIGENDIAN static void -cvt_num8_num16_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +cvt_num12_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) { - ASSERT_ARGS(cvt_num8_num16_be) - unsigned char b[8]; - fetch_buf_be_8(b, src); - cvt_num8_num16(dest, b); + exit_fatal(1, "Unsupported floattype conversion " + "12-byte long double to 4-byte float\n"); +} + +static void +cvt_num16_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) +{ + exit_fatal(1, "Unsupported floattype conversion " + "16-byte long double to 4-byte float\n"); } #endif + #if 0 /* @@ -1177,7 +1159,8 @@ PF_fetch_number(ARGIN_NULLOK(PackFile *p /* When we have alignment all squared away we don't need * to use memcpy() for native byteorder. */ FLOATVAL f; - double d; + int need_endianize; + int floatsize; if (!pf || !pf->fetch_nv) { TRACE_PRINTF(("PF_fetch_number: Native [%d bytes]\n", sizeof (FLOATVAL))); @@ -1187,36 +1170,27 @@ PF_fetch_number(ARGIN_NULLOK(PackFile *p sizeof (opcode_t); return f; } + f = (FLOATVAL) 0; - TRACE_PRINTF(("PF_fetch_number at 0x%x: Converting...\n", OFFS(*stream))); - /* 12->8 has a messy cast. */ - if (NUMVAL_SIZE == 8 && pf->header->floattype == FLOATTYPE_12) { - (pf->fetch_nv)((unsigned char *)&d, (const unsigned char *) *stream); - f = d; - TRACE_PRINTF_VAL(("PF_fetch_number: cast %f\n", f)); + need_endianize = pf->header->byteorder != PARROT_BIGENDIAN; + floatsize = PF_floattype_size(pf->header->floattype); + TRACE_PRINTF(("PF_fetch_number at 0x%x: byteorder=%d, floatsize=%d\n", + OFFS(*stream), pf->header->byteorder, floatsize)); + + if (need_endianize) { + unsigned char b[32]; /* max. floatvalsize */ + /* generic endianizer */ + fetch_buf_generic(b, (const unsigned char *) *stream, + PF_floattype_size(pf->header->floattype), + pf->header->byteorder); + (pf->fetch_nv)((unsigned char *)&f, b); + TRACE_PRINTF_VAL(("PF_fetch_number: %f *endianized*\n", f)); } else { (pf->fetch_nv)((unsigned char *)&f, (const unsigned char *) *stream); TRACE_PRINTF_VAL(("PF_fetch_number: %f\n", f)); } - if (pf->header->floattype == FLOATTYPE_8) { - *((const unsigned char **) (stream)) += 8; - } - else if (pf->header->floattype == FLOATTYPE_12) { - *((const unsigned char **) (stream)) += 12; - } - else if (pf->header->floattype == FLOATTYPE_16) { - *((const unsigned char **) (stream)) += 16; - } - else if (pf->header->floattype == FLOATTYPE_16MIPS) { - *((const unsigned char **) (stream)) += 16; - } - else if (pf->header->floattype == FLOATTYPE_16AIX) { - *((const unsigned char **) (stream)) += 16; - } - else if (pf->header->floattype == FLOATTYPE_4) { - *((const unsigned char **) (stream)) += 4; - } + *((const unsigned char **) (stream)) += floatsize; return f; } @@ -1477,6 +1451,7 @@ Returns store size of a C-string in C + +Returns the numval size in bytes for the given internal floattype +- usually from Cheader->floattype>. + +=cut + +*/ + +PARROT_CONST_FUNCTION +int +PF_floattype_size(const int floattype) +{ + ASSERT_ARGS(PF_floattype_size) + + switch (floattype) { + case FLOATTYPE_4: return 4; + case FLOATTYPE_8: return 8; + case FLOATTYPE_12: return 12; + case FLOATTYPE_16: return 16; + case FLOATTYPE_16AIX: return 16; + case FLOATTYPE_16MIPS: return 16; + case FLOATTYPE_32: return 32; + default: + exit_fatal(1, "PF_floattype_size: Unsupported floattype=%d\n", + floattype); + return 0; + } +} + +/* + =item C Assigns transform functions to the vtable. @@ -1518,23 +1525,41 @@ PackFile_assign_transforms(ARGMOD(PackFi pf->fetch_iv = pf->fetch_op; switch (pf->header->floattype) { -# if NUMVAL_SIZE == 8 +# if NUMVAL_SIZE == 4 + case FLOATTYPE_4: + pf->fetch_nv = fetch_buf_le_4; + break; + case FLOATTYPE_8: + pf->fetch_nv = cvt_num8_num4; + break; + case FLOATTYPE_12: + pf->fetch_nv = cvt_num12_num4; + break; + case FLOATTYPE_16: + pf->fetch_nv = cvt_num16_num4; + break; +# elif NUMVAL_SIZE == 8 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num8; + break; case FLOATTYPE_8: pf->fetch_nv = fetch_buf_le_8; break; case FLOATTYPE_12: - pf->fetch_nv = cvt_num12_num8_le; + pf->fetch_nv = cvt_num12_num8; break; case FLOATTYPE_16: - pf->fetch_nv = cvt_num16_num8_le; + pf->fetch_nv = cvt_num16_num8; + break; +# elif NUMVAL_SIZE == 16 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num16; break; -# endif -# if NUMVAL_SIZE == 16 case FLOATTYPE_8: - pf->fetch_nv = cvt_num8_num16_le; + pf->fetch_nv = cvt_num8_num16; break; case FLOATTYPE_12: - pf->fetch_nv = cvt_num12_num16_le; + pf->fetch_nv = cvt_num12_num16; break; case FLOATTYPE_16: pf->fetch_nv = fetch_buf_le_16; @@ -1557,7 +1582,22 @@ PackFile_assign_transforms(ARGMOD(PackFi pf->fetch_iv = pf->fetch_op; switch (pf->header->floattype) { -# if NUMVAL_SIZE == 8 +# if NUMVAL_SIZE == 4 + case FLOATTYPE_4: + break; + case FLOATTYPE_8: + pf->fetch_nv = cvt_num8_num4; + break; + case FLOATTYPE_12: + pf->fetch_nv = cvt_num12_num4; + break; + case FLOATTYPE_16: + pf->fetch_nv = cvt_num16_num4; + break; +# elif NUMVAL_SIZE == 8 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num8; + break; case FLOATTYPE_8: /* native */ break; case FLOATTYPE_12: @@ -1566,8 +1606,10 @@ PackFile_assign_transforms(ARGMOD(PackFi case FLOATTYPE_16: pf->fetch_nv = cvt_num16_num8; break; -# endif -# if NUMVAL_SIZE == 16 +# elif NUMVAL_SIZE == 16 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num16; + break; case FLOATTYPE_8: pf->fetch_nv = cvt_num8_num16; break; @@ -1598,7 +1640,23 @@ PackFile_assign_transforms(ARGMOD(PackFi pf->fetch_iv = pf->fetch_op; switch (pf->header->floattype) { -# if NUMVAL_SIZE == 8 +# if NUMVAL_SIZE == 4 + case FLOATTYPE_4: + pf->fetch_nv = fetch_buf_be_4; + break; + case FLOATTYPE_8: + pf->fetch_nv = cvt_num8_num4; + break; + case FLOATTYPE_12: + exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); + break; + case FLOATTYPE_16: + pf->fetch_nv = cvt_num16_num4; + break; +# elif NUMVAL_SIZE == 8 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num8; + break; case FLOATTYPE_8: pf->fetch_nv = fetch_buf_be_8; break; @@ -1606,23 +1664,27 @@ PackFile_assign_transforms(ARGMOD(PackFi exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); break; case FLOATTYPE_16: - pf->fetch_nv = cvt_num16_num8_be; + pf->fetch_nv = cvt_num16_num8; + break; +# elif NUMVAL_SIZE == 12 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num12; break; -# endif -# if NUMVAL_SIZE == 12 case FLOATTYPE_8: - pf->fetch_nv = cvt_num8_num12_be; + pf->fetch_nv = cvt_num8_num12; break; case FLOATTYPE_12: exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); break; case FLOATTYPE_16: - pf->fetch_nv = cvt_num16_num12_be; + pf->fetch_nv = cvt_num16_num12; + break; +# elif NUMVAL_SIZE == 16 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num16; break; -# endif -# if NUMVAL_SIZE == 16 case FLOATTYPE_8: - pf->fetch_nv = cvt_num8_num16_be; + pf->fetch_nv = cvt_num8_num16; break; case FLOATTYPE_12: exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); @@ -1648,7 +1710,22 @@ PackFile_assign_transforms(ARGMOD(PackFi pf->fetch_iv = pf->fetch_op; switch (pf->header->floattype) { -# if NUMVAL_SIZE == 8 +# if NUMVAL_SIZE == 4 + case FLOATTYPE_4: /* native */ + break; + case FLOATTYPE_8: + pf->fetch_nv = cvt_num8_num4; + break; + case FLOATTYPE_12: + pf->fetch_nv = cvt_num12_num4; + break; + case FLOATTYPE_16: + pf->fetch_nv = cvt_num16_num4; + break; +# elif NUMVAL_SIZE == 8 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num8; + break; case FLOATTYPE_8: /* native */ break; case FLOATTYPE_12: @@ -1657,8 +1734,10 @@ PackFile_assign_transforms(ARGMOD(PackFi case FLOATTYPE_16: pf->fetch_nv = cvt_num16_num8; break; -# endif -# if NUMVAL_SIZE == 12 +# elif NUMVAL_SIZE == 12 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num12; + break; case FLOATTYPE_8: pf->fetch_nv = cvt_num8_num12; break; @@ -1667,8 +1746,10 @@ PackFile_assign_transforms(ARGMOD(PackFi case FLOATTYPE_16: pf->fetch_nv = cvt_num16_num12; break; -# endif -# if NUMVAL_SIZE == 16 +# elif NUMVAL_SIZE == 16 + case FLOATTYPE_4: + pf->fetch_nv = cvt_num4_num16; + break; case FLOATTYPE_8: pf->fetch_nv = cvt_num8_num16; break; Index: parrot-svn/config/auto/jit.pm =================================================================== --- parrot-svn.orig/config/auto/jit.pm +++ parrot-svn/config/auto/jit.pm @@ -53,6 +53,7 @@ sub runstep { my $cpuarch = $conf->data->get('cpuarch'); my $osname = $conf->data->get('osname'); + my $nvsize = $conf->data->get('nvsize'); my $jitbase = $self->{jitbase_default}; # base path for jit sources @@ -62,7 +63,7 @@ sub runstep { if $verbose; my $jitcapable = - $self->_check_jitcapability($corejit, $cpuarch, $osname); + $self->_check_jitcapability($corejit, $cpuarch, $osname, $nvsize); my $jitarchname = "$cpuarch-$osname"; _handle_asm( { @@ -148,7 +149,7 @@ sub runstep { sub _check_jitcapability { my $self = shift; - my ($corejit, $cpuarch, $osname) = @_; + my ($corejit, $cpuarch, $osname, $nvsize) = @_; my $jitcapable = 0; if ( -e $corejit ) { @@ -162,6 +163,12 @@ sub _check_jitcapability { $jitcapable = 1; } + # Can only jit double. For long double see patch in TT #352. + # float not yet planned. + if ( $nvsize != 8 ) { + $jitcapable = 0; + } + # Another exception if ( $cpuarch eq 'i386' && $osname eq 'darwin' ) { $jitcapable = 0; Index: parrot-svn/t/native_pbc/header.t =================================================================== --- parrot-svn.orig/t/native_pbc/header.t +++ parrot-svn/t/native_pbc/header.t @@ -64,7 +64,7 @@ my %h; is( $h{magic}, "\xfe\x50\x42\x43\x0a\x1a\x0a", "magic string 0xfePBC0x0a0x1a0x0a len=7" ); ok( $h{wordsize} == 2 || $h{wordsize} == 4 || $h{wordsize} == 8, "wordsize: $h{wordsize}" ); ok( $h{byteorder} < 2, "byteorder: $h{byteorder}" ); -ok( $h{floattype} < 3, "floattype: $h{floattype}" ); +ok( $h{floattype} <= 3, "floattype: $h{floattype}" ); is( $h{major}, $PConfig{MAJOR}, "major version: $h{major} vs $PConfig{MAJOR}" ); is( $h{minor}, $PConfig{MINOR}, "minor version: $h{minor} vs $PConfig{MINOR}" ); is( $h{patch}, $PConfig{PATCH}, "patch version: $h{patch} vs $PConfig{PATCH}" ); Index: parrot-svn/t/native_pbc/number.t =================================================================== --- parrot-svn.orig/t/native_pbc/number.t +++ parrot-svn/t/native_pbc/number.t @@ -55,16 +55,17 @@ native pbcs. =cut -# tt #357: need better testmatrix for coverage overview +# tt #357: testmatrix for coverage overview # float conversion src: left-side (pbc) to dest: upper-side (platform) # 1: tested ok, 0: fails (skip), ?: not yet tested (todo) my $testmatrix = < [1,4], '12_le' => [2], '16_le' => [5], - '8_be' => [3,6], '16_be' => [7] }; + '8_be' => [3,6], '4_le' => [7], '16_be' => [8] }; # the reverse: which tests for which arch -my @archtest = qw(8_le 12_le 8_be 8_le 16_le 8_be 16_be); +my @archtest = qw(8_le 12_le 8_be 8_le 16_le 8_be 4_le 16_be); # @todo lists of tests for your architecture. # e.g. for arch 8_le => tests (8_be) => todo (3 6) sub generate_skip_list { @@ -157,6 +158,35 @@ if ($PConfig{ptrsize} == 8) { $todo->{8} = $todo_msg; } +my $output_float = << 'END_OUTPUT'; +1 +4 +16 +64 +256 +1024 +4096 +16384 +65536 +262144 +1048576 +4194304 +1.677722e+07 +6.710886e+07 +2.684355e+08 +1.073742e+09 +4.294967e+09 +1.717987e+10 +6.871948e+10 +2.748779e+11 +1.099512e+12 +4.398047e+12 +1.759219e+13 +7.036874e+13 +2.81475e+14 +1.1259e+15 +END_OUTPUT + my $output = << 'END_OUTPUT'; 1 4 @@ -186,6 +216,8 @@ my $output = << 'END_OUTPUT'; 1.12589990684262e+15 END_OUTPUT +$output = $output_float if $PConfig{numvalsize} == 4; + # test_pbc_number(1, "i386 8-byte double float, 32 bit opcode_t"); sub test_pbc_number { my $id = shift; Index: parrot-svn/tools/dev/mk_native_pbc =================================================================== --- parrot-svn.orig/tools/dev/mk_native_pbc +++ parrot-svn/tools/dev/mk_native_pbc @@ -104,8 +104,8 @@ else # force double on 2nd run not to default to long double conf=" --floatval=double" else - N=7 - echo "7: ppc/BE 64 bit opcode_t, 16-byte long double" + N=8 + echo "8: ppc/BE 64 bit opcode_t, 16-byte long double" fi fi else Index: parrot-svn/t/steps/auto_jit-01.t =================================================================== --- parrot-svn.orig/t/steps/auto_jit-01.t +++ parrot-svn/t/steps/auto_jit-01.t @@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 50; +use Test::More tests => 51; use Carp; use Cwd; use File::Path qw( mkpath ); @@ -52,7 +52,7 @@ my $cwd = cwd(); my $corejitdir = File::Spec->catdir ( $jitbase, $cpuarch ); mkpath( $corejitdir, 0, 755 ) or croak "Unable to make testing directory"; my $corejit = File::Spec->catfile( $jitbase, $cpuarch, q{core.jit} ); - is( $step->_check_jitcapability($corejit, $cpuarch, $osname), 0, + is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, "Got expected value for _check_jitcapability(): no core.jit case"); chdir $cwd or croak "Unable to change back to starting directory"; @@ -71,7 +71,7 @@ my $cwd = cwd(); or croak "Unable to open handle to file for testing"; print $FH qq{Hello, JIT\n}; close $FH or croak "Unable to close handle to file for testing"; - is( $step->_check_jitcapability($corejit, $cpuarch, $osname), 0, + is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, "Got expected value for _check_jitcapability(): no JIT on this architecture case"); chdir $cwd or croak "Unable to change back to starting directory"; @@ -92,7 +92,7 @@ my $cwd = cwd(); close $FH or croak "Unable to close handle to file for testing"; my $orig = $step->{jit_is_working}; $step->{jit_is_working} = { $cpuarch => 1 }; - is( $step->_check_jitcapability($corejit, $cpuarch, $osname), 1, + is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 1, "Got expected value for _check_jitcapability(): mock JIT case"); $step->{jit_is_working} = $orig; @@ -114,13 +114,35 @@ my $cwd = cwd(); close $FH or croak "Unable to close handle to file for testing"; my $orig = $step->{jit_is_working}; $step->{jit_is_working} = { $cpuarch => 1 }; - is( $step->_check_jitcapability($corejit, $cpuarch, $osname), 0, + is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, "Got expected value for _check_jitcapability(): mock darwin-i386 case"); $step->{jit_is_working} = $orig; chdir $cwd or croak "Unable to change back to starting directory"; } +{ + my $tdir = tempdir( CLEANUP => 1 ); + chdir $tdir or croak "Unable to change to temporary directory"; + my $jitbase = 'foo'; + my $cpuarch = 'i386'; + my $osname = 'MSWin32'; + my $corejitdir = File::Spec->catdir ( $jitbase, $cpuarch ); + mkpath( $corejitdir, 0, 755 ) or croak "Unable to make testing directory"; + my $corejit = File::Spec->catfile( $jitbase, $cpuarch, q{core.jit} ); + open my $FH, '>', $corejit + or croak "Unable to open handle to file for testing"; + print $FH qq{Hello, JIT\n}; + close $FH or croak "Unable to close handle to file for testing"; + my $orig = $step->{jit_is_working}; + $step->{jit_is_working} = { $cpuarch => 1 }; + is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 4), 0, + "Got expected value for _check_jitcapability(): mock single-float"); + $step->{jit_is_working} = $orig; + + chdir $cwd or croak "Unable to change back to starting directory"; +} + ########### _handle_asm() ########### { Index: parrot-svn/t/compilers/imcc/imcpasm/opt1.t =================================================================== --- parrot-svn.orig/t/compilers/imcc/imcpasm/opt1.t +++ parrot-svn/t/compilers/imcc/imcpasm/opt1.t @@ -1154,18 +1154,30 @@ OUT ############################## -$output = $PConfig{numvalsize} == 8 - ? '/^# IMCC does produce b0rken PASM files +if ($PConfig{numvalsize} == 8) { + $output = '/^# IMCC does produce b0rken PASM files # see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 _main: set N0, 1\.6e\+0?22 end$/ -' : '/^# IMCC does produce b0rken PASM files +'; +} +elsif ($PConfig{numvalsize} > 8) { + $output = '/^# IMCC does produce b0rken PASM files # see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 _main: set N0, 16000000000000000000000 end$/ '; +} +elsif ($PConfig{numvalsize} < 8) { + $output = '/^# IMCC does produce b0rken PASM files +# see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 +_main: + set N0, 1\.6e\+22 + end$/ +'; +} pir_2_pasm_like( <<'CODE', $output, "constant add big nums" ); .sub _main Index: parrot-svn/t/op/arithmetics.t =================================================================== --- parrot-svn.orig/t/op/arithmetics.t +++ parrot-svn/t/op/arithmetics.t @@ -11,6 +11,7 @@ use Parrot::Test tests => 30; # test for GMP use Parrot::Config; +my $output; =head1 NAME @@ -184,24 +185,24 @@ OUTPUT # pasm_output_is( <<'CODE', < 56; +my $output; =head1 NAME @@ -1035,27 +1037,30 @@ CODE 5 OUTPUT -pasm_output_is( < 8) { + $output = '1.4142135623731 1.4142135623731 '; +} + pasm_output_is( <<'CODE', $output, "sqrt_n_n" ); set N1, 2 sqrt N2, N1 Index: parrot-svn/t/op/sprintf.t =================================================================== --- parrot-svn.orig/t/op/sprintf.t +++ parrot-svn/t/op/sprintf.t @@ -325,6 +325,11 @@ tag C is allowed for todo tests tha .local string test_file + .local int nvsize + load_bytecode 'config.pbc' + $P0 = _config() + nvsize = $P0["nvsize"] + bsr reset_skip_info test_file = 'sprintf_tests' skip_info[5] = 'parrot extension (%B)' @@ -373,6 +378,26 @@ tag C is allowed for todo tests tha skip_info[307] = 'perl5-specific extension (%v...)' skip_info[308] = 'perl5-specific extension (%v...)' + if nvsize >= 8 goto end_float + skip_info[11] = 'too high for single-float %G' + skip_info[12] = 'too high for single-float %G' + skip_info[14] = 'too high for single-float %G' + skip_info[15] = 'too high for single-float %G' + skip_info[102] = 'too high for single-float %e' + skip_info[104] = 'too high for single-float %e' + skip_info[122] = 'too high for single-float %e' + skip_info[123] = 'too high for single-float %e' + skip_info[162] = 'too high for single-float %e' + skip_info[163] = 'too high for single-float %e' + skip_info[164] = 'too high for single-float %e' + skip_info[165] = 'too high for single-float %e' + skip_info[167] = 'too high for single-float %e' + skip_info[178] = 'too high for single-float %e' + skip_info[179] = 'too high for single-float %e' + skip_info[185] = 'too high for single-float %e' + skip_info[186] = 'too high for single-float %e' + + end_float: skip_tests[test_file] = skip_info .return (skip_tests) Index: parrot-svn/t/op/time.t =================================================================== --- parrot-svn.orig/t/op/time.t +++ parrot-svn/t/op/time.t @@ -63,23 +63,28 @@ ok, (!= 1970) Grateful Dead not ok, (now>before) timelords need not apply OUTPUT -pasm_output_is( < 4 FLOATVAL timer_end = time + Parrot_floatval_time(); +#else + UINTVAL timer_end = time + Parrot_intval_time(); +#endif struct timespec time_struct; /* Tell the scheduler runloop to wake, this is a good time to process @@ -1011,7 +1015,11 @@ Parrot_cx_schedule_sleep(PARROT_INTERP, MUTEX_INIT(lock); LOCK(lock); time_struct.tv_sec = (time_t) timer_end; +#if NUMVAL_SIZE > 4 time_struct.tv_nsec = (long)((timer_end - time_struct.tv_sec)*1000.0f) *1000L*1000L; +#else + time_struct.tv_nsec = (long)((timer_end*1000L - time_struct.tv_sec*1000L)*1000.0f); +#endif COND_TIMED_WAIT(condition, lock, &time_struct); UNLOCK(lock); COND_DESTROY(condition); Index: parrot-svn/t/pmc/bigint.t =================================================================== --- parrot-svn.orig/t/pmc/bigint.t +++ parrot-svn/t/pmc/bigint.t @@ -129,16 +129,16 @@ ok 3 ok 4 OUT -pasm_output_is( <<'CODE', <<'OUT', "set double, get str" ); +my $output = $PConfig{numvalsize} < 8 ? "1229999964160\n" : "1230000000000\n"; +# inexact with short floats +pasm_output_is( <<'CODE', $output, "set double, get str" ); new P0, ['BigInt'] set P0, 1.23e12 - print P0 - print "\n" + say P0 end CODE -1230000000000 -OUT +# but exact with strings pasm_output_is( <<'CODE', <<'OUT', "set str, get str" ); new P0, ['BigInt'] set P0, "1230000000000" Index: parrot-svn/t/pmc/complex.t =================================================================== --- parrot-svn.orig/t/pmc/complex.t +++ parrot-svn/t/pmc/complex.t @@ -17,8 +17,17 @@ Tests the Complex PMC. =cut .sub main :main + .local int nvsize + load_bytecode "config.pbc" + $P0 = _config() + nvsize = $P0['nvsize'] + if nvsize > 4 goto no_singlefloat + say "1..0 # SKIP crashes on single float" + goto fin + + no_singlefloat: .include 'test_more.pir' - .include 'fp_equality.pasm' + # .include 'fp_equality.pasm' .include "iglobals.pasm" plan(467) @@ -79,7 +88,7 @@ Tests the Complex PMC. add_using_subclass_of_complex_bug_59630() # END_OF_TESTS - + fin: .end .macro exception_is( M ) Index: parrot-svn/runtime/parrot/include/fp_equality.pasm =================================================================== --- parrot-svn.orig/runtime/parrot/include/fp_equality.pasm +++ parrot-svn/runtime/parrot/include/fp_equality.pasm @@ -36,16 +36,28 @@ The same macros are also provided for PA .endm .macro fp_eq_pasm ( J, K, L ) + set N13, 0.000001 set N10, .J set N11, .K sub N12, N11, N10 abs N12, N12 - gt N12, 0.000001, .$FPEQNOK + gt N12, N13, .$FPEQNOK branch .L .label $FPEQNOK: .endm +.macro fp_eq_prec_pasm ( J, K, L, M ) + set N10, .J + set N11, .K + sub N12, N11, N10 + abs N12, N12 + set N13, .L + gt N12, N13, .$FPEQNOK + + branch .M +.label $FPEQNOK: +.endm .macro fp_ne_pasm ( J, K, L ) set N10, .J Index: parrot-svn/t/pmc/float.t =================================================================== --- parrot-svn.orig/t/pmc/float.t +++ parrot-svn/t/pmc/float.t @@ -24,6 +24,7 @@ Tests the Float PMC. =cut +my $output; pasm_output_is( <<"CODE", < PMC. set $S0, $P0 is( $S0, "123", 'String obj set with literal int' ) - set $P0, 1.23456789 + set $P0, 1.23456 set $S0, $P0 - is( $S0, "1.23456789", 'String obj set with literal floating point' ) + is( $S0, "1.23456", 'String obj set with literal floating point' ) set $P0, "0xFFFFFF" set $S0, $P0 Index: parrot-svn/t/pmc/sub.t =================================================================== --- parrot-svn.orig/t/pmc/sub.t +++ parrot-svn/t/pmc/sub.t @@ -1006,7 +1006,8 @@ OUTPUT unlink( $l1_pbc, $l2_pbc ); -pir_output_is( <<'CODE', <<'OUTPUT', "immediate code as const" ); +my $output = $PConfig{numvalsize} > 4 ? "3.14159265358979\n" : "3.141593\n"; +pir_output_is( <<'CODE', $output, "immediate code as const" ); .sub make_pi :immediate :anon $N0 = atan 1.0, 1.0 $N0 *= 4 @@ -1017,12 +1018,9 @@ pir_output_is( <<'CODE', <<'OUTPUT', "im .sub main :main .const 'Sub' pi = "make_pi" - print pi - print "\n" + say pi .end CODE -3.14159265358979 -OUTPUT pir_output_is( <<'CODE', <<'OUTPUT', "immediate code as const - obj" ); .sub make_obj :immediate :anon Index: parrot-svn/t/pmc/timer.t =================================================================== --- parrot-svn.orig/t/pmc/timer.t +++ parrot-svn/t/pmc/timer.t @@ -7,6 +7,7 @@ use warnings; use lib qw( . lib ../lib ../../lib ); use Test::More; use Parrot::Test tests => 6; +use Parrot::Config; =head1 NAME @@ -126,7 +127,9 @@ CODE /ok 2/ OUT - pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/stop" ); + my @todo = $PConfig{nvsize} == 4 ? + ( todo => 'single-float timer resolution' ) : (); + pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/stop", @todo ); .include "timer.pasm" new P1, ['FixedPMCArray'] set P1, 6 @@ -153,8 +156,11 @@ ok 1 ok 2 OUT - my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ ? - ( todo => 'RT #49718, add scheduler features to JIT' ) : (); + @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ + ? ( todo => 'RT #49718, add scheduler features to JIT' ) + : $PConfig{nvsize} == 4 + ? ( todo => 'single-float timer resolution' ) + : (); pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/repeat" , @todo ); .include "timer.pasm" new P1, ['FixedPMCArray'] Index: parrot-svn/t/dynoplibs/myops.t =================================================================== --- parrot-svn.orig/t/dynoplibs/myops.t +++ parrot-svn/t/dynoplibs/myops.t @@ -53,6 +53,7 @@ OUTPUT pir_error_output_like( << 'CODE', << 'OUTPUT', "hcf" ); .loadlib "myops_ops" + .sub main :main print "neither here\n" hcf @@ -77,10 +78,14 @@ END_PASM pasm_output_is( $quine, $quine, 'a short cheating quine', @todo ); } - my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ ? - ( todo => 'RT #49718, add scheduler features to JIT' ) : (); +SKIP: { + skip "alarm, single-float timer resolution", 1 if $PConfig{nvsize} == 4; + + my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ + ? ( todo => 'RT #49718, add scheduler features to JIT' ) + : (); -pir_output_is( << 'CODE', << 'OUTPUT', "one alarm", @todo ); + pir_output_is( << 'CODE', << 'OUTPUT', "one alarm", @todo ); .loadlib "myops_ops" .sub main :main @@ -109,6 +114,7 @@ alarm 3 done. OUTPUT +} SKIP: { skip "three alarms, infinite loop under mingw32", 2 if $is_mingw; @@ -169,6 +175,7 @@ CODE /7/ OUTPUT + skip "alarm, single-float timer resolution", 1 if $PConfig{nvsize} == 4; pir_output_like( << 'CODE', << 'OUTPUT', "repeating alarm", @todo ); .loadlib "myops_ops" Index: parrot-svn/t/library/dumper.t =================================================================== --- parrot-svn.orig/t/library/dumper.t +++ parrot-svn/t/library/dumper.t @@ -763,12 +763,12 @@ pir_output_is( <<'CODE', <<'OUTPUT', "du .local pmc float1 new float1, 'Float' - float1 = 12345.678 + float1 = 12345.67 _dumper( float1, "Float:" ) .end .include "library/dumper.pir" CODE -"Float:" => 12345.678 +"Float:" => 12345.67 OUTPUT # no. 18 Index: parrot-svn/t/library/mt19937ar.t =================================================================== --- parrot-svn.orig/t/library/mt19937ar.t +++ parrot-svn/t/library/mt19937ar.t @@ -7,6 +7,7 @@ use warnings; use lib qw( t . lib ../lib ../../lib ); use Test::More; use Parrot::Test tests => 10; +use Parrot::Config; =head1 NAME @@ -144,7 +145,9 @@ CODE OUTPUT -my $out = Parrot::Test::slurp_file(File::Spec->catfile( 't', 'library', 'mt19937ar.txt' )); +my $out = Parrot::Test::slurp_file(File::Spec->catfile + ( 't', 'library', $PConfig{numvalsize} > 4 + ? 'mt19937ar.txt' : 'mt_float.txt')); pir_output_is( << 'CODE', $out, 'mt19937ar output' ); .sub test :main load_bytecode 'library/Math/Random/mt19937ar.pbc' @@ -177,12 +180,21 @@ pir_output_is( << 'CODE', $out, 'mt19937 goto L1 L2: print "\n1000 outputs of genrand_real2()\n" + .local int nvsize + load_bytecode "config.pbc" + $P1 = _config() + nvsize = $P1['nvsize'] i = 0 L4: unless i < 1000 goto L5 $N0 = mt.'genrand_real2'() $P0[0] = $N0 + if nvsize > 4 goto no_singlefloat + $S0 = sprintf "%10.5f ", $P0 + goto L7 + no_singlefloat: $S0 = sprintf "%10.8f ", $P0 + L7: print $S0 $I0 = i % 5 unless $I0 == 4 goto L6 Index: parrot-svn/t/library/mt_float.txt =================================================================== --- /dev/null +++ parrot-svn/t/library/mt_float.txt @@ -0,0 +1,403 @@ +1000 outputs of genrand_int32() +1067595299 955945823 477289528 4107218783 4228976476 +3344332714 3355579695 227628506 810200273 2591290167 +2560260675 3242736208 646746669 1479517882 4245472273 +1143372638 3863670494 3221021970 1773610557 1138697238 +1421897700 1269916527 2859934041 1764463362 3874892047 +3965319921 72549643 2383988930 2600218693 3237492380 +2792901476 725331109 605841842 271258942 715137098 +3297999536 1322965544 4229579109 1395091102 3735697720 +2101727825 3730287744 2950434330 1661921839 2895579582 +2370511479 1004092106 2247096681 2111242379 3237345263 +4082424759 219785033 2454039889 3709582971 835606218 +2411949883 2735205030 756421180 2175209704 1873865952 +2762534237 4161807854 3351099340 181129879 3269891896 + 776029799 2218161979 3001745796 1866825872 2133627728 + 34862734 1191934573 3102311354 2916517763 1012402762 +2184831317 4257399449 2899497138 3818095062 3030756734 +1282161629 420003642 2326421477 2741455717 1278020671 +3744179621 271777016 2626330018 2560563991 3055977700 +4233527566 1228397661 3595579322 1077915006 2395931898 +1851927286 3013683506 1999971931 3006888962 1049781534 +1488758959 3491776230 104418065 2448267297 3075614115 +3872332600 891912190 3936547759 2269180963 2633455084 +1047636807 2604612377 2709305729 1952216715 207593580 +2849898034 670771757 2210471108 467711165 263046873 +3569667915 1042291111 3863517079 1464270005 2758321352 +3790799816 2301278724 3106281430 7974801 2792461636 + 555991332 621766759 1322453093 853629228 686962251 +1455120532 957753161 1802033300 1021534190 3486047311 +1902128914 3701138056 4176424663 1795608698 560858864 +3737752754 3141170998 1553553385 3367807274 711546358 +2475125503 262969859 251416325 2980076994 1806565895 + 969527843 3529327173 2736343040 2987196734 1649016367 +2206175811 3048174801 3662503553 3138851612 2660143804 +1663017612 1816683231 411916003 3887461314 2347044079 +1015311755 1203592432 2170947766 2569420716 813872093 +1105387678 1431142475 220570551 4243632715 4179591855 +2607469131 3090613241 282341803 1734241730 1391822177 +1001254810 827927915 1886687171 3935097347 2631788714 +3905163266 110554195 2447955646 3717202975 3304793075 +3739614479 3059127468 953919171 2590123714 1132511021 +3795593679 2788030429 982155079 3472349556 859942552 +2681007391 2299624053 647443547 233600422 608168955 +3689327453 1849778220 1608438222 3968158357 2692977776 +2851872572 246750393 3582818628 3329652309 4036366910 +1012970930 950780808 3959768744 2538550045 191422718 +2658142375 3276369011 2927737484 1234200027 1920815603 +3536074689 1535612501 2184142071 3276955054 428488088 +2378411984 4059769550 3913744741 2732139246 64369859 +3755670074 842839565 2819894466 2414718973 1010060670 +1839715346 2410311136 152774329 3485009480 4102101512 +2852724304 879944024 1785007662 2748284463 1354768064 +3267784736 2269127717 3001240761 3179796763 895723219 + 865924942 4291570937 89355264 1471026971 4114180745 +3201939751 2867476999 2460866060 3603874571 2238880432 +3308416168 2072246611 2755653839 3773737248 1709066580 +4282731467 2746170170 2832568330 433439009 3175778732 + 26248366 2551382801 183214346 3893339516 1928168445 +1337157619 3429096554 3275170900 1782047316 4264403756 +1876594403 4289659572 3223834894 1728705513 4068244734 +2867840287 1147798696 302879820 1730407747 1923824407 +1180597908 1569786639 198796327 560793173 2107345620 +2705990316 3448772106 3678374155 758635715 884524671 + 486356516 1774865603 3881226226 2635213607 1181121587 +1508809820 3178988241 1594193633 1235154121 326117244 +2304031425 937054774 2687415945 3192389340 2003740439 +1823766188 2759543402 10067710 1533252662 4132494984 + 82378136 420615890 3467563163 541562091 3535949864 +2277319197 3330822853 3215654174 4113831979 4204996991 +2162248333 3255093522 2219088909 2978279037 255818579 +2859348628 3097280311 2569721123 1861951120 2907080079 +2719467166 998319094 2521935127 2404125338 259456032 +2086860995 1839848496 1893547357 2527997525 1489393124 +2860855349 76448234 2264934035 744914583 2586791259 +1385380501 66529922 1819103258 1899300332 2098173828 +1793831094 276463159 360132945 4178212058 595015228 + 177071838 2800080290 1573557746 1548998935 378454223 +1460534296 1116274283 3112385063 3709761796 827999348 +3580042847 1913901014 614021289 4278528023 1905177404 + 45407939 3298183234 1184848810 3644926330 3923635459 +1627046213 3677876759 969772772 1160524753 1522441192 + 452369933 1527502551 832490847 1003299676 1071381111 +2891255476 973747308 4086897108 1847554542 3895651598 +2227820339 1621250941 2881344691 3583565821 3510404498 + 849362119 862871471 797858058 2867774932 2821282612 +3272403146 3997979905 209178708 1805135652 6783381 +2823361423 792580494 4263749770 776439581 3798193823 +2853444094 2729507474 1071873341 1329010206 1289336450 +3327680758 2011491779 80157208 922428856 1158943220 +1667230961 2461022820 2608845159 387516115 3345351910 +1495629111 4098154157 3156649613 3525698599 4134908037 + 446713264 2137537399 3617403512 813966752 1157943946 +3734692965 1680301658 3180398473 3509854711 2228114612 +1008102291 486805123 863791847 3189125290 1050308116 +3777341526 4291726501 844061465 1347461791 2826481581 + 745465012 2055805750 4260209475 2386693097 2980646741 + 447229436 2077782664 1232942813 4023002732 1399011509 +3140569849 2579909222 3794857471 900758066 2887199683 +1720257997 3367494931 2668921229 955539029 3818726432 +1105704962 3889207255 2277369307 2746484505 1761846513 +2413916784 2685127085 4240257943 1166726899 4215215715 +3082092067 3960461946 1663304043 2087473241 4162589986 +2507310778 1579665506 767234210 970676017 492207530 +1441679602 1314785090 3262202570 3417091742 1561989210 +3011406780 1146609202 3262321040 1374872171 1634688712 +1280458888 2230023982 419323804 3262899800 39783310 +1641619040 1700368658 2207946628 2571300939 2424079766 + 780290914 2715195096 3390957695 163151474 2309534542 +1860018424 555755123 280320104 1604831083 2713022383 +1728987441 3639955502 623065489 3828630947 4275479050 +3516347383 2343951195 2430677756 635534992 3868699749 + 808442435 3070644069 4282166003 2093181383 2023555632 +1568662086 3422372620 4134522350 3016979543 3259320234 +2888030729 3185253876 4258779643 1267304371 1022517473 + 815943045 929020012 2995251018 3371283296 3608029049 +2018485115 122123397 2810669150 1411365618 1238391329 +1186786476 3155969091 2242941310 1765554882 279121160 +4279838515 1641578514 3796324015 13351065 103516986 +1609694427 551411743 2493771609 1316337047 3932650856 +4189700203 463397996 2937735066 1855616529 2626847990 + 55091862 3823351211 753448970 4045045500 1274127772 +1124182256 92039808 2126345552 425973257 386287896 +2589870191 1987762798 4084826973 2172456685 3366583455 +3602966653 2378803535 2901764433 3716929006 3710159000 +2653449155 3469742630 3096444476 3932564653 2595257433 + 318974657 3146202484 853571438 144400272 3768408841 + 782634401 2161109003 570039522 1886241521 14249488 +2230804228 1604941699 3928713335 3921942509 2155806892 + 134366254 430507376 1924011722 276713377 196481886 +3614810992 1610021185 1785757066 851346168 3761148643 +2918835642 3364422385 3012284466 3735958851 2643153892 +3778608231 1164289832 205853021 2876112231 3503398282 +3078397001 3472037921 1748894853 2740861475 316056182 +1660426908 168885906 956005527 3984354789 566521563 +1001109523 1216710575 2952284757 3834433081 3842608301 +2467352408 3974441264 3256601745 1409353924 1329904859 +2307560293 3125217879 3622920184 3832785684 3882365951 +2308537115 2659155028 1450441945 3532257603 3186324194 +1225603425 1124246549 175808705 3009142319 2796710159 +3651990107 160762750 1902254979 1698648476 1134980669 + 497144426 3302689335 4057485630 3603530763 4087252587 + 427812652 286876201 823134128 1627554964 3745564327 +2589226092 4202024494 62878473 3275585894 3987124064 +2791777159 1916869511 2585861905 1375038919 1403421920 + 60249114 3811870450 3021498009 2612993202 528933105 +2757361321 3341402964 2621861700 273128190 4015252178 +3094781002 1621621288 2337611177 1796718448 1258965619 +4241913140 2138560392 3022190223 4174180924 450094611 +3274724580 617150026 2704660665 1469700689 1341616587 + 356715071 1188789960 2278869135 1766569160 2795896635 + 57824704 2893496380 1235723989 1630694347 3927960522 + 428891364 1814070806 2287999787 4125941184 3968103889 +3548724050 1025597707 1404281500 2002212197 92429143 +2313943944 2403086080 3006180634 3561981764 1671860914 +1768520622 1803542985 844848113 3006139921 1410888995 +1157749833 2125704913 1789979528 1799263423 741157179 +2405862309 767040434 2655241390 3663420179 2172009096 +2511931187 1680542666 231857466 1154981000 157168255 +1454112128 3505872099 1929775046 2309422350 2143329496 +2960716902 407610648 2938108129 2581749599 538837155 +2342628867 430543915 740188568 1937713272 3315215132 +2085587024 4030765687 766054429 3517641839 689721775 +1294158986 1753287754 4202601348 1974852792 33459103 +3568087535 3144677435 1686130825 4134943013 3005738435 +3599293386 426570142 754104406 3660892564 1964545167 + 829466833 821587464 1746693036 1006492428 1595312919 +1256599985 1024482560 1897312280 2902903201 691790057 +1037515867 3176831208 1968401055 2173506824 1089055278 +1748401123 2941380082 968412354 1818753861 2973200866 +3875951774 1119354008 3988604139 1647155589 2232450826 +3486058011 3655784043 3759258462 847163678 1082052057 + 989516446 2871541755 3196311070 3929963078 658187585 +3664944641 2175149170 2203709147 2756014689 2456473919 +3890267390 1293787864 2830347984 3059280931 4158802520 +1561677400 2586570938 783570352 1355506163 31495586 +3789437343 3340549429 2092501630 896419368 671715824 +3530450081 3603554138 1055991716 3442308219 1499434728 +3130288473 3639507000 17769680 2259741420 487032199 +4227143402 3693771256 1880482820 3924810796 381462353 +4017855991 2452034943 2736680833 2209866385 2128986379 + 437874044 595759426 641721026 1636065708 3899136933 + 629879088 3591174506 351984326 2638783544 2348444281 +2341604660 2123933692 143443325 1525942256 364660499 + 599149312 939093251 1523003209 106601097 376589484 +1346282236 1297387043 764598052 3741218111 933457002 +1886424424 3219631016 525405256 3014235619 323149677 +2038881721 4100129043 2851715101 2984028078 1888574695 +2014194741 3515193880 4180573530 3461824363 2641995497 +3179230245 2902294983 2217320456 4040852155 1784656905 +3311906931 87498458 2752971818 2635474297 2831215366 +3682231106 2920043893 3772929704 2816374944 309949752 +2383758854 154870719 385111597 1191604312 1840700563 + 872191186 2925548701 1310412747 2102066999 1504727249 +3574298750 1191230036 3330575266 3180292097 3539347721 + 681369118 3305125752 3648233597 950049240 4173257693 +1760124957 512151405 681175196 580563018 1169662867 +4015033554 2687781101 699691603 2673494188 1137221356 + 123599888 472658308 1053598179 1012713758 3481064843 +3759461013 3981457956 3830587662 1877191791 3650996736 + 988064871 3515461600 4089077232 2225147448 1249609188 +2643151863 3896204135 2416995901 1397735321 3460025646 + +1000 outputs of genrand_real2() + 0.76275 0.99001 0.98670 0.10143 0.27933 + 0.69867 0.94219 0.03427 0.78842 0.28181 + 0.92179 0.20786 0.54535 0.69644 0.38108 + 0.23978 0.65287 0.07515 0.22765 0.94873 + 0.74558 0.62664 0.54708 0.90959 0.42043 + 0.86335 0.19189 0.14719 0.70260 0.63426 + 0.77408 0.04532 0.04606 0.88596 0.69398 + 0.05377 0.61711 0.05566 0.10134 0.41501 + 0.91811 0.22321 0.23354 0.92872 0.98897 + 0.19787 0.80559 0.06961 0.55840 0.90479 + 0.63288 0.95010 0.54948 0.20645 0.45001 + 0.87051 0.70807 0.19407 0.79286 0.49333 + 0.78484 0.75145 0.12342 0.42030 0.16728 + 0.59906 0.37575 0.97815 0.39816 0.43595 + 0.04952 0.33918 0.76510 0.61034 0.90655 + 0.92916 0.85366 0.18812 0.65913 0.28815 + 0.59476 0.27836 0.60723 0.68310 0.69387 + 0.03700 0.65898 0.17527 0.02889 0.86777 + 0.12352 0.91439 0.32023 0.44446 0.34904 + 0.74639 0.65918 0.92493 0.31873 0.77750 + 0.85414 0.76386 0.32744 0.91326 0.27458 + 0.22190 0.19865 0.31227 0.85321 0.84243 + 0.78544 0.71854 0.92504 0.82703 0.88306 + 0.47284 0.70059 0.48004 0.38672 0.60466 + 0.41747 0.47163 0.72751 0.65830 0.10955 + 0.64215 0.23456 0.95945 0.72822 0.40888 + 0.69980 0.26677 0.57334 0.39792 0.85378 + 0.76963 0.72005 0.90903 0.51377 0.37733 + 0.12692 0.71250 0.81218 0.37037 0.32772 + 0.14238 0.05615 0.74363 0.39773 0.94859 + 0.31452 0.11730 0.62963 0.33334 0.45547 + 0.10090 0.56551 0.60539 0.16028 0.13245 + 0.60960 0.04672 0.99356 0.57661 0.40270 + 0.45275 0.06700 0.85064 0.87743 0.54508 + 0.87243 0.29321 0.67661 0.68231 0.79052 + 0.48592 0.25186 0.93770 0.28565 0.47219 + 0.99055 0.13155 0.47110 0.98557 0.84398 + 0.12875 0.90953 0.49129 0.23793 0.79481 + 0.44338 0.96564 0.67749 0.55685 0.27287 + 0.79538 0.61965 0.22488 0.02226 0.49248 + 0.42247 0.91798 0.99250 0.23450 0.52532 + 0.10246 0.78686 0.34311 0.89893 0.40455 + 0.68608 0.30752 0.83601 0.54956 0.63778 + 0.82200 0.24891 0.48801 0.48662 0.51224 + 0.32970 0.31075 0.21393 0.73453 0.15566 + 0.58585 0.28977 0.97621 0.61499 0.23891 + 0.28519 0.46810 0.18372 0.37598 0.13492 + 0.66849 0.82811 0.56240 0.37549 0.27563 + 0.27522 0.74096 0.77177 0.13748 0.99747 + 0.92505 0.09175 0.21389 0.21767 0.31183 + 0.23271 0.21207 0.57903 0.77523 0.13243 + 0.31038 0.01205 0.71653 0.84488 0.14982 + 0.57423 0.45678 0.48420 0.53465 0.52667 + 0.46881 0.49850 0.05671 0.79022 0.03872 + 0.21697 0.20443 0.28949 0.81678 0.87629 + 0.92297 0.27373 0.84625 0.51506 0.00583 + 0.33296 0.91848 0.92537 0.91760 0.07541 + 0.71746 0.61159 0.00942 0.03136 0.71527 + 0.24822 0.63637 0.86160 0.26450 0.60160 + 0.35558 0.24477 0.07186 0.51757 0.62120 + 0.97981 0.69955 0.21066 0.13383 0.27693 + 0.59644 0.71501 0.04111 0.95730 0.91601 + 0.47705 0.26183 0.34707 0.07545 0.29398 + 0.93236 0.60486 0.48015 0.08870 0.45549 + 0.91873 0.38143 0.10669 0.01398 0.04520 + 0.93822 0.18012 0.57577 0.91428 0.30911 + 0.95853 0.23611 0.69620 0.69602 0.76765 + 0.58516 0.49479 0.11289 0.97188 0.32095 + 0.57564 0.40761 0.78703 0.43261 0.90878 + 0.84686 0.10599 0.72873 0.19315 0.66153 + 0.10211 0.06258 0.47951 0.47062 0.72701 + 0.48915 0.66110 0.60171 0.24517 0.12726 + 0.03451 0.90865 0.83495 0.94800 0.91035 + 0.14481 0.88459 0.53498 0.15963 0.55379 + 0.35171 0.28720 0.09098 0.00668 0.32310 + 0.87561 0.42535 0.91749 0.73908 0.41793 + 0.99280 0.87908 0.28458 0.59133 0.98672 + 0.28547 0.09452 0.89911 0.53681 0.37931 + 0.62683 0.56610 0.24802 0.52948 0.98329 + 0.66404 0.55524 0.75887 0.84785 0.86830 + 0.71449 0.84670 0.43923 0.20771 0.64158 + 0.25664 0.73056 0.86396 0.65853 0.99062 + 0.40281 0.39146 0.07291 0.97201 0.20556 + 0.59616 0.08138 0.45796 0.33681 0.33989 + 0.18717 0.53546 0.60551 0.86521 0.34291 + 0.72743 0.73024 0.34196 0.65020 0.02765 + 0.72576 0.32710 0.03421 0.26062 0.56998 + 0.28439 0.84423 0.77638 0.55982 0.06720 + 0.58449 0.71657 0.15820 0.58043 0.07948 + 0.40194 0.11376 0.88763 0.67532 0.71224 + 0.27829 0.04806 0.21144 0.58830 0.04140 + 0.43216 0.12953 0.94669 0.87391 0.98382 + 0.27751 0.90850 0.90963 0.59270 0.96102 + 0.49545 0.32007 0.62586 0.03120 0.85953 + 0.22018 0.05834 0.80731 0.53800 0.74167 + 0.77427 0.43938 0.54862 0.58576 0.15886 + 0.73214 0.11649 0.77464 0.85789 0.17062 + 0.66838 0.96076 0.07949 0.68522 0.89986 + 0.05667 0.12741 0.83471 0.63969 0.46613 + 0.10200 0.01195 0.10476 0.90285 0.31221 + 0.32981 0.46042 0.52025 0.05425 0.28331 + 0.60427 0.00598 0.97244 0.21136 0.78562 + 0.78429 0.63423 0.32910 0.44771 0.27381 + 0.14967 0.18156 0.65687 0.28726 0.97075 + 0.63676 0.96649 0.24526 0.08297 0.54258 + 0.03167 0.33735 0.15947 0.02103 0.46228 + 0.11892 0.33408 0.29876 0.29848 0.73768 + 0.02081 0.62980 0.08082 0.22993 0.25031 + 0.87788 0.45150 0.13673 0.63408 0.97908 + 0.52242 0.50580 0.06274 0.05270 0.77032 + 0.05113 0.24393 0.75036 0.37436 0.22878 + 0.59975 0.85708 0.88691 0.85547 0.36641 + 0.58720 0.45463 0.09244 0.32982 0.07820 + 0.25422 0.36005 0.60092 0.46192 0.36759 + 0.98424 0.08020 0.68594 0.45826 0.29962 + 0.79365 0.89231 0.49479 0.87646 0.23591 + 0.28107 0.75026 0.08136 0.79582 0.76011 + 0.82793 0.27948 0.72483 0.82191 0.46172 + 0.79190 0.96044 0.51610 0.88996 0.28999 + 0.55192 0.03935 0.83034 0.49553 0.98010 + 0.19018 0.98348 0.33452 0.87144 0.72106 + 0.71272 0.71466 0.88362 0.85571 0.73782 + 0.20920 0.34855 0.46767 0.02780 0.74898 + 0.03681 0.44867 0.77426 0.91026 0.25195 + 0.87320 0.63265 0.25552 0.27422 0.95217 + 0.39282 0.66442 0.09159 0.94516 0.07801 + 0.02508 0.39901 0.17383 0.12141 0.85502 + 0.19903 0.02160 0.44461 0.14689 0.68020 + 0.71324 0.60922 0.95400 0.99611 0.90898 + 0.41074 0.66207 0.32065 0.62805 0.50677 + 0.52690 0.87473 0.73918 0.39827 0.43684 + 0.80459 0.32423 0.01958 0.95320 0.98326 + 0.83932 0.69061 0.33671 0.68063 0.65152 + 0.33393 0.03452 0.95227 0.68201 0.85074 + 0.64721 0.51234 0.73402 0.00970 0.93835 + 0.80804 0.31485 0.20090 0.01323 0.59934 + 0.31585 0.20210 0.33755 0.68604 0.24443 + 0.19952 0.78163 0.10337 0.11361 0.23537 + 0.23262 0.67804 0.48750 0.74658 0.92157 + 0.56706 0.36683 0.99157 0.23421 0.45184 + 0.91610 0.85573 0.37706 0.77043 0.30892 + 0.40710 0.06945 0.61343 0.88817 0.58735 + 0.98711 0.14744 0.63243 0.87704 0.68347 + 0.84447 0.43265 0.25146 0.04130 0.34260 + 0.92697 0.40879 0.56990 0.76204 0.19820 + 0.66315 0.02483 0.06669 0.50206 0.26084 + 0.65139 0.41650 0.09734 0.56344 0.62652 + 0.67332 0.58037 0.47258 0.21011 0.05713 + 0.89391 0.10781 0.32037 0.07628 0.34228 + 0.42191 0.58202 0.77364 0.49595 0.86031 + 0.83907 0.81098 0.26694 0.14216 0.88210 + 0.53634 0.12091 0.82480 0.75930 0.31847 + 0.92768 0.01038 0.56202 0.88107 0.35926 + 0.85861 0.61109 0.70408 0.58435 0.92192 + 0.62668 0.75988 0.06859 0.36156 0.58057 + 0.13636 0.57720 0.59340 0.63531 0.22976 + 0.71916 0.41163 0.63980 0.09931 0.79344 + 0.10894 0.84450 0.23122 0.99486 0.73637 + 0.17276 0.13358 0.74966 0.64992 0.61990 + 0.41523 0.05878 0.05687 0.05497 0.42868 + 0.42571 0.25811 0.89643 0.30440 0.39310 + 0.11357 0.04288 0.23398 0.11201 0.85621 + 0.89734 0.37509 0.42077 0.68597 0.72781 + 0.19296 0.61699 0.31667 0.67756 0.00177 + 0.05725 0.79475 0.18885 0.06725 0.68193 + 0.42202 0.22082 0.28555 0.64996 0.87852 + 0.29125 0.61010 0.87375 0.05744 0.69903 + 0.81925 0.45654 0.37237 0.31119 0.52734 + 0.39673 0.38185 0.30164 0.17375 0.04913 + 0.90405 0.25743 0.58266 0.97663 0.79823 + 0.36438 0.15206 0.26530 0.22690 0.05839 + 0.84721 0.18622 0.37809 0.55707 0.49829 + 0.47659 0.24290 0.88478 0.07807 0.56246 + 0.73491 0.21099 0.13165 0.75840 0.66877 + 0.28988 0.44046 0.24967 0.80048 0.26030 + 0.30417 0.64152 0.52068 0.12881 0.85465 + 0.02691 0.19149 0.49630 0.79683 0.43566 + 0.00288 0.81484 0.03764 0.68529 0.01340 + 0.38405 0.30537 0.22995 0.44000 0.27218 + 0.53831 0.02870 0.86282 0.61831 0.09165 + 0.25610 0.07446 0.72186 0.90059 0.30071 + 0.94477 0.56822 0.21934 0.96773 0.80063 + 0.26308 0.31183 0.16501 0.55436 0.68562 + 0.23829 0.86512 0.57869 0.81888 0.20127 + 0.93172 0.66028 0.21787 0.78516 0.10262 + 0.35390 0.79304 0.63428 0.90480 0.31025 + 0.60635 0.56198 0.63574 0.91854 0.99701 + 0.83086 0.31692 0.01926 0.97446 0.98751 + 0.60944 0.13751 0.69520 0.68957 0.56969 + 0.46440 0.88342 0.36754 0.89224 0.39786 + 0.85055 0.12750 0.79452 0.89450 0.14568 + 0.45717 0.74822 0.28200 0.42546 0.17465 + 0.68309 0.65497 0.52935 0.12736 0.61524 + 0.81591 0.63108 0.39787 0.20102 0.53293 + 0.75486 0.59847 0.32862 0.12126 0.58917 + 0.07638 0.86845 0.29193 0.03990 0.52180 + 0.32503 0.64072 0.69517 0.74255 0.54587 + 0.48713 0.32920 0.08720 0.63497 0.54328 + 0.64179 0.45584 0.70694 0.85213 0.86074 + 0.33163 0.85740 0.59908 0.74566 0.72157 Index: parrot-svn/t/library/yaml_dumper.t =================================================================== --- parrot-svn.orig/t/library/yaml_dumper.t +++ parrot-svn/t/library/yaml_dumper.t @@ -8,6 +8,7 @@ use lib qw( lib ); use Test::More; use Parrot::Test tests => 26; +use Parrot::Config; =head1 NAME @@ -820,21 +821,22 @@ CODE } OUTPUT +my $float = $PConfig{numvalsize} > 4 ? "12345.6789" : "12345.67"; -pir_output_is( <<'CODE', <<'OUTPUT', "dumping Float PMC" ); +pir_output_is( <<"CODE", <<"OUTPUT", "dumping Float PMC" ); .sub test :main .local pmc float1 new float1, 'Float' - float1 = 12345.678 - yaml( float1, "Float" ) + float1 = $float + yaml( float1, 'Float' ) .end -.include "library/yaml_dumper.pir" +.include 'library/yaml_dumper.pir' CODE --- { - "Float" : !Float [ 12345.678 ], + \"Float\" : !Float [ $float ], } OUTPUT Index: parrot-svn/t/tools/pbc_merge.t =================================================================== --- parrot-svn.orig/t/tools/pbc_merge.t +++ parrot-svn/t/tools/pbc_merge.t @@ -100,12 +100,12 @@ PIR .sub _get_years .local num n - n = 10.398571 + n = 10.39857 .return(n) .end PIR pbc_merge( "pbc_merge_t2", "pbc_merge_t2_1", "pbc_merge_t2_2" ); - is( run_pbc("pbc_merge_t2"), "Rammstein have rocked for over 10.398571 years!" ); + is( run_pbc("pbc_merge_t2"), "Rammstein have rocked for over 10.39857 years!" ); } # Third test - sub calls back and forth between blocks.