Ticket #387: tt387-single-float.patch
File tt387-single-float.patch, 110.9 KB (added by rurban, 13 years ago) |
---|
-
compilers/imcc/optimizer.c
[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
old new 916 916 The value of '16' for NUMVAL_SIZE == 8 was one larger than the 917 917 default FLOATVAL_FMT of '15' determined by Configure.pl. The 918 918 reason for this difference, if there is one, should be documented. 919 The values of.18Lg and .31Lg are guesses. 919 The values of.18Lg and .31Lg are guesses. .7g is from 920 http://www.keil.com/support/docs/2191.htm 920 921 */ 921 922 #if NUMVAL_SIZE == 8 922 923 fmt = "%0.16g"; … … 924 925 fmt = "%0.18Lg"; 925 926 #elif NUMVAL_SIZE == 16 926 927 fmt = "%0.31Lg"; 928 #elif NUMVAL_SIZE == 4 929 fmt = "%0.7g"; 927 930 #else 928 931 fmt = FLOATVAL_FMT; 929 932 /* Since it's not clear why this is needed, it's not clear what to -
include/parrot/packfile.h
old new 30 30 #define FLOATTYPE_12_NAME "x86 little endian 12 byte long double" 31 31 #define FLOATTYPE_16 2 32 32 #define FLOATTYPE_16_NAME "IEEE-754 16 byte long double" 33 #define FLOATTYPE_4 3 34 #define FLOATTYPE_4_NAME "IEEE-754 4-byte float" 33 35 /* Supported until here. */ 34 #define FLOATTYPE_MAX 2 36 #define FLOATTYPE_MAX 3 37 35 38 /* Non IEEE-754 versions, yet unsupported. */ 36 39 /* NaN difference, but patches welcome */ 37 #define FLOATTYPE_16MIPS 340 #define FLOATTYPE_16MIPS 4 38 41 #define FLOATTYPE_16MIPS_NAME "MIPS 16 byte long double" 39 42 /* 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 */ 40 #define FLOATTYPE_16AIX 443 #define FLOATTYPE_16AIX 5 41 44 #define FLOATTYPE_16AIX_NAME "AIX 16 byte long double" 42 /* IEEE-754 old and tiny, yet unsupported */ 43 #define FLOATTYPE_4 5 44 #define FLOATTYPE_4_NAME "4-byte float" 45 #define FLOATTYPE_32 6 46 #define FLOATTYPE_32_NAME "32-byte huge double" 45 47 46 #define TRACE_PACKFILE 048 #define TRACE_PACKFILE 2 47 49 48 50 #if TRACE_PACKFILE 49 51 /* Here we pass multipe args to a macro so the args may not be bracketed here! */ … … 1030 1032 __attribute__nonnull__(1) 1031 1033 __attribute__nonnull__(3); 1032 1034 1035 PARROT_WARN_UNUSED_RESULT 1036 int PF_floattype_size(const int floattype); 1037 1033 1038 PARROT_PURE_FUNCTION 1039 PARROT_WARN_UNUSED_RESULT 1034 1040 size_t PF_size_cstring(ARGIN(const char *s)) 1035 1041 __attribute__nonnull__(1); 1036 1042 … … 1096 1102 #define ASSERT_ARGS_PF_fetch_string __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 1097 1103 PARROT_ASSERT_ARG(interp) \ 1098 1104 || PARROT_ASSERT_ARG(cursor) 1105 #define ASSERT_ARGS_PF_floattype_size __attribute__unused__ int _ASSERT_ARGS_CHECK = 0 1099 1106 #define ASSERT_ARGS_PF_size_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 1100 1107 PARROT_ASSERT_ARG(s) 1101 1108 #define ASSERT_ARGS_PF_size_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = 0 … … 1163 1170 __attribute__nonnull__(2) 1164 1171 FUNC_MODIFIES(*rb); 1165 1172 1173 void fetch_buf_generic( 1174 ARGOUT(unsigned char *rb), 1175 ARGIN(const unsigned char *b), 1176 const int size, 1177 const int byteorder) 1178 __attribute__nonnull__(1) 1179 __attribute__nonnull__(2) 1180 FUNC_MODIFIES(*rb); 1181 1166 1182 void fetch_buf_le_12( 1167 1183 ARGOUT(unsigned char *rb), 1168 1184 ARGIN(const unsigned char *b)) … … 1229 1245 #define ASSERT_ARGS_fetch_buf_be_8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 1230 1246 PARROT_ASSERT_ARG(rb) \ 1231 1247 || PARROT_ASSERT_ARG(b) 1248 #define ASSERT_ARGS_fetch_buf_generic __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 1249 PARROT_ASSERT_ARG(rb) \ 1250 || PARROT_ASSERT_ARG(b) 1232 1251 #define ASSERT_ARGS_fetch_buf_le_12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 1233 1252 PARROT_ASSERT_ARG(rb) \ 1234 1253 || PARROT_ASSERT_ARG(b) -
config/auto/format.pm
old new 1 # Copyright (C) 2001-2003, Parrot Foundation.1 # Copyright (C) 2001-2003, 2009 Parrot Foundation. 2 2 # $Id: format.pm 36833 2009-02-17 20:09:26Z allison $ 3 3 4 4 =head1 NAME … … 41 41 42 42 _set_floatvalmaxmin($conf); 43 43 44 $conf->cc_clean(); 44 45 return 1; 45 46 } 46 47 … … 97 98 if ( $@ ) { 98 99 $ivmin = '0'; 99 100 $ivmax = '0'; 101 $conf->data->set( intvalmin => $ivmin ); 102 $conf->data->set( intvalmax => $ivmax ); 100 103 } 101 102 104 } 103 105 104 106 sub _set_floatvalfmt_nvsize { … … 124 126 die qq{Configure.pl: Can't find a printf-style format specifier for type '$nv'\n}; 125 127 } 126 128 } 129 elsif ( $nv eq "float" ) { 130 $nvsize = 4; 131 $nvformat = "%.7g"; 132 } 127 133 else { 128 134 die qq{Configure.pl: Can't find a printf-style format specifier for type '$nv'\n}; 129 135 } … … 146 152 $nvmax = 'DBL_MAX'; 147 153 } 148 154 elsif ( $nv eq "long double" ) { 149 150 # Stay way from long double for now (it may be 64 or 80 bits)151 # die "long double not supported at this time, use double.";152 155 $nvmin = 'LDBL_MIN'; 153 156 $nvmax = 'LDBL_MAX'; 154 157 } 158 elsif ( $nv eq "float" ) { 159 $nvmin = 'FLOAT_MIN'; 160 $nvmax = 'FLOAT_MAX'; 161 } 155 162 else { 156 163 die qq{Configure.pl: Can't find limits for type '$nv'\n}; 157 164 } … … 164 171 if ( $@ ) { 165 172 $nvmin = '0'; 166 173 $nvmax = '0'; 174 $conf->data->set( floatvalmin => $nvmin ); 175 $conf->data->set( floatvalmax => $nvmax ); 167 176 } 168 177 169 178 } -
src/byteorder.c
old new 312 312 313 313 =item C<void fetch_buf_le_12> 314 314 315 Converts a 12-byte little-endian buffer C<b> into a big-endian buffer C< b>.315 Converts a 12-byte little-endian buffer C<b> into a big-endian buffer C<rb>. 316 316 317 317 =cut 318 318 … … 344 344 345 345 =item C<void fetch_buf_be_12> 346 346 347 Converts a 12-byte big-endian buffer C<b> into a little-endian buffer C< b>.347 Converts a 12-byte big-endian buffer C<b> into a little-endian buffer C<rb>. 348 348 349 349 =cut 350 350 … … 376 376 377 377 =item C<void fetch_buf_le_16> 378 378 379 Converts a 16-byte little-endian buffer C<b> into a big-endian buffer C< b>.379 Converts a 16-byte little-endian buffer C<b> into a big-endian buffer C<rb>. 380 380 381 381 =cut 382 382 … … 412 412 413 413 =item C<void fetch_buf_be_16> 414 414 415 Converts a 16-byte big-endian buffer C<b> into a little-endian buffer C< b>.415 Converts a 16-byte big-endian buffer C<b> into a little-endian buffer C<rb>. 416 416 417 417 =cut 418 418 … … 448 448 449 449 =item C<void fetch_buf_le_32> 450 450 451 Converts a 32-byte little-endian buffer C<b> into a big-endian buffer C< b>.451 Converts a 32-byte little-endian buffer C<b> into a big-endian buffer C<rb>. 452 452 453 453 =cut 454 454 … … 500 500 501 501 =item C<void fetch_buf_be_32> 502 502 503 Converts a 32-byte big-endian buffer C<b> into a little-endian buffer C< b>.503 Converts a 32-byte big-endian buffer C<b> into a little-endian buffer C<rb>. 504 504 505 505 =cut 506 506 … … 550 550 551 551 /* 552 552 553 =item C<void fetch_buf_generic> 554 555 Generic byteorder conversion from C<b> to C<rb>, 556 with given bytesize and source endian-ness. 557 558 This is used for the numeric converters in F<src/packfile/pf_items.c> 559 560 =cut 561 562 */ 563 564 void 565 fetch_buf_generic(ARGOUT(unsigned char *rb), 566 ARGIN(const unsigned char *b), 567 const int size, 568 const int byteorder) 569 { 570 ASSERT_ARGS(fetch_buf_generic) 571 572 /* 0==0 or 1==1 */ 573 if (byteorder == PARROT_BIGENDIAN) { 574 memcpy(rb, b, size); 575 } 576 else { 577 switch (size) { 578 #if PARROT_BIGENDIAN 579 case 4: 580 fetch_buf_le_4(rb, b); break; 581 case 8: 582 fetch_buf_le_8(rb, b); break; 583 case 12: 584 fetch_buf_le_12(rb, b); break; 585 case 16: 586 fetch_buf_le_16(rb, b); break; 587 case 32: 588 fetch_buf_le_32(rb, b); break; 589 #else 590 case 4: 591 fetch_buf_be_4(rb, b); break; 592 case 8: 593 fetch_buf_be_8(rb, b); break; 594 case 12: 595 fetch_buf_be_12(rb, b); break; 596 case 16: 597 fetch_buf_be_16(rb, b); break; 598 case 32: 599 fetch_buf_be_32(rb, b); break; 600 #endif 601 default: 602 exit_fatal(1, 603 "fetch_buf_generic: unsupported size=%d, byteorder=%d, " 604 "PARROT_BIGENDIAN=%d\n", 605 size, byteorder, PARROT_BIGENDIAN); 606 break; 607 } 608 } 609 } 610 611 612 /* 613 553 614 =back 554 615 555 616 =head1 HISTORY 556 617 557 618 Initial version by Melvin on 2002/05/01 558 619 620 Extended by Reini Urban 2009 621 559 622 =cut 560 623 561 624 */ -
src/packfile.c
old new 1237 1237 header->bc_minor = PARROT_PBC_MINOR; 1238 1238 #if NUMVAL_SIZE == 8 1239 1239 header->floattype = FLOATTYPE_8; 1240 #else 1241 # if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN 1240 #elif (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN 1242 1241 header->floattype = FLOATTYPE_12; 1243 # else 1244 # if (NUMVAL_SIZE == 16) 1242 #elif NUMVAL_SIZE == 16 1245 1243 header->floattype = FLOATTYPE_16; 1246 # else 1244 #elif NUMVAL_SIZE == 4 1245 header->floattype = FLOATTYPE_4; 1246 #else 1247 1247 exit_fatal(1, "PackFile_set_header: Unsupported floattype NUMVAL_SIZE=%d," 1248 1248 " PARROT_BIGENDIAN=%d\n", NUMVAL_SIZE, 1249 1249 PARROT_BIGENDIAN ? "big-endian" : "little-endian"); 1250 # endif1251 # endif1252 1250 #endif 1253 1251 } 1254 1252 … … 4654 4652 4655 4653 =head1 HISTORY 4656 4654 4657 Parrot_readbc and Parrot_loadbc renamed. Trace macros, long double and4658 64-bit conversion work by Reini Urban 2009.4655 Parrot_readbc and Parrot_loadbc renamed. Trace macros, long double, 4656 float and 64-bit conversion work by Reini Urban 2009. 4659 4657 4660 4658 Rework by Melvin; new bytecode format, make bytecode portable. (Do 4661 4659 endian conversion and wordsize transforms on the fly.) -
src/packfile/pf_items.c
old new 46 46 __attribute__nonnull__(2) 47 47 FUNC_MODIFIES(*dest); 48 48 49 static void cvt_num12_num 16_le(49 static void cvt_num12_num4( 50 50 ARGOUT(unsigned char *dest), 51 51 ARGIN(const unsigned char *src)) 52 52 __attribute__nonnull__(1) … … 60 60 __attribute__nonnull__(2) 61 61 FUNC_MODIFIES(*dest); 62 62 63 static void cvt_num12_num8_le(64 ARGOUT(unsigned char *dest),65 ARGIN(unsigned char *src))66 __attribute__nonnull__(1)67 __attribute__nonnull__(2)68 FUNC_MODIFIES(*dest);69 70 63 static void cvt_num16_num12( 71 64 ARGOUT(unsigned char *dest), 72 65 ARGIN(const unsigned char *src)) … … 74 67 __attribute__nonnull__(2) 75 68 FUNC_MODIFIES(*dest); 76 69 77 static void cvt_num16_num 12_be(70 static void cvt_num16_num4( 78 71 ARGOUT(unsigned char *dest), 79 72 ARGIN(const unsigned char *src)) 80 73 __attribute__nonnull__(1) … … 88 81 __attribute__nonnull__(2) 89 82 FUNC_MODIFIES(*dest); 90 83 91 static void cvt_num 16_num8_be(84 static void cvt_num4_num12( 92 85 ARGOUT(unsigned char *dest), 93 86 ARGIN(const unsigned char *src)) 94 87 __attribute__nonnull__(1) 95 88 __attribute__nonnull__(2) 96 89 FUNC_MODIFIES(*dest); 97 90 98 static void cvt_num16_num8_le( 99 ARGOUT(unsigned char *dest), 100 ARGIN(unsigned char *src)) 101 __attribute__nonnull__(1) 102 __attribute__nonnull__(2) 103 FUNC_MODIFIES(*dest); 104 105 static void cvt_num8_num12( 91 static void cvt_num4_num16( 106 92 ARGOUT(unsigned char *dest), 107 93 ARGIN(const unsigned char *src)) 108 94 __attribute__nonnull__(1) 109 95 __attribute__nonnull__(2) 110 96 FUNC_MODIFIES(*dest); 111 97 112 static void cvt_num 8_num12_be(98 static void cvt_num4_num8( 113 99 ARGOUT(unsigned char *dest), 114 100 ARGIN(const unsigned char *src)) 115 101 __attribute__nonnull__(1) 116 102 __attribute__nonnull__(2) 117 103 FUNC_MODIFIES(*dest); 118 104 119 static void cvt_num8_num1 6(105 static void cvt_num8_num12( 120 106 ARGOUT(unsigned char *dest), 121 107 ARGIN(const unsigned char *src)) 122 108 __attribute__nonnull__(1) 123 109 __attribute__nonnull__(2) 124 110 FUNC_MODIFIES(*dest); 125 111 126 static void cvt_num8_num16 _be(112 static void cvt_num8_num16( 127 113 ARGOUT(unsigned char *dest), 128 114 ARGIN(const unsigned char *src)) 129 115 __attribute__nonnull__(1) 130 116 __attribute__nonnull__(2) 131 117 FUNC_MODIFIES(*dest); 132 118 133 static void cvt_num8_num 16_le(119 static void cvt_num8_num4( 134 120 ARGOUT(unsigned char *dest), 135 121 ARGIN(const unsigned char *src)) 136 122 __attribute__nonnull__(1) … … 164 150 #define ASSERT_ARGS_cvt_num12_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 165 151 PARROT_ASSERT_ARG(dest) \ 166 152 || PARROT_ASSERT_ARG(src) 167 #define ASSERT_ARGS_cvt_num12_num 16_le__attribute__unused__ int _ASSERT_ARGS_CHECK = \153 #define ASSERT_ARGS_cvt_num12_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 168 154 PARROT_ASSERT_ARG(dest) \ 169 155 || PARROT_ASSERT_ARG(src) 170 156 #define ASSERT_ARGS_cvt_num12_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 171 157 PARROT_ASSERT_ARG(dest) \ 172 158 || PARROT_ASSERT_ARG(src) 173 #define ASSERT_ARGS_cvt_num12_num8_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \174 PARROT_ASSERT_ARG(dest) \175 || PARROT_ASSERT_ARG(src)176 159 #define ASSERT_ARGS_cvt_num16_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 177 160 PARROT_ASSERT_ARG(dest) \ 178 161 || PARROT_ASSERT_ARG(src) 179 #define ASSERT_ARGS_cvt_num16_num 12_be__attribute__unused__ int _ASSERT_ARGS_CHECK = \162 #define ASSERT_ARGS_cvt_num16_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 180 163 PARROT_ASSERT_ARG(dest) \ 181 164 || PARROT_ASSERT_ARG(src) 182 165 #define ASSERT_ARGS_cvt_num16_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 183 166 PARROT_ASSERT_ARG(dest) \ 184 167 || PARROT_ASSERT_ARG(src) 185 #define ASSERT_ARGS_cvt_num 16_num8_be__attribute__unused__ int _ASSERT_ARGS_CHECK = \168 #define ASSERT_ARGS_cvt_num4_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 186 169 PARROT_ASSERT_ARG(dest) \ 187 170 || PARROT_ASSERT_ARG(src) 188 #define ASSERT_ARGS_cvt_num 16_num8_le__attribute__unused__ int _ASSERT_ARGS_CHECK = \171 #define ASSERT_ARGS_cvt_num4_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 189 172 PARROT_ASSERT_ARG(dest) \ 190 173 || PARROT_ASSERT_ARG(src) 191 #define ASSERT_ARGS_cvt_num 8_num12__attribute__unused__ int _ASSERT_ARGS_CHECK = \174 #define ASSERT_ARGS_cvt_num4_num8 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 192 175 PARROT_ASSERT_ARG(dest) \ 193 176 || PARROT_ASSERT_ARG(src) 194 #define ASSERT_ARGS_cvt_num8_num12 _be__attribute__unused__ int _ASSERT_ARGS_CHECK = \177 #define ASSERT_ARGS_cvt_num8_num12 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 195 178 PARROT_ASSERT_ARG(dest) \ 196 179 || PARROT_ASSERT_ARG(src) 197 180 #define ASSERT_ARGS_cvt_num8_num16 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 198 181 PARROT_ASSERT_ARG(dest) \ 199 182 || PARROT_ASSERT_ARG(src) 200 #define ASSERT_ARGS_cvt_num8_num16_be __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 201 PARROT_ASSERT_ARG(dest) \ 202 || PARROT_ASSERT_ARG(src) 203 #define ASSERT_ARGS_cvt_num8_num16_le __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 183 #define ASSERT_ARGS_cvt_num8_num4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 204 184 PARROT_ASSERT_ARG(dest) \ 205 185 || PARROT_ASSERT_ARG(src) 206 186 #define ASSERT_ARGS_fetch_op_be_4 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ … … 239 219 * Floattype 0 = IEEE-754 8 byte double 240 220 * Floattype 1 = x86 little endian 12 byte long double 241 221 * Floattype 2 = IEEE-754 16 byte long double 222 * Floattype 3 = IEEE-754 4 byte single float 242 223 * 243 224 */ 244 225 … … 254 235 255 236 */ 256 237 238 #if NUMVAL_SIZE == 8 257 239 static void 258 240 cvt_num12_num8(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 259 241 { … … 331 313 332 314 /* 333 315 334 =item C<static void cvt_num16_num12>335 336 Converts IEEE 754 LE 16-byte long double to i386 LE 12-byte long double .337 See http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml338 339 Untested.340 341 =cut342 343 */344 345 #if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN346 static void347 cvt_num16_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))348 {349 ASSERT_ARGS(cvt_num16_num12)350 351 /*352 16-byte double (128 bits):353 sign 1 bit 127354 exp 15 bits 126-112355 man 112 bits 111-0356 to 12-byte double (96 bits):357 sign 1 bit 95358 exp 15 bits 94-80359 man 80 bits 79-0360 361 +-------+-------+-------+-------+-------+-------+--...--+-------+362 |src[15]|src[14]|src[13]|src[12]|src[11]|src[10]| ... |src[0] |363 S| E | F |364 +-------+-------+-------+-------+-------+-------+--...--+-------+365 1|<-----15----->|<----------------112 bits--------------------->|366 <---------------------------128 bits---------------------------->367 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit)368 369 +-------+-------+-------+-------+-------+-------+--...--+-------+370 |dest[11]dest[10]dest[9]|dest[8]|dest[7]|dest[6]| ... |dest[0]|371 S| E | F |372 +-------+-------+-------+-------+-------+-------+--...--+-------+373 1|<-----15----->|<----------------80 bits---------------------->|374 <----------------------------96 bits---------------------------->375 12-byte LONG DOUBLE FLOATING-POINT (i386 special)376 377 */378 379 memset(dest, 0, 12);380 /* simply copy over sign + exp */381 TRACE_PRINTF_2((" cvt_num16_num12: sign+exp=0x%2x\n", src[15]));382 dest[11] = src[15];383 dest[12] = src[14];384 /* and trunc the rest */385 memcpy(&dest[10], &src[13], 10);386 TRACE_PRINTF_2((" cvt_num16_num12: mantissa=0x%10x, double=%lf\n",387 src[13], (long double)*dest));388 }389 #endif390 391 /*392 393 =item C<static void cvt_num12_num16>394 395 Converts i386 LE 12-byte long double to IEEE 754 LE 16-byte long double.396 397 Untested.398 Fallback 12->8->16 disabled.399 400 =cut401 402 */403 404 #if (NUMVAL_SIZE == 16)405 static void406 cvt_num12_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))407 {408 ASSERT_ARGS(cvt_num12_num16)409 # if 0410 unsigned char b[8];411 cvt_num12_num8(b, src);412 cvt_num8_num16(dest, b);413 # endif414 /*415 12-byte double (96 bits):416 sign 1 bit 95417 exp 15 bits 94-80418 man 80 bits 79-0419 to 16-byte double (128 bits):420 sign 1 bit 127421 exp 15 bits 126-112422 man 112 bits 111-0423 424 +-------+-------+-------+-------+-------+-------+--...--+-------+425 |src[11]|src[10]| src[9]| src[8]| src[7]| src[6]| ... | src[0]|426 S| E | F |427 +-------+-------+-------+-------+-------+-------+--...--+-------+428 1|<-----15----->|<----------------80 bits---------------------->|429 <----------------------------96 bits---------------------------->430 12-byte LONG DOUBLE FLOATING-POINT (i386 special)431 432 +-------+-------+-------+-------+-------+-------+--...--+-------+433 |dest[15]dest[14]dest[13]dest[12]dest[11]dest[10] ... |dest[0]|434 S| E | F |435 +-------+-------+-------+-------+-------+-------+--...--+-------+436 1|<-----15----->|<----------------112 bits--------------------->|437 <---------------------------128 bits---------------------------->438 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit)439 440 */441 442 memset(dest, 0, 16);443 /* simply copy over sign + exp */444 TRACE_PRINTF_2((" cvt_num12_num16: sign+exp=0x%2x\n", src[11]));445 dest[15] = src[11];446 dest[14] = src[12];447 /* and trunc the rest */448 memcpy(&dest[13], &src[9], 10);449 TRACE_PRINTF_2((" cvt_num12_num15: mantissa=0x%10x, double=%lf\n",450 src[19], (long double)*dest));451 }452 #endif453 /*454 455 316 =item C<static void cvt_num16_num8> 456 317 457 318 Converts IEEE 754 16-byte long double to IEEE 754 8 byte double. … … 554 415 dest[0] |= src[1] >> 3; 555 416 } 556 417 } 557 558 418 /* 559 419 560 =item C<static void cvt_num 8_num16>420 =item C<static void cvt_num4_num8> 561 421 562 Converts IEEE 754 8-byte double to IEEE 754 16 byte longdouble.422 Converts IEEE 754 4-byte single-float to IEEE 754 8 byte double. 563 423 564 424 Untested. 565 425 … … 567 427 568 428 */ 569 429 570 #if (NUMVAL_SIZE == 16)571 430 static void 572 cvt_num 8_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))431 cvt_num4_num8(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 573 432 { 574 ASSERT_ARGS(cvt_num 8_num16)433 ASSERT_ARGS(cvt_num4_num8) 575 434 /* The compiler can do this for us */ 576 long double ld;577 435 double d; 578 memcpy(&d, src, 8); 579 ld = (long double)d; /* TODO: test compiler cast */ 580 /*TRACE_PRINTF_2((" cvt_num8_num16: d=%f, ld=%lf\n", d, ld));*/ 581 memcpy(dest, &ld, 16); 436 float f; 437 438 memcpy(&f, src, 4); 439 d = (double)f; /* TODO: test compiler cast */ 440 TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%f\n", f, d));*/ 441 memcpy(dest, &d, 8); 582 442 } 443 583 444 #endif 584 445 585 446 /* 586 447 587 =item C<static void cvt_num 8_num12>448 =item C<static void cvt_num16_num12> 588 449 589 Converts i386 8-byte double to i386 12 byte long double. 450 Converts IEEE 754 LE 16-byte long double to i386 LE 12-byte long double . 451 See http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml 590 452 591 Tested ok.453 Untested. 592 454 593 455 =cut 594 456 … … 596 458 597 459 #if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN 598 460 static void 599 cvt_num 8_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))461 cvt_num16_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 600 462 { 601 ASSERT_ARGS(cvt_num8_num12) 602 long double ld; 603 double d; 604 memcpy(&d, src, 8); 605 ld = (long double)d; /* compiler cast */ 606 /*TRACE_PRINTF_2((" cvt_num8_num12: ld=%lf, d=%f\n", ld, d));*/ 607 memcpy(dest, &ld, 12); 463 ASSERT_ARGS(cvt_num16_num12) 464 465 /* 466 16-byte double (128 bits): 467 sign 1 bit 127 468 exp 15 bits 126-112 469 man 112 bits 111-0 470 to 12-byte double (96 bits): 471 sign 1 bit 95 472 exp 15 bits 94-80 473 man 80 bits 79-0 474 475 +-------+-------+-------+-------+-------+-------+--...--+-------+ 476 |src[15]|src[14]|src[13]|src[12]|src[11]|src[10]| ... |src[0] | 477 S| E | F | 478 +-------+-------+-------+-------+-------+-------+--...--+-------+ 479 1|<-----15----->|<----------------112 bits--------------------->| 480 <---------------------------128 bits----------------------------> 481 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) 482 483 +-------+-------+-------+-------+-------+-------+--...--+-------+ 484 |dest[11]dest[10]dest[9]|dest[8]|dest[7]|dest[6]| ... |dest[0]| 485 S| E | F | 486 +-------+-------+-------+-------+-------+-------+--...--+-------+ 487 1|<-----15----->|<----------------80 bits---------------------->| 488 <----------------------------96 bits----------------------------> 489 12-byte LONG DOUBLE FLOATING-POINT (i386 special) 490 491 */ 492 493 memset(dest, 0, 12); 494 /* simply copy over sign + exp */ 495 TRACE_PRINTF_2((" cvt_num16_num12: sign+exp=0x%2x\n", src[15])); 496 dest[11] = src[15]; 497 dest[12] = src[14]; 498 /* and trunc the rest */ 499 memcpy(&dest[10], &src[13], 10); 500 TRACE_PRINTF_2((" cvt_num16_num12: mantissa=0x%10x, double=%lf\n", 501 src[13], (long double)*dest)); 608 502 } 609 #endif610 503 611 504 612 505 /* 613 506 614 =item C<static void cvt_num8_num12 _be>507 =item C<static void cvt_num8_num12> 615 508 616 Converts a big-endian IEEE 754 8-byte double to i386 LE 12-byte long double.509 Converts i386 8-byte double to i386 12 byte long double. 617 510 618 511 Tested ok. 619 512 … … 621 514 622 515 */ 623 516 624 #if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN625 517 static void 626 cvt_num8_num12 _be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))518 cvt_num8_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 627 519 { 628 ASSERT_ARGS(cvt_num8_num12_be) 629 unsigned char b[8]; 630 fetch_buf_be_8(b, src); 631 /*TRACE_PRINTF_2((" cvt_num8_num12_be: 0x%8x\n", b));*/ 632 cvt_num8_num12(dest, b); 520 ASSERT_ARGS(cvt_num8_num12) 521 long double ld; 522 double d; 523 memcpy(&d, src, 8); 524 ld = (long double)d; /* compiler cast */ 525 /*TRACE_PRINTF_2((" cvt_num8_num12: ld=%lf, d=%f\n", ld, d));*/ 526 memcpy(dest, &ld, 12); 633 527 } 634 #endif635 528 636 529 /* 637 530 638 =item C<static void cvt_num 8_num16_le>531 =item C<static void cvt_num4_num12> 639 532 640 Converts a little-endian IEEE 754 8-byte double to big-endian 16-byte longdouble.533 Converts IEEE 754 4-byte single-float to ix86 12 byte double. 641 534 642 535 Untested. 643 536 … … 645 538 646 539 */ 647 540 648 #if (NUMVAL_SIZE == 16) && PARROT_BIGENDIAN649 541 static void 650 cvt_num 8_num16_le(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))542 cvt_num4_num12(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 651 543 { 652 ASSERT_ARGS(cvt_num8_num16_le) 653 unsigned char b[8]; 654 fetch_buf_be_8(b, src); /* TODO test endianize */ 655 TRACE_PRINTF_2((" cvt_num8_num16_le: 0x%8x\n", b)); 656 cvt_num8_num16(dest, b); 544 ASSERT_ARGS(cvt_num4_num12) 545 /* The compiler can do this for us */ 546 long double ld; 547 float f; 548 549 memcpy(&f, src, 4); 550 ld = (long double)f; /* TODO: test compiler cast */ 551 TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%lf\n", f, ld));*/ 552 memcpy(dest, &ld, 12); 657 553 } 554 658 555 #endif 659 556 660 557 /* 661 558 662 =item C<static void cvt_num12_num16 _le>559 =item C<static void cvt_num12_num16> 663 560 664 Converts a little-endian 12-byte double to big-endian16-byte long double.561 Converts i386 LE 12-byte long double to IEEE 754 LE 16-byte long double. 665 562 666 563 Untested. 564 Fallback 12->8->16 disabled. 667 565 668 566 =cut 669 567 670 568 */ 671 569 672 #if (NUMVAL_SIZE == 16) && PARROT_BIGENDIAN570 #if NUMVAL_SIZE == 16 673 571 static void 674 cvt_num12_num16 _le(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))572 cvt_num12_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 675 573 { 676 ASSERT_ARGS(cvt_num12_num16_le) 677 unsigned char b[12]; 678 fetch_buf_be_12(b, src); /* TODO test endianize */ 679 TRACE_PRINTF_2((" cvt_num12_num16_le: 0x%8x\n", b)); 680 cvt_num12_num16(dest, b); 681 } 682 #endif 683 684 /* 685 686 =item C<static void cvt_num12_num8_le> 687 688 Converts a little-endian 12-byte i386 long double into a IEEE 754 8-byte double. 574 ASSERT_ARGS(cvt_num12_num16) 575 # if 0 576 unsigned char b[8]; 577 cvt_num12_num8(b, src); 578 cvt_num8_num16(dest, b); 579 # endif 580 /* 581 12-byte double (96 bits): 582 sign 1 bit 95 583 exp 15 bits 94-80 584 man 80 bits 79-0 585 to 16-byte double (128 bits): 586 sign 1 bit 127 587 exp 15 bits 126-112 588 man 112 bits 111-0 689 589 690 Untested. 590 +-------+-------+-------+-------+-------+-------+--...--+-------+ 591 |src[11]|src[10]| src[9]| src[8]| src[7]| src[6]| ... | src[0]| 592 S| E | F | 593 +-------+-------+-------+-------+-------+-------+--...--+-------+ 594 1|<-----15----->|<----------------80 bits---------------------->| 595 <----------------------------96 bits----------------------------> 596 12-byte LONG DOUBLE FLOATING-POINT (i386 special) 691 597 692 =cut 598 +-------+-------+-------+-------+-------+-------+--...--+-------+ 599 |dest[15]dest[14]dest[13]dest[12]dest[11]dest[10] ... |dest[0]| 600 S| E | F | 601 +-------+-------+-------+-------+-------+-------+--...--+-------+ 602 1|<-----15----->|<----------------112 bits--------------------->| 603 <---------------------------128 bits----------------------------> 604 16-byte LONG DOUBLE FLOATING-POINT (IA64 or BE 64-bit) 693 605 694 */606 */ 695 607 696 #if PARROT_BIGENDIAN 697 static void 698 cvt_num12_num8_le(ARGOUT(unsigned char *dest), ARGIN(unsigned char *src)) 699 { 700 ASSERT_ARGS(cvt_num12_num8_le)701 unsigned char b[12];702 fetch_buf_le_12(b, src); /* TODO test endianize */703 TRACE_PRINTF_2((" cvt_num12_num 8_le: 0x%12x\n", b));704 cvt_num12_num8(dest, b);608 memset(dest, 0, 16); 609 /* simply copy over sign + exp */ 610 TRACE_PRINTF_2((" cvt_num12_num16: sign+exp=0x%2x\n", src[11])); 611 dest[15] = src[11]; 612 dest[14] = src[12]; 613 /* and trunc the rest */ 614 memcpy(&dest[13], &src[9], 10); 615 TRACE_PRINTF_2((" cvt_num12_num15: mantissa=0x%10x, double=%lf\n", 616 src[19], (long double)*dest)); 705 617 } 706 #endif707 618 708 619 /* 709 620 710 =item C<static void cvt_num 16_num8_le>621 =item C<static void cvt_num8_num16> 711 622 712 Converts a little-endian IEEE 754 intel 16-byte long double into a 713 big-endian IEEE 754 8-byte double. 623 Converts IEEE 754 8-byte double to IEEE 754 16 byte long double. 714 624 715 625 Untested. 716 626 … … 718 628 719 629 */ 720 630 721 #if PARROT_BIGENDIAN722 631 static void 723 cvt_num 16_num8_le(ARGOUT(unsigned char *dest), ARGIN(unsigned char *src))632 cvt_num8_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 724 633 { 725 ASSERT_ARGS(cvt_num16_num8_le) 726 unsigned char b[16]; 727 fetch_buf_le_16(b, src); 728 TRACE_PRINTF_2((" cvt_num16_num8_le: 0x%16x\n", b)); 729 cvt_num16_num8(dest, b); 634 ASSERT_ARGS(cvt_num8_num16) 635 /* The compiler can do this for us */ 636 long double ld; 637 double d; 638 memcpy(&d, src, 8); 639 ld = (long double)d; /* TODO: test compiler cast */ 640 /*TRACE_PRINTF_2((" cvt_num8_num16: d=%f, ld=%lf\n", d, ld));*/ 641 memcpy(dest, &ld, 16); 730 642 } 731 #endif732 643 733 644 /* 734 645 735 =item C<static void cvt_num 16_num8_be>646 =item C<static void cvt_num4_num16> 736 647 737 Converts a big-endian IEEE 754 16-byte long double into a IEEE 754 8-bytedouble.648 Converts IEEE 754 4-byte single-float to IEEE 754 16 byte long double. 738 649 739 650 Untested. 740 651 … … 742 653 743 654 */ 744 655 745 #if !PARROT_BIGENDIAN746 656 static void 747 cvt_num 16_num8_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))657 cvt_num4_num16(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 748 658 { 749 ASSERT_ARGS(cvt_num16_num8_be) 750 unsigned char b[16]; 751 fetch_buf_be_16(b, src); 752 TRACE_PRINTF_2((" cvt_num16_num8_be: 0x%16x\n", b)); 753 cvt_num16_num8(dest, b); 659 ASSERT_ARGS(cvt_num4_num8) 660 /* The compiler can do this for us */ 661 long double ld; 662 float f; 663 664 memcpy(&f, src, 4); 665 ld = (long double)f; /* TODO: test compiler cast */ 666 TRACE_PRINTF_2((" cvt_num4_num8: d=%f, ld=%lf\n", f, ld));*/ 667 memcpy(dest, &ld, 16); 754 668 } 669 755 670 #endif 756 671 757 672 /* 758 673 759 =item C<static void cvt_num 16_num12_be>674 =item C<static void cvt_num8_num4> 760 675 761 Converts a big-endian IEEE 754 16-byte long double into a 12-byte i386 long double. 676 Converts IEEE 754 8-byte double to IEEE 754 4-byte double. 677 See also http://www.mrob.com/pub/math/floatformats.html 762 678 763 679 Untested. 764 680 … … 766 682 767 683 */ 768 684 769 #if (NUMVAL_SIZE == 12) && !PARROT_BIGENDIAN685 #if NUMVAL_SIZE == 4 770 686 static void 771 cvt_num 16_num12_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))687 cvt_num8_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 772 688 { 773 ASSERT_ARGS(cvt_num16_num12_be) 774 unsigned char b[16]; 775 fetch_buf_be_16(b, src); 776 TRACE_PRINTF_2((" cvt_num16_num12_be: 0x%16x\n", b)); 777 cvt_num16_num12(dest, b); 778 } 779 #endif 689 ASSERT_ARGS(cvt_num8_num4) 690 /* if we are lucky and this cpu can do double */ 691 #if DOUBLE_SIZE == 8 780 692 781 /* 693 double d; 694 float f; 782 695 783 =item C<static void cvt_num8_num16_be> 696 memcpy(&d, src, 8); 697 f = (float)d; /* compiler cast */ 698 memcpy(dest, &f, 4); 784 699 785 Converts a big-endian IEEE 754 8-byte double to little-endian IEEE 754 16 byte 786 long double. 700 #else 787 701 788 Untested. 702 int expo, i, s; 703 # ifdef __LCC__ 704 int expo2; 705 # endif 789 706 790 =cut 707 /* 708 8-byte double (64 bits): 709 sign 1 bit 63 710 exp 11 bits 62-52 711 man 52 bits 51-0 712 to 4-byte double (32 bits): 713 sign 1 bit 31 714 exp 8 bits 30-23 715 man 23 bits 22-0 791 716 792 */ 717 +-------+-------+-------+-------+-------+-------+-------+-------+ 718 |src[7] | src[6]| src[5]| src[4]| src[3]|src[2] |src[1] |src[0] | 719 S| E | F | 720 +-------+-------+-------+-------+-------+-------+-------+-------+ 721 1|<---11--->|<------|-------|-------|------52 bits------------->| 722 <----------------------------64 bits----------------------------> 723 8-byte DOUBLE FLOATING-POINT 724 725 +-------+-------+-------+-------+ 726 |dest[3]|dest[2]|dest[1]|dest[0]| 727 S| E | F | 728 +-------+-------+-------+-------+ 729 1|<--8-->|<------|--23bit|----->| 730 <------------32 bits------------> 731 4-byte single float 732 */ 733 734 memset(dest, 0, 4); 735 /* exponents 11 -> 7 bits */ 736 s = src[7] & 0x80; /* sign */ 737 738 expo = (((src[7] & 0x7f)<< 8) | (src[6] & 0xf0)); /* 11110000 */ 739 if (expo == 0) { 740 nul: 741 if (s) 742 dest[3] |= 0x80; 743 return; 744 } 745 # ifdef __LCC__ 746 expo2 = expo - 1023; 747 expo = expo2; 748 # else 749 expo -= 1023; /* - bias 8byte */ 750 # endif 751 expo += 127; /* + bias 4byte */ 752 if (expo <= 0) /* underflow */ 753 goto nul; 754 if (expo > 0x7ff) { /* inf/nan */ 755 dest[3] = 0x7f; 756 dest[2] = src[7] == 0xc0 ? 0xf8 : 0xf0 ; /* XXX */ 757 goto nul; 758 } 759 expo <<= 4; 760 dest[2] = (expo & 0x80); 761 dest[3] = (expo & 0x7f00) >> 8; 762 if (s) 763 dest[3] |= 0x80; 764 /* copy the mantissa: 52 bits => 23 bits */ 765 dest[2] |= src[6] >> 4; 766 dest[1] |= src[6] << 7 | src[5] >> 4; 767 dest[0] |= src[5] << 4 | src[4] >> 4; 768 #endif 769 } 793 770 794 #if (NUMVAL_SIZE == 16) && !PARROT_BIGENDIAN795 771 static void 796 cvt_num 8_num16_be(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src))772 cvt_num12_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 797 773 { 798 ASSERT_ARGS(cvt_num8_num16_be) 799 unsigned char b[8]; 800 fetch_buf_be_8(b, src); 801 cvt_num8_num16(dest, b); 774 exit_fatal(1, "Unsupported floattype conversion " 775 "12-byte long double to 4-byte float\n"); 776 } 777 778 static void 779 cvt_num16_num4(ARGOUT(unsigned char *dest), ARGIN(const unsigned char *src)) 780 { 781 exit_fatal(1, "Unsupported floattype conversion " 782 "16-byte long double to 4-byte float\n"); 802 783 } 803 784 #endif 804 785 786 805 787 #if 0 806 788 807 789 /* … … 1177 1159 /* When we have alignment all squared away we don't need 1178 1160 * to use memcpy() for native byteorder. */ 1179 1161 FLOATVAL f; 1180 double d; 1162 int need_endianize; 1163 int floatsize; 1181 1164 if (!pf || !pf->fetch_nv) { 1182 1165 TRACE_PRINTF(("PF_fetch_number: Native [%d bytes]\n", 1183 1166 sizeof (FLOATVAL))); … … 1187 1170 sizeof (opcode_t); 1188 1171 return f; 1189 1172 } 1173 1190 1174 f = (FLOATVAL) 0; 1191 TRACE_PRINTF(("PF_fetch_number at 0x%x: Converting...\n", OFFS(*stream))); 1192 /* 12->8 has a messy cast. */ 1193 if (NUMVAL_SIZE == 8 && pf->header->floattype == FLOATTYPE_12) { 1194 (pf->fetch_nv)((unsigned char *)&d, (const unsigned char *) *stream); 1195 f = d; 1196 TRACE_PRINTF_VAL(("PF_fetch_number: cast %f\n", f)); 1175 need_endianize = pf->header->byteorder != PARROT_BIGENDIAN; 1176 floatsize = PF_floattype_size(pf->header->floattype); 1177 TRACE_PRINTF(("PF_fetch_number at 0x%x: byteorder=%d, floatsize=%d\n", 1178 OFFS(*stream), pf->header->byteorder, floatsize)); 1179 1180 if (need_endianize) { 1181 unsigned char b[32]; /* max. floatvalsize */ 1182 /* generic endianizer */ 1183 fetch_buf_generic(b, (const unsigned char *) *stream, 1184 PF_floattype_size(pf->header->floattype), 1185 pf->header->byteorder); 1186 (pf->fetch_nv)((unsigned char *)&f, b); 1187 TRACE_PRINTF_VAL(("PF_fetch_number: %f *endianized*\n", f)); 1197 1188 } 1198 1189 else { 1199 1190 (pf->fetch_nv)((unsigned char *)&f, (const unsigned char *) *stream); 1200 1191 TRACE_PRINTF_VAL(("PF_fetch_number: %f\n", f)); 1201 1192 } 1202 if (pf->header->floattype == FLOATTYPE_8) { 1203 *((const unsigned char **) (stream)) += 8; 1204 } 1205 else if (pf->header->floattype == FLOATTYPE_12) { 1206 *((const unsigned char **) (stream)) += 12; 1207 } 1208 else if (pf->header->floattype == FLOATTYPE_16) { 1209 *((const unsigned char **) (stream)) += 16; 1210 } 1211 else if (pf->header->floattype == FLOATTYPE_16MIPS) { 1212 *((const unsigned char **) (stream)) += 16; 1213 } 1214 else if (pf->header->floattype == FLOATTYPE_16AIX) { 1215 *((const unsigned char **) (stream)) += 16; 1216 } 1217 else if (pf->header->floattype == FLOATTYPE_4) { 1218 *((const unsigned char **) (stream)) += 4; 1219 } 1193 *((const unsigned char **) (stream)) += floatsize; 1220 1194 return f; 1221 1195 } 1222 1196 … … 1477 1451 */ 1478 1452 1479 1453 PARROT_PURE_FUNCTION 1454 PARROT_WARN_UNUSED_RESULT 1480 1455 size_t 1481 1456 PF_size_cstring(ARGIN(const char *s)) 1482 1457 { … … 1490 1465 1491 1466 /* 1492 1467 1468 =item C<int PF_floattype_size> 1469 1470 Returns the numval size in bytes for the given internal floattype 1471 - usually from C<pf->header->floattype>. 1472 1473 =cut 1474 1475 */ 1476 1477 PARROT_CONST_FUNCTION 1478 int 1479 PF_floattype_size(const int floattype) 1480 { 1481 ASSERT_ARGS(PF_floattype_size) 1482 1483 switch (floattype) { 1484 case FLOATTYPE_4: return 4; 1485 case FLOATTYPE_8: return 8; 1486 case FLOATTYPE_12: return 12; 1487 case FLOATTYPE_16: return 16; 1488 case FLOATTYPE_16AIX: return 16; 1489 case FLOATTYPE_16MIPS: return 16; 1490 case FLOATTYPE_32: return 32; 1491 default: 1492 exit_fatal(1, "PF_floattype_size: Unsupported floattype=%d\n", 1493 floattype); 1494 return 0; 1495 } 1496 } 1497 1498 /* 1499 1493 1500 =item C<void PackFile_assign_transforms> 1494 1501 1495 1502 Assigns transform functions to the vtable. … … 1518 1525 pf->fetch_iv = pf->fetch_op; 1519 1526 1520 1527 switch (pf->header->floattype) { 1521 # if NUMVAL_SIZE == 8 1528 # if NUMVAL_SIZE == 4 1529 case FLOATTYPE_4: 1530 pf->fetch_nv = fetch_buf_le_4; 1531 break; 1532 case FLOATTYPE_8: 1533 pf->fetch_nv = cvt_num8_num4; 1534 break; 1535 case FLOATTYPE_12: 1536 pf->fetch_nv = cvt_num12_num4; 1537 break; 1538 case FLOATTYPE_16: 1539 pf->fetch_nv = cvt_num16_num4; 1540 break; 1541 # elif NUMVAL_SIZE == 8 1542 case FLOATTYPE_4: 1543 pf->fetch_nv = cvt_num4_num8; 1544 break; 1522 1545 case FLOATTYPE_8: 1523 1546 pf->fetch_nv = fetch_buf_le_8; 1524 1547 break; 1525 1548 case FLOATTYPE_12: 1526 pf->fetch_nv = cvt_num12_num8 _le;1549 pf->fetch_nv = cvt_num12_num8; 1527 1550 break; 1528 1551 case FLOATTYPE_16: 1529 pf->fetch_nv = cvt_num16_num8_le; 1552 pf->fetch_nv = cvt_num16_num8; 1553 break; 1554 # elif NUMVAL_SIZE == 16 1555 case FLOATTYPE_4: 1556 pf->fetch_nv = cvt_num4_num16; 1530 1557 break; 1531 # endif1532 # if NUMVAL_SIZE == 161533 1558 case FLOATTYPE_8: 1534 pf->fetch_nv = cvt_num8_num16 _le;1559 pf->fetch_nv = cvt_num8_num16; 1535 1560 break; 1536 1561 case FLOATTYPE_12: 1537 pf->fetch_nv = cvt_num12_num16 _le;1562 pf->fetch_nv = cvt_num12_num16; 1538 1563 break; 1539 1564 case FLOATTYPE_16: 1540 1565 pf->fetch_nv = fetch_buf_le_16; … … 1557 1582 pf->fetch_iv = pf->fetch_op; 1558 1583 1559 1584 switch (pf->header->floattype) { 1560 # if NUMVAL_SIZE == 8 1585 # if NUMVAL_SIZE == 4 1586 case FLOATTYPE_4: 1587 break; 1588 case FLOATTYPE_8: 1589 pf->fetch_nv = cvt_num8_num4; 1590 break; 1591 case FLOATTYPE_12: 1592 pf->fetch_nv = cvt_num12_num4; 1593 break; 1594 case FLOATTYPE_16: 1595 pf->fetch_nv = cvt_num16_num4; 1596 break; 1597 # elif NUMVAL_SIZE == 8 1598 case FLOATTYPE_4: 1599 pf->fetch_nv = cvt_num4_num8; 1600 break; 1561 1601 case FLOATTYPE_8: /* native */ 1562 1602 break; 1563 1603 case FLOATTYPE_12: … … 1566 1606 case FLOATTYPE_16: 1567 1607 pf->fetch_nv = cvt_num16_num8; 1568 1608 break; 1569 # endif 1570 # if NUMVAL_SIZE == 16 1609 # elif NUMVAL_SIZE == 16 1610 case FLOATTYPE_4: 1611 pf->fetch_nv = cvt_num4_num16; 1612 break; 1571 1613 case FLOATTYPE_8: 1572 1614 pf->fetch_nv = cvt_num8_num16; 1573 1615 break; … … 1598 1640 pf->fetch_iv = pf->fetch_op; 1599 1641 1600 1642 switch (pf->header->floattype) { 1601 # if NUMVAL_SIZE == 8 1643 # if NUMVAL_SIZE == 4 1644 case FLOATTYPE_4: 1645 pf->fetch_nv = fetch_buf_be_4; 1646 break; 1647 case FLOATTYPE_8: 1648 pf->fetch_nv = cvt_num8_num4; 1649 break; 1650 case FLOATTYPE_12: 1651 exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); 1652 break; 1653 case FLOATTYPE_16: 1654 pf->fetch_nv = cvt_num16_num4; 1655 break; 1656 # elif NUMVAL_SIZE == 8 1657 case FLOATTYPE_4: 1658 pf->fetch_nv = cvt_num4_num8; 1659 break; 1602 1660 case FLOATTYPE_8: 1603 1661 pf->fetch_nv = fetch_buf_be_8; 1604 1662 break; … … 1606 1664 exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); 1607 1665 break; 1608 1666 case FLOATTYPE_16: 1609 pf->fetch_nv = cvt_num16_num8_be; 1667 pf->fetch_nv = cvt_num16_num8; 1668 break; 1669 # elif NUMVAL_SIZE == 12 1670 case FLOATTYPE_4: 1671 pf->fetch_nv = cvt_num4_num12; 1610 1672 break; 1611 # endif1612 # if NUMVAL_SIZE == 121613 1673 case FLOATTYPE_8: 1614 pf->fetch_nv = cvt_num8_num12 _be;1674 pf->fetch_nv = cvt_num8_num12; 1615 1675 break; 1616 1676 case FLOATTYPE_12: 1617 1677 exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); 1618 1678 break; 1619 1679 case FLOATTYPE_16: 1620 pf->fetch_nv = cvt_num16_num12_be; 1680 pf->fetch_nv = cvt_num16_num12; 1681 break; 1682 # elif NUMVAL_SIZE == 16 1683 case FLOATTYPE_4: 1684 pf->fetch_nv = cvt_num4_num16; 1621 1685 break; 1622 # endif1623 # if NUMVAL_SIZE == 161624 1686 case FLOATTYPE_8: 1625 pf->fetch_nv = cvt_num8_num16 _be;1687 pf->fetch_nv = cvt_num8_num16; 1626 1688 break; 1627 1689 case FLOATTYPE_12: 1628 1690 exit_fatal(1, "PackFile_unpack: invalid floattype 1 big-endian"); … … 1648 1710 pf->fetch_iv = pf->fetch_op; 1649 1711 1650 1712 switch (pf->header->floattype) { 1651 # if NUMVAL_SIZE == 8 1713 # if NUMVAL_SIZE == 4 1714 case FLOATTYPE_4: /* native */ 1715 break; 1716 case FLOATTYPE_8: 1717 pf->fetch_nv = cvt_num8_num4; 1718 break; 1719 case FLOATTYPE_12: 1720 pf->fetch_nv = cvt_num12_num4; 1721 break; 1722 case FLOATTYPE_16: 1723 pf->fetch_nv = cvt_num16_num4; 1724 break; 1725 # elif NUMVAL_SIZE == 8 1726 case FLOATTYPE_4: 1727 pf->fetch_nv = cvt_num4_num8; 1728 break; 1652 1729 case FLOATTYPE_8: /* native */ 1653 1730 break; 1654 1731 case FLOATTYPE_12: … … 1657 1734 case FLOATTYPE_16: 1658 1735 pf->fetch_nv = cvt_num16_num8; 1659 1736 break; 1660 # endif 1661 # if NUMVAL_SIZE == 12 1737 # elif NUMVAL_SIZE == 12 1738 case FLOATTYPE_4: 1739 pf->fetch_nv = cvt_num4_num12; 1740 break; 1662 1741 case FLOATTYPE_8: 1663 1742 pf->fetch_nv = cvt_num8_num12; 1664 1743 break; … … 1667 1746 case FLOATTYPE_16: 1668 1747 pf->fetch_nv = cvt_num16_num12; 1669 1748 break; 1670 # endif 1671 # if NUMVAL_SIZE == 16 1749 # elif NUMVAL_SIZE == 16 1750 case FLOATTYPE_4: 1751 pf->fetch_nv = cvt_num4_num16; 1752 break; 1672 1753 case FLOATTYPE_8: 1673 1754 pf->fetch_nv = cvt_num8_num16; 1674 1755 break; -
config/auto/jit.pm
old new 53 53 54 54 my $cpuarch = $conf->data->get('cpuarch'); 55 55 my $osname = $conf->data->get('osname'); 56 my $nvsize = $conf->data->get('nvsize'); 56 57 57 58 my $jitbase = $self->{jitbase_default}; # base path for jit sources 58 59 … … 62 63 if $verbose; 63 64 64 65 my $jitcapable = 65 $self->_check_jitcapability($corejit, $cpuarch, $osname );66 $self->_check_jitcapability($corejit, $cpuarch, $osname, $nvsize); 66 67 67 68 my $jitarchname = "$cpuarch-$osname"; 68 69 _handle_asm( { … … 148 149 149 150 sub _check_jitcapability { 150 151 my $self = shift; 151 my ($corejit, $cpuarch, $osname ) = @_;152 my ($corejit, $cpuarch, $osname, $nvsize) = @_; 152 153 my $jitcapable = 0; 153 154 if ( -e $corejit ) { 154 155 … … 162 163 $jitcapable = 1; 163 164 } 164 165 166 # Can only jit double. For long double see patch in TT #352. 167 # float not yet planned. 168 if ( $nvsize != 8 ) { 169 $jitcapable = 0; 170 } 171 165 172 # Another exception 166 173 if ( $cpuarch eq 'i386' && $osname eq 'darwin' ) { 167 174 $jitcapable = 0; -
t/native_pbc/header.t
old new 64 64 is( $h{magic}, "\xfe\x50\x42\x43\x0a\x1a\x0a", "magic string 0xfePBC0x0a0x1a0x0a len=7" ); 65 65 ok( $h{wordsize} == 2 || $h{wordsize} == 4 || $h{wordsize} == 8, "wordsize: $h{wordsize}" ); 66 66 ok( $h{byteorder} < 2, "byteorder: $h{byteorder}" ); 67 ok( $h{floattype} < 3, "floattype: $h{floattype}" );67 ok( $h{floattype} <= 3, "floattype: $h{floattype}" ); 68 68 is( $h{major}, $PConfig{MAJOR}, "major version: $h{major} vs $PConfig{MAJOR}" ); 69 69 is( $h{minor}, $PConfig{MINOR}, "minor version: $h{minor} vs $PConfig{MINOR}" ); 70 70 is( $h{patch}, $PConfig{PATCH}, "patch version: $h{patch} vs $PConfig{PATCH}" ); -
t/native_pbc/number.t
old new 55 55 56 56 =cut 57 57 58 # tt #357: need bettertestmatrix for coverage overview58 # tt #357: testmatrix for coverage overview 59 59 # float conversion src: left-side (pbc) to dest: upper-side (platform) 60 60 # 1: tested ok, 0: fails (skip), ?: not yet tested (todo) 61 61 my $testmatrix = <<EOF; 62 8_le 12_le 16_le 8_be 16_be 63 8_le 1 1 0 1 ? 64 12_le 1 1 0 0 ? 65 16_le 1 1 1 ? ? 66 8_be 1 1 ? 1 ? 67 16_be 1 1 1 ? 1 62 8_le 12_le 16_le 8_be 16_be 4_le 63 8_le 1 1 0 1 0 1 64 12_le 1 1 0 0 0 0 65 16_le 1 1 1 ? ? 0 66 8_be 1 1 0 1 0 ? 67 16_be 1 1 1 ? 1 0 68 4_le 1 1 1 ? 1 1 68 69 EOF 69 70 70 71 =begin comment … … 101 102 #8_be 1 1 ? 1 ? 102 103 #16_be 1 1 1 ? 1 103 104 my $destarch = { '8_le' => [1,4], '12_le' => [2], '16_le' => [5], 104 '8_be' => [3,6], ' 16_be' => [7] };105 '8_be' => [3,6], '4_le' => [7], '16_be' => [8] }; 105 106 # the reverse: which tests for which arch 106 my @archtest = qw(8_le 12_le 8_be 8_le 16_le 8_be 16_be);107 my @archtest = qw(8_le 12_le 8_be 8_le 16_le 8_be 4_le 16_be); 107 108 # @todo lists of tests for your architecture. 108 109 # e.g. for arch 8_le => tests (8_be) => todo (3 6) 109 110 sub generate_skip_list { … … 157 158 $todo->{8} = $todo_msg; 158 159 } 159 160 161 my $output_float = << 'END_OUTPUT'; 162 1 163 4 164 16 165 64 166 256 167 1024 168 4096 169 16384 170 65536 171 262144 172 1048576 173 4194304 174 1.677722e+07 175 6.710886e+07 176 2.684355e+08 177 1.073742e+09 178 4.294967e+09 179 1.717987e+10 180 6.871948e+10 181 2.748779e+11 182 1.099512e+12 183 4.398047e+12 184 1.759219e+13 185 7.036874e+13 186 2.81475e+14 187 1.1259e+15 188 END_OUTPUT 189 160 190 my $output = << 'END_OUTPUT'; 161 191 1 162 192 4 … … 186 216 1.12589990684262e+15 187 217 END_OUTPUT 188 218 219 $output = $output_float if $PConfig{numvalsize} == 4; 220 189 221 # test_pbc_number(1, "i386 8-byte double float, 32 bit opcode_t"); 190 222 sub test_pbc_number { 191 223 my $id = shift; -
tools/dev/mk_native_pbc
old new 104 104 # force double on 2nd run not to default to long double 105 105 conf=" --floatval=double" 106 106 else 107 N= 7108 echo " 7: ppc/BE 64 bit opcode_t, 16-byte long double"107 N=8 108 echo "8: ppc/BE 64 bit opcode_t, 16-byte long double" 109 109 fi 110 110 fi 111 111 else -
t/steps/auto_jit-01.t
old new 5 5 6 6 use strict; 7 7 use warnings; 8 use Test::More tests => 5 0;8 use Test::More tests => 51; 9 9 use Carp; 10 10 use Cwd; 11 11 use File::Path qw( mkpath ); … … 52 52 my $corejitdir = File::Spec->catdir ( $jitbase, $cpuarch ); 53 53 mkpath( $corejitdir, 0, 755 ) or croak "Unable to make testing directory"; 54 54 my $corejit = File::Spec->catfile( $jitbase, $cpuarch, q{core.jit} ); 55 is( $step->_check_jitcapability($corejit, $cpuarch, $osname ), 0,55 is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, 56 56 "Got expected value for _check_jitcapability(): no core.jit case"); 57 57 58 58 chdir $cwd or croak "Unable to change back to starting directory"; … … 71 71 or croak "Unable to open handle to file for testing"; 72 72 print $FH qq{Hello, JIT\n}; 73 73 close $FH or croak "Unable to close handle to file for testing"; 74 is( $step->_check_jitcapability($corejit, $cpuarch, $osname ), 0,74 is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, 75 75 "Got expected value for _check_jitcapability(): no JIT on this architecture case"); 76 76 77 77 chdir $cwd or croak "Unable to change back to starting directory"; … … 92 92 close $FH or croak "Unable to close handle to file for testing"; 93 93 my $orig = $step->{jit_is_working}; 94 94 $step->{jit_is_working} = { $cpuarch => 1 }; 95 is( $step->_check_jitcapability($corejit, $cpuarch, $osname ), 1,95 is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 1, 96 96 "Got expected value for _check_jitcapability(): mock JIT case"); 97 97 $step->{jit_is_working} = $orig; 98 98 … … 114 114 close $FH or croak "Unable to close handle to file for testing"; 115 115 my $orig = $step->{jit_is_working}; 116 116 $step->{jit_is_working} = { $cpuarch => 1 }; 117 is( $step->_check_jitcapability($corejit, $cpuarch, $osname ), 0,117 is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 8), 0, 118 118 "Got expected value for _check_jitcapability(): mock darwin-i386 case"); 119 119 $step->{jit_is_working} = $orig; 120 120 121 121 chdir $cwd or croak "Unable to change back to starting directory"; 122 122 } 123 123 124 { 125 my $tdir = tempdir( CLEANUP => 1 ); 126 chdir $tdir or croak "Unable to change to temporary directory"; 127 my $jitbase = 'foo'; 128 my $cpuarch = 'i386'; 129 my $osname = 'MSWin32'; 130 my $corejitdir = File::Spec->catdir ( $jitbase, $cpuarch ); 131 mkpath( $corejitdir, 0, 755 ) or croak "Unable to make testing directory"; 132 my $corejit = File::Spec->catfile( $jitbase, $cpuarch, q{core.jit} ); 133 open my $FH, '>', $corejit 134 or croak "Unable to open handle to file for testing"; 135 print $FH qq{Hello, JIT\n}; 136 close $FH or croak "Unable to close handle to file for testing"; 137 my $orig = $step->{jit_is_working}; 138 $step->{jit_is_working} = { $cpuarch => 1 }; 139 is( $step->_check_jitcapability($corejit, $cpuarch, $osname, 4), 0, 140 "Got expected value for _check_jitcapability(): mock single-float"); 141 $step->{jit_is_working} = $orig; 142 143 chdir $cwd or croak "Unable to change back to starting directory"; 144 } 145 124 146 ########### _handle_asm() ########### 125 147 126 148 { -
t/compilers/imcc/imcpasm/opt1.t
old new 1154 1154 1155 1155 ############################## 1156 1156 1157 $output = $PConfig{numvalsize} == 8 1158 ?'/^# IMCC does produce b0rken PASM files1157 if ($PConfig{numvalsize} == 8) { 1158 $output = '/^# IMCC does produce b0rken PASM files 1159 1159 # see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 1160 1160 _main: 1161 1161 set N0, 1\.6e\+0?22 1162 1162 end$/ 1163 ' : '/^# IMCC does produce b0rken PASM files 1163 '; 1164 } 1165 elsif ($PConfig{numvalsize} > 8) { 1166 $output = '/^# IMCC does produce b0rken PASM files 1164 1167 # see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 1165 1168 _main: 1166 1169 set N0, 16000000000000000000000 1167 1170 end$/ 1168 1171 '; 1172 } 1173 elsif ($PConfig{numvalsize} < 8) { 1174 $output = '/^# IMCC does produce b0rken PASM files 1175 # see http://guest@rt.perl.org/rt3/Ticket/Display.html\?id=32392 1176 _main: 1177 set N0, 1\.6e\+22 1178 end$/ 1179 '; 1180 } 1169 1181 1170 1182 pir_2_pasm_like( <<'CODE', $output, "constant add big nums" ); 1171 1183 .sub _main -
t/op/arithmetics.t
old new 11 11 12 12 # test for GMP 13 13 use Parrot::Config; 14 my $output; 14 15 15 16 =head1 NAME 16 17 … … 184 185 # 185 186 186 187 pasm_output_is( <<'CODE', <<OUTPUT, 'negate a native number' ); 187 set N0, 123.456 7890188 set N0, 123.456 188 189 neg N0 189 190 say N0 190 set N0, -123.456 7890191 set N0, -123.456 191 192 neg N0 192 193 say N0 193 set N0, 123.456 7890194 set N0, 123.456 194 195 neg N1, N0 195 196 say N1 196 set N0, -123.456 7890197 set N0, -123.456 197 198 neg N1, N0 198 199 say N1 199 200 end 200 201 CODE 201 -123.456 789202 123.456 789203 -123.456 789204 123.456 789202 -123.456 203 123.456 204 -123.456 205 123.456 205 206 OUTPUT 206 207 207 208 pasm_output_is( <<'CODE', <<OUTPUT, "take the absolute of a native number" ); … … 211 212 set N0, -0.0 212 213 abs N0 213 214 say N0 214 set N0, 123.456 78901215 set N0, 123.456 215 216 abs N0 216 217 say N0 217 set N0, -123.456 78901218 set N0, -123.456 218 219 abs N0 219 220 say N0 220 221 set N0, 0 … … 225 226 set N1, 1 226 227 abs N1, N0 227 228 say N1 228 set N0, 123.456 78901229 set N0, 123.456 229 230 set N1, 1 230 231 abs N1, N0 231 232 say N1 232 set N0, -123.456 78901233 set N0, -123.456 233 234 set N1, 1 234 235 abs N1, N0 235 236 say N1 … … 237 238 CODE 238 239 0 239 240 0 240 123.456 78901241 123.456 78901241 123.456 242 123.456 242 243 0 243 244 0 244 123.456 78901245 123.456 78901245 123.456 246 123.456 246 247 OUTPUT 247 248 248 249 pasm_output_is( <<'CODE', <<OUTPUT, "ceil of a native number" ); … … 462 463 -4123.369 463 464 OUTPUT 464 465 465 pasm_output_is( <<'CODE', <<OUTPUT, "multiply native number with native number" ); 466 $output = $PConfig{numvalsize} < 8 467 ? '-492522.3 468 -492522.3 469 ' 470 : '-492522.288258 471 -492522.288258 472 '; 473 474 pasm_output_is( <<'CODE', $output, "multiply native number with native number" ); 466 475 set N2, 4000.246 467 476 set N0, -123.123 468 477 mul N1, N0, N2 … … 471 480 say N0 472 481 end 473 482 CODE 474 -492522.288258475 -492522.288258476 OUTPUT477 483 478 pasm_output_is( <<'CODE', <<OUTPUT, "divide native number by native number" ); 484 $output = $PConfig{numvalsize} < 8 485 ? '-0.03077886 486 -0.03077886 487 ' 488 : '-0.0307788571002883 489 -0.0307788571002883 490 '; 491 492 pasm_output_is( <<'CODE', $output, "divide native number by native number" ); 479 493 set N2, 4000.246 480 494 set N0, -123.123 481 495 div N1, N0, N2 … … 484 498 say N0 485 499 end 486 500 CODE 487 -0.0307788571002883488 -0.0307788571002883489 OUTPUT490 501 491 502 pasm_output_is( <<'CODE', <<OUTPUT, "lcm_I_I_I" ); 492 503 set I0, 10 -
t/op/integer.t
old new 6 6 use warnings; 7 7 use lib qw( . lib ../lib ../../lib ); 8 8 use Test::More; 9 use Parrot::Config; 9 10 use Parrot::Test tests => 56; 11 my $output; 10 12 11 13 =head1 NAME 12 14 … … 1035 1037 5 1036 1038 OUTPUT 1037 1039 1038 pasm_output_is( <<CODE, <<OUTPUT, "set_n_i" ); 1040 $output = $PConfig{numvalsize} < 8 1041 ? '0 1042 2.147484e+09 1043 -2.147484e+09 1044 ' 1045 : '0 1046 2147483647 1047 -2147483648 1048 '; 1049 1050 pasm_output_is( <<CODE, $output, "set_n_i" ); 1039 1051 set I0, 0 1040 1052 set N0, I0 1041 print N0 1042 print "\\n" 1053 say N0 1043 1054 1044 1055 set I1, 2147483647 1045 1056 set N1, I1 1046 print N1 1047 print "\\n" 1057 say N1 1048 1058 1049 1059 set I2, -2147483648 1050 1060 set N2, I2 1051 print N2 1052 print "\\n" 1061 say N2 1053 1062 end 1054 1063 CODE 1055 01056 21474836471057 -21474836481058 OUTPUT1059 1064 1060 1065 pasm_output_is( <<CODE, <<OUTPUT, "cleari" ); 1061 1066 set I0, 0xdeadbee -
t/op/number.t
old new 25 25 26 26 my $output; 27 27 28 pasm_output_is( <<CODE, <<OUTPUT, "set_n_nc" ); 28 $output = $PConfig{numvalsize} < 8 29 ? '1 30 4 31 16 32 64 33 256 34 1024 35 4096 36 16384 37 65536 38 262144 39 1048576 40 4194304 41 1.677722e+07 42 6.710886e+07 43 2.684355e+08 44 1.073742e+09 45 4.294967e+09 46 1.717987e+10 47 6.871948e+10 48 2.748779e+11 49 1.099512e+12 50 4.398047e+12 51 1.759219e+13 52 7.036874e+13 53 2.81475e+14 54 1.1259e+15 55 ' 56 : '1 57 4 58 16 59 64 60 256 61 1024 62 4096 63 16384 64 65536 65 262144 66 1048576 67 4194304 68 16777216 69 67108864 70 268435456 71 1073741824 72 4294967296 73 17179869184 74 68719476736 75 274877906944 76 1099511627776 77 4398046511104 78 17592186044416 79 70368744177664 80 281474976710656 81 1.12589990684262e+15 82 '; 83 84 pasm_output_is( <<CODE, $output, "set_n_nc" ); 29 85 set N0, 1.0 30 86 set N1, 4.0 31 87 set N2, 16.0 … … 107 163 print "\\n" 108 164 end 109 165 CODE 110 1111 4112 16113 64114 256115 1024116 4096117 16384118 65536119 262144120 1048576121 4194304122 16777216123 67108864124 268435456125 1073741824126 4294967296127 17179869184128 68719476736129 274877906944130 1099511627776131 4398046511104132 17592186044416133 70368744177664134 281474976710656135 1.12589990684262e+15136 OUTPUT137 166 138 167 pasm_output_is( <<CODE, <<OUTPUT, "set_n" ); 139 168 set N0, 42.0 … … 804 833 -5 805 834 OUTPUT 806 835 807 pasm_output_is( <<CODE, <<OUTPUT, "set_i_n" ); 836 $output = $PConfig{numvalsize} < 8 837 # TODO numeric overflow in single-float 838 ? '0 839 -2147483648 840 -2147483648 841 ' 842 : '0 843 2147483647 844 -2147483648 845 '; 846 847 pasm_output_is( <<CODE, $output, "set_i_n" ); 808 848 set N0, 0.0 809 849 set I0, N0 810 850 print I0 … … 821 861 print "\\n" 822 862 end 823 863 CODE 824 0825 2147483647826 -2147483648827 OUTPUT828 864 829 865 pasm_output_is( <<CODE, <<OUTPUT, "clearn" ); 830 866 set N0, 547972.0 … … 930 966 12 931 967 OUTPUT 932 968 933 pasm_output_is( <<CODE, <<OUTPUT, "fact_n_i" ); 969 $output = $PConfig{numvalsize} < 8 970 ? '6 971 3.99168e+07 972 1 973 1 974 ' 975 : '6 976 39916800 977 1 978 1 979 '; 980 981 pasm_output_is( <<CODE, $output, "fact_n_i" ); 934 982 set I0, 3 935 983 set I1, 11 936 984 set I2, 0 … … 949 997 print "\\n" 950 998 end 951 999 CODE 952 6953 39916800954 1955 1956 OUTPUT957 1000 958 pasm_output_is( <<CODE, <<OUTPUT, "fact_n_ic" );1001 pasm_output_is( <<CODE, $output, "fact_n_ic" ); 959 1002 fact N5, 3 960 1003 print N5 961 1004 print "\\n" … … 970 1013 print "\\n" 971 1014 end 972 1015 CODE 973 6974 39916800975 1976 1977 OUTPUT978 1016 979 1017 pasm_output_is( <<'CODE', <<OUTPUT, "exchange" ); 980 1018 set N1, 1.234560 … … 1081 1119 0.5 1082 1120 OUTPUT 1083 1121 1084 # long double succeeds1085 $output = $PConfig{numvalsize} == 8 1086 ?'1.41421356237311122 # double looses 1123 if ($PConfig{numvalsize} == 8) { 1124 $output = '1.4142135623731 1087 1125 1.41421356237309 1088 ' : '1.4142135623731 1126 '; 1127 } 1128 # single-float not bad 1129 elsif ($PConfig{numvalsize} < 8) { 1130 $output = '1.414214 1131 1.414214 1132 '; 1133 } 1134 # and long double succeeds 1135 elsif ($PConfig{numvalsize} > 8) { 1136 $output = '1.4142135623731 1089 1137 1.4142135623731 1090 1138 '; 1139 } 1140 1091 1141 pasm_output_is( <<'CODE', $output, "sqrt_n_n" ); 1092 1142 set N1, 2 1093 1143 sqrt N2, N1 -
t/op/sprintf.t
old new 325 325 326 326 .local string test_file 327 327 328 .local int nvsize 329 load_bytecode 'config.pbc' 330 $P0 = _config() 331 nvsize = $P0["nvsize"] 332 328 333 bsr reset_skip_info 329 334 test_file = 'sprintf_tests' 330 335 skip_info[5] = 'parrot extension (%B)' … … 373 378 skip_info[307] = 'perl5-specific extension (%v...)' 374 379 skip_info[308] = 'perl5-specific extension (%v...)' 375 380 381 if nvsize >= 8 goto end_float 382 skip_info[11] = 'too high for single-float %G' 383 skip_info[12] = 'too high for single-float %G' 384 skip_info[14] = 'too high for single-float %G' 385 skip_info[15] = 'too high for single-float %G' 386 skip_info[102] = 'too high for single-float %e' 387 skip_info[104] = 'too high for single-float %e' 388 skip_info[122] = 'too high for single-float %e' 389 skip_info[123] = 'too high for single-float %e' 390 skip_info[162] = 'too high for single-float %e' 391 skip_info[163] = 'too high for single-float %e' 392 skip_info[164] = 'too high for single-float %e' 393 skip_info[165] = 'too high for single-float %e' 394 skip_info[167] = 'too high for single-float %e' 395 skip_info[178] = 'too high for single-float %e' 396 skip_info[179] = 'too high for single-float %e' 397 skip_info[185] = 'too high for single-float %e' 398 skip_info[186] = 'too high for single-float %e' 399 400 end_float: 376 401 skip_tests[test_file] = skip_info 377 402 378 403 .return (skip_tests) -
t/op/time.t
old new 63 63 ok, (now>before) timelords need not apply 64 64 OUTPUT 65 65 66 p asm_output_is( <<CODE, <<OUTPUT, "sleep" );67 print "start\\n" 66 pir_output_is( <<'CODE', <<OUTPUT, "sleep" ); 67 .sub main :main 68 68 69 time I1 69 say "start" 70 time $I1 70 71 71 72 sleep 1 72 set I0, 173 sleep I073 set $I0, 1 74 sleep $I0 74 75 75 time I076 time $I0 76 77 77 gt I0, I1, ALLOK 78 print "no, sleeping made time go the wrong way " 78 gt $I0, $I1, ALLOK 79 print "no, sleeping made time go the wrong way: I0=" 80 print $I0 81 print ", I1=" 82 print $I1 83 print " " 79 84 80 85 ALLOK: 81 print "done\\n"82 86 say "done" 87 .end 83 88 CODE 84 89 start 85 90 done -
src/scheduler.c
old new 999 999 #if PARROT_HAS_THREADS 1000 1000 Parrot_cond condition; 1001 1001 Parrot_mutex lock; 1002 #if NUMVAL_SIZE > 4 1002 1003 FLOATVAL timer_end = time + Parrot_floatval_time(); 1004 #else 1005 UINTVAL timer_end = time + Parrot_intval_time(); 1006 #endif 1003 1007 struct timespec time_struct; 1004 1008 1005 1009 /* Tell the scheduler runloop to wake, this is a good time to process … … 1011 1015 MUTEX_INIT(lock); 1012 1016 LOCK(lock); 1013 1017 time_struct.tv_sec = (time_t) timer_end; 1018 #if NUMVAL_SIZE > 4 1014 1019 time_struct.tv_nsec = (long)((timer_end - time_struct.tv_sec)*1000.0f) *1000L*1000L; 1020 #else 1021 time_struct.tv_nsec = (long)((timer_end*1000L - time_struct.tv_sec*1000L)*1000.0f); 1022 #endif 1015 1023 COND_TIMED_WAIT(condition, lock, &time_struct); 1016 1024 UNLOCK(lock); 1017 1025 COND_DESTROY(condition); -
t/pmc/bigint.t
old new 129 129 ok 4 130 130 OUT 131 131 132 pasm_output_is( <<'CODE', <<'OUT', "set double, get str" ); 132 my $output = $PConfig{numvalsize} < 8 ? "1229999964160\n" : "1230000000000\n"; 133 # inexact with short floats 134 pasm_output_is( <<'CODE', $output, "set double, get str" ); 133 135 new P0, ['BigInt'] 134 136 set P0, 1.23e12 135 print P0 136 print "\n" 137 say P0 137 138 end 138 139 CODE 139 1230000000000140 OUT141 140 141 # but exact with strings 142 142 pasm_output_is( <<'CODE', <<'OUT', "set str, get str" ); 143 143 new P0, ['BigInt'] 144 144 set P0, "1230000000000" -
t/pmc/complex.t
old new 17 17 =cut 18 18 19 19 .sub main :main 20 .local int nvsize 21 load_bytecode "config.pbc" 22 $P0 = _config() 23 nvsize = $P0['nvsize'] 24 if nvsize > 4 goto no_singlefloat 25 say "1..0 # SKIP crashes on single float" 26 goto fin 27 28 no_singlefloat: 20 29 .include 'test_more.pir' 21 .include 'fp_equality.pasm'30 # .include 'fp_equality.pasm' 22 31 .include "iglobals.pasm" 23 32 24 33 plan(467) … … 79 88 add_using_subclass_of_complex_bug_59630() 80 89 81 90 # END_OF_TESTS 82 91 fin: 83 92 .end 84 93 85 94 .macro exception_is( M ) -
runtime/parrot/include/fp_equality.pasm
old new 36 36 .endm 37 37 38 38 .macro fp_eq_pasm ( J, K, L ) 39 set N13, 0.000001 39 40 set N10, .J 40 41 set N11, .K 41 42 sub N12, N11, N10 42 43 abs N12, N12 43 gt N12, 0.000001, .$FPEQNOK44 gt N12, N13, .$FPEQNOK 44 45 45 46 branch .L 46 47 .label $FPEQNOK: 47 48 .endm 48 49 50 .macro fp_eq_prec_pasm ( J, K, L, M ) 51 set N10, .J 52 set N11, .K 53 sub N12, N11, N10 54 abs N12, N12 55 set N13, .L 56 gt N12, N13, .$FPEQNOK 57 58 branch .M 59 .label $FPEQNOK: 60 .endm 49 61 50 62 .macro fp_ne_pasm ( J, K, L ) 51 63 set N10, .J -
t/pmc/float.t
old new 24 24 25 25 =cut 26 26 27 my $output; 27 28 28 29 pasm_output_is( <<"CODE", <<OUTPUT, "basic assignment" ); 29 30 .include 'include/fp_equality.pasm' … … 109 110 pasm_output_is( <<"CODE", <<OUTPUT, "multiply number by self" ); 110 111 .include 'include/fp_equality.pasm' 111 112 new P0, ['Float'] 112 set P0, 12 3.4113 set P0, 12.4 113 114 mul P0, P0, P0 114 .fp_eq_pasm( P0, 15 227.56, EQ1)115 .fp_eq_pasm( P0, 153.76, EQ1) 115 116 print P0 116 print " not "117 EQ1: print "ok 1\\n"117 print " not " 118 EQ1: say "ok 1" 118 119 end 119 120 CODE 120 121 ok 1 … … 288 289 289 290 pasm_output_is( << "CODE", << 'OUTPUT', "Basic integer arithmetic: subtraction" ); 290 291 .include 'include/fp_equality.pasm' 291 new P0, ['Float'] 292 open P0, 'runtime/parrot/include/config.fpmc', 'r' 293 read S2, P0, 60000 294 close P0 295 thaw P1, S2 296 set N1, P1['nvsize'] 297 set N2, 0.000001 298 gt N1, 4, no_float 299 set N2, 0.001 300 no_float: new P0, ['Float'] 292 301 set P0, 103.45 293 302 sub P0, 77 294 .fp_eq_p asm(P0, 26.45, EQ1)303 .fp_eq_prec_pasm(P0, 26.45, N2, EQ1) 295 304 print P0 296 305 print "not " 297 EQ1: print "ok 1\\n"306 EQ1: say "ok 1" 298 307 299 308 sub P0, -24 300 .fp_eq_p asm(P0, 50.45, EQ2)309 .fp_eq_prec_pasm(P0, 50.45, N2, EQ2) 301 310 print P0 302 311 print "not " 303 EQ2: print "ok 2\\n"312 EQ2: say "ok 2" 304 313 end 305 314 CODE 306 315 ok 1 … … 1134 1143 1 1135 1144 OUTPUT 1136 1145 1137 pir_output_is( <<'CODE', <<'OUTPUT', 'acos as a method' ); 1146 $output = $PConfig{numvalsize} < 8 1147 ? "acos(0.0) is 1.570796371\nacos(0.5) is 1.047197580\n" 1148 : "acos(0.0) is 1.570796327\nacos(0.5) is 1.047197551\n"; 1149 1150 pir_output_is( <<'CODE', $output, 'acos as a method' ); 1138 1151 .include 'fp_equality.pasm' 1139 1152 .sub main :main 1140 1153 .local pmc array … … 1157 1170 say $S0 1158 1171 .end 1159 1172 CODE 1160 acos(0.0) is 1.5707963271161 acos(0.5) is 1.0471975511162 OUTPUT1163 1173 1164 pir_output_is( <<'CODE', <<'OUTPUT', 'cos as a method' ); 1174 $output = $PConfig{numvalsize} < 8 1175 ? "cos(0.0) is 1.000000000\ncos(0.5) is 0.877582550\n" 1176 : "cos(0.0) is 1.000000000\ncos(0.5) is 0.877582562\n"; 1177 1178 pir_output_is( <<'CODE', $output, 'cos as a method' ); 1165 1179 .include 'fp_equality.pasm' 1166 1180 .sub main :main 1167 1181 .local pmc array … … 1184 1198 say $S0 1185 1199 .end 1186 1200 CODE 1187 cos(0.0) is 1.0000000001188 cos(0.5) is 0.8775825621189 OUTPUT1190 1201 1191 pir_output_is( <<'CODE', <<'OUTPUT', 'asec as a method' ); 1202 $output = $PConfig{numvalsize} < 8 1203 ? "asec(1.0) is 0.000000000\nasec(3.0) is 1.230959415\n" 1204 : "asec(1.0) is 0.000000000\nasec(3.0) is 1.230959417\n"; 1205 1206 pir_output_is( <<'CODE', $output, 'asec as a method' ); 1192 1207 .include 'fp_equality.pasm' 1193 1208 .sub main :main 1194 1209 .local pmc array … … 1211 1226 say $S0 1212 1227 .end 1213 1228 CODE 1214 asec(1.0) is 0.0000000001215 asec(3.0) is 1.2309594171216 OUTPUT1217 1229 1218 pir_output_is( <<'CODE', <<'OUTPUT', 'asin as a method' ); 1230 $output = $PConfig{numvalsize} < 8 1231 ? "asin(0.0) is 0.000000000\nasin(0.5) is 0.523598790\n" 1232 : "asin(0.0) is 0.000000000\nasin(0.5) is 0.523598776\n"; 1233 1234 pir_output_is( <<'CODE', $output, 'asin as a method' ); 1219 1235 .include 'fp_equality.pasm' 1220 1236 .sub main :main 1221 1237 .local pmc array … … 1238 1254 say $S0 1239 1255 .end 1240 1256 CODE 1241 asin(0.0) is 0.0000000001242 asin(0.5) is 0.5235987761243 OUTPUT1244 1257 1245 pir_output_is( <<'CODE', <<'OUTPUT', 'atan as a method' ); 1258 $output = $PConfig{numvalsize} < 8 1259 ? "atan(0.0) is 0.000000000\natan(0.5) is 0.463647604\n" 1260 : "atan(0.0) is 0.000000000\natan(0.5) is 0.463647609\n"; 1261 1262 pir_output_is( <<'CODE', $output, 'atan as a method' ); 1246 1263 .include 'fp_equality.pasm' 1247 1264 .sub main :main 1248 1265 .local pmc array … … 1265 1282 say $S0 1266 1283 .end 1267 1284 CODE 1268 atan(0.0) is 0.0000000001269 atan(0.5) is 0.4636476091270 OUTPUT1271 1285 1272 pir_output_is( <<'CODE', <<'OUTPUT', 'atan2 as a method' ); 1286 $output = $PConfig{numvalsize} < 8 1287 ? "atan2(0.7, 0.5) is 0.950546861\n" 1288 : "atan2(0.7, 0.5) is 0.950546841\n"; 1289 1290 pir_output_is( <<'CODE', $output, 'atan2 as a method' ); 1273 1291 .include 'fp_equality.pasm' 1274 1292 .sub main :main 1275 1293 .local pmc array … … 1287 1305 say $S0 1288 1306 .end 1289 1307 CODE 1290 atan2(0.7, 0.5) is 0.9505468411291 OUTPUT1292 1308 1293 pir_output_is( <<'CODE', <<'OUTPUT', 'cosh as a method' ); 1309 $output = $PConfig{numvalsize} < 8 1310 ? "cosh(0.0) is 1.000000000\ncosh(0.5) is 1.127625942\n" 1311 : "cosh(0.0) is 1.000000000\ncosh(0.5) is 1.127625965\n"; 1312 1313 pir_output_is( <<'CODE', $output, 'cosh as a method' ); 1294 1314 .include 'fp_equality.pasm' 1295 1315 .sub main :main 1296 1316 .local pmc array … … 1313 1333 say $S0 1314 1334 .end 1315 1335 CODE 1316 cosh(0.0) is 1.0000000001317 cosh(0.5) is 1.1276259651318 OUTPUT1319 1336 1320 pir_output_is( <<'CODE', <<'OUTPUT', 'exp as a method' ); 1337 $output = $PConfig{numvalsize} < 8 1338 ? "exp(0.0) is 1.000000000\nexp(0.5) is 1.648721218\n" 1339 : "exp(0.0) is 1.000000000\nexp(0.5) is 1.648721271\n"; 1340 1341 pir_output_is( <<'CODE', $output, 'exp as a method' ); 1321 1342 .include 'fp_equality.pasm' 1322 1343 .sub main :main 1323 1344 .local pmc array … … 1340 1361 say $S0 1341 1362 .end 1342 1363 CODE 1343 exp(0.0) is 1.0000000001344 exp(0.5) is 1.6487212711345 OUTPUT1346 1364 1347 pir_output_is( <<'CODE', <<'OUTPUT', 'ln as a method' ); 1365 $output = $PConfig{numvalsize} < 8 1366 ? "ln(45.0) is 3.806662560\nln(0.5) is -0.693147182\n" 1367 : "ln(45.0) is 3.806662490\nln(0.5) is -0.693147181\n"; 1368 1369 pir_output_is( <<'CODE', $output, 'ln as a method' ); 1348 1370 .include 'fp_equality.pasm' 1349 1371 .sub main :main 1350 1372 .local pmc array … … 1367 1389 say $S0 1368 1390 .end 1369 1391 CODE 1370 ln(45.0) is 3.8066624901371 ln(0.5) is -0.6931471811372 OUTPUT1373 1392 1374 pir_output_is( <<'CODE', <<'OUTPUT', 'log10 as a method' ); 1393 $output = $PConfig{numvalsize} < 8 1394 ? "log10(1000.0) is 3.000000000\nlog10(0.5) is -0.301030010\n" 1395 : "log10(1000.0) is 3.000000000\nlog10(0.5) is -0.301029996\n"; 1396 1397 pir_output_is( <<'CODE', $output, 'log10 as a method' ); 1375 1398 .include 'fp_equality.pasm' 1376 1399 .sub main :main 1377 1400 .local pmc array … … 1394 1417 say $S0 1395 1418 .end 1396 1419 CODE 1397 log10(1000.0) is 3.0000000001398 log10(0.5) is -0.3010299961399 OUTPUT1400 1420 1401 pir_output_is( <<'CODE', <<'OUTPUT', 'log2 as a method' ); 1421 $output = $PConfig{numvalsize} < 8 1422 ? "log2(32.0) is 5.000000000\nlog2(0.5) is -1.000000000\n" 1423 : "log2(32.0) is 5.000000000\nlog2(0.5) is -1.000000000\n"; 1424 1425 pir_output_is( <<'CODE', $output, 'log2 as a method' ); 1402 1426 .include 'fp_equality.pasm' 1403 1427 .sub main :main 1404 1428 .local pmc array … … 1421 1445 say $S0 1422 1446 .end 1423 1447 CODE 1424 log2(32.0) is 5.0000000001425 log2(0.5) is -1.0000000001426 OUTPUT1427 1448 1428 pir_output_is( <<'CODE', <<'OUTPUT', 'sec as a method' ); 1449 $output = $PConfig{numvalsize} < 8 1450 ? "sec(0.0) is 1.000000000\nsec(0.5) is 1.139493942\n" 1451 : "sec(0.0) is 1.000000000\nsec(0.5) is 1.139493927\n"; 1452 1453 pir_output_is( <<'CODE', $output, 'sec as a method' ); 1429 1454 .include 'fp_equality.pasm' 1430 1455 .sub main :main 1431 1456 .local pmc array … … 1448 1473 say $S0 1449 1474 .end 1450 1475 CODE 1451 sec(0.0) is 1.0000000001452 sec(0.5) is 1.1394939271453 OUTPUT1454 1476 1455 pir_output_is( <<'CODE', <<'OUTPUT', 'sech as a method' ); 1477 $output = $PConfig{numvalsize} < 8 1478 ? "sech(0.0) is 1.000000000\nsech(0.5) is 0.886818886\n" 1479 : "sech(0.0) is 1.000000000\nsech(0.5) is 0.886818884\n"; 1480 1481 pir_output_is( <<'CODE', $output, 'sech as a method' ); 1456 1482 .include 'fp_equality.pasm' 1457 1483 .sub main :main 1458 1484 .local pmc array … … 1475 1501 say $S0 1476 1502 .end 1477 1503 CODE 1478 sech(0.0) is 1.0000000001479 sech(0.5) is 0.8868188841480 OUTPUT1481 1504 1482 pir_output_is( <<'CODE', <<'OUTPUT', 'sin as a method' ); 1505 $output = $PConfig{numvalsize} < 8 1506 ? "sin(0.0) is 0.000000000\nsin(0.5) is 0.479425550\n" 1507 : "sin(0.0) is 0.000000000\nsin(0.5) is 0.479425539\n"; 1508 1509 pir_output_is( <<'CODE', $output, 'sin as a method' ); 1483 1510 .include 'fp_equality.pasm' 1484 1511 .sub main :main 1485 1512 .local pmc array … … 1502 1529 say $S0 1503 1530 .end 1504 1531 CODE 1505 sin(0.0) is 0.0000000001506 sin(0.5) is 0.4794255391507 OUTPUT1508 1532 1509 pir_output_is( <<'CODE', <<'OUTPUT', 'sinh as a method' ); 1533 $output = $PConfig{numvalsize} < 8 1534 ? "sinh(0.0) is 0.000000000\nsinh(0.5) is 0.521095276\n" 1535 : "sinh(0.0) is 0.000000000\nsinh(0.5) is 0.521095305\n"; 1536 1537 pir_output_is( <<'CODE', $output, 'sinh as a method' ); 1510 1538 .include 'fp_equality.pasm' 1511 1539 .sub main :main 1512 1540 .local pmc array … … 1529 1557 say $S0 1530 1558 .end 1531 1559 CODE 1532 sinh(0.0) is 0.0000000001533 sinh(0.5) is 0.5210953051534 OUTPUT1535 1560 1536 pir_output_is( <<'CODE', <<'OUTPUT', 'tan as a method' ); 1561 $output = $PConfig{numvalsize} < 8 1562 ? "tan(0.0) is 0.000000000\ntan(0.5) is 0.546302497\n" 1563 : "tan(0.0) is 0.000000000\ntan(0.5) is 0.546302490\n"; 1564 1565 pir_output_is( <<'CODE', $output, 'tan as a method' ); 1537 1566 .include 'fp_equality.pasm' 1538 1567 .sub main :main 1539 1568 .local pmc array … … 1556 1585 say $S0 1557 1586 .end 1558 1587 CODE 1559 tan(0.0) is 0.0000000001560 tan(0.5) is 0.5463024901561 OUTPUT1562 1588 1563 pir_output_is( <<'CODE', <<'OUTPUT', 'tanh as a method' ); 1589 $output = $PConfig{numvalsize} < 8 1590 ? "tanh(0.0) is 0.000000000\ntanh(0.5) is 0.462117165\n" 1591 : "tanh(0.0) is 0.000000000\ntanh(0.5) is 0.462117157\n"; 1592 1593 pir_output_is( <<'CODE', $output, 'tanh as a method' ); 1564 1594 .include 'fp_equality.pasm' 1565 1595 .sub main :main 1566 1596 .local pmc array … … 1583 1613 say $S0 1584 1614 .end 1585 1615 CODE 1586 tanh(0.0) is 0.0000000001587 tanh(0.5) is 0.4621171571588 OUTPUT1589 1616 1590 pir_output_is( <<'CODE', <<'OUTPUT', 'sqrt as a method' ); 1617 $output = $PConfig{numvalsize} < 8 1618 ? "sqrt(16.0) is 4.000000000\nsqrt(2.0) is 1.414213538\n" 1619 : "sqrt(16.0) is 4.000000000\nsqrt(2.0) is 1.414213562\n"; 1620 1621 pir_output_is( <<'CODE', $output, 'sqrt as a method' ); 1591 1622 .include 'fp_equality.pasm' 1592 1623 .sub main :main 1593 1624 .local pmc array … … 1610 1641 say $S0 1611 1642 .end 1612 1643 CODE 1613 sqrt(16.0) is 4.0000000001614 sqrt(2.0) is 1.4142135621615 OUTPUT1616 1644 1617 1645 1618 1646 # Local Variables: -
t/pmc/nci.t
old new 31 31 =cut 32 32 33 33 $ENV{TEST_PROG_ARGS} ||= ''; 34 my $output; 34 35 35 36 SKIP: { 36 37 unless ( -e "runtime/parrot/dynext/libnci_test$PConfig{load_ext}" ) { … … 143 144 22 144 145 OUTPUT 145 146 146 pir_output_is( << 'CODE', << 'OUTPUT', "nci_d and nci_dlvar_double" ); 147 $output = $PConfig{numvalsize} < 8 148 ? "libnci_test was successfully loaded 149 -55555.55 150 -555555.6 151 -5555556 152 -5.555556e+07 153 -5.555556e+08 154 -5.555555e+09\n" 155 : "libnci_test was successfully loaded 156 -55555.55555 157 -555555.5555 158 -5555555.555 159 -55555555.55 160 -555555555.5 161 -5555555555\n"; 162 163 pir_output_is( << 'CODE', $output, "nci_d and nci_dlvar_double" ); 147 164 148 165 .include "datatypes.pasm" 149 166 … … 196 213 NOT_LOADED: 197 214 .end 198 215 CODE 199 libnci_test was successfully loaded200 -55555.55555201 -555555.5555202 -5555555.555203 -55555555.55204 -555555555.5205 -5555555555206 OUTPUT207 216 208 pir_output_is( << 'CODE', << 'OUTPUT', "nci_f and nci_dlvar_float" ); 217 $output = $PConfig{numvalsize} < 8 218 ? "libnci_test was successfully loaded 219 -333 220 -3330 221 -33300 222 -333000 223 -3330000 224 -3.33e+07\n" 225 : "libnci_test was successfully loaded 226 -333 227 -3330 228 -33300 229 -333000 230 -3330000 231 -33300000\n"; 232 233 pir_output_is( << 'CODE', $output, "nci_f and nci_dlvar_float" ); 209 234 210 235 .include "datatypes.pasm" 211 236 … … 258 283 NOT_LOADED: 259 284 .end 260 285 CODE 261 libnci_test was successfully loaded262 -333263 -3330264 -33300265 -333000266 -3330000267 -33300000268 OUTPUT269 286 270 287 pir_output_is( << 'CODE', << "OUTPUT", "nci_l - return a long in an INTEGER register" ); 271 288 -
t/pmc/string.t
old new 94 94 set $S0, $P0 95 95 is( $S0, "123", 'String obj set with literal int' ) 96 96 97 set $P0, 1.23456 78997 set $P0, 1.23456 98 98 set $S0, $P0 99 is( $S0, "1.23456 789", 'String obj set with literal floating point' )99 is( $S0, "1.23456", 'String obj set with literal floating point' ) 100 100 101 101 set $P0, "0xFFFFFF" 102 102 set $S0, $P0 -
t/pmc/sub.t
old new 1006 1006 1007 1007 unlink( $l1_pbc, $l2_pbc ); 1008 1008 1009 pir_output_is( <<'CODE', <<'OUTPUT', "immediate code as const" ); 1009 my $output = $PConfig{numvalsize} > 4 ? "3.14159265358979\n" : "3.141593\n"; 1010 pir_output_is( <<'CODE', $output, "immediate code as const" ); 1010 1011 .sub make_pi :immediate :anon 1011 1012 $N0 = atan 1.0, 1.0 1012 1013 $N0 *= 4 … … 1017 1018 1018 1019 .sub main :main 1019 1020 .const 'Sub' pi = "make_pi" 1020 print pi 1021 print "\n" 1021 say pi 1022 1022 .end 1023 1023 CODE 1024 3.141592653589791025 OUTPUT1026 1024 1027 1025 pir_output_is( <<'CODE', <<'OUTPUT', "immediate code as const - obj" ); 1028 1026 .sub make_obj :immediate :anon -
t/pmc/timer.t
old new 7 7 use lib qw( . lib ../lib ../../lib ); 8 8 use Test::More; 9 9 use Parrot::Test tests => 6; 10 use Parrot::Config; 10 11 11 12 =head1 NAME 12 13 … … 126 127 /ok 2/ 127 128 OUT 128 129 129 pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/stop" ); 130 my @todo = $PConfig{nvsize} == 4 ? 131 ( todo => 'single-float timer resolution' ) : (); 132 pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/stop", @todo ); 130 133 .include "timer.pasm" 131 134 new P1, ['FixedPMCArray'] 132 135 set P1, 6 … … 153 156 ok 2 154 157 OUT 155 158 156 my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ ? 157 ( todo => 'RT #49718, add scheduler features to JIT' ) : (); 159 @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ 160 ? ( todo => 'RT #49718, add scheduler features to JIT' ) 161 : $PConfig{nvsize} == 4 162 ? ( todo => 'single-float timer resolution' ) 163 : (); 158 164 pasm_output_is( <<'CODE', <<'OUT', "Timer setup - initializer/start/repeat" , @todo ); 159 165 .include "timer.pasm" 160 166 new P1, ['FixedPMCArray'] -
t/dynoplibs/myops.t
old new 53 53 54 54 pir_error_output_like( << 'CODE', << 'OUTPUT', "hcf" ); 55 55 .loadlib "myops_ops" 56 56 57 .sub main :main 57 58 print "neither here\n" 58 59 hcf … … 77 78 pasm_output_is( $quine, $quine, 'a short cheating quine', @todo ); 78 79 } 79 80 80 my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ ? 81 ( todo => 'RT #49718, add scheduler features to JIT' ) : (); 81 SKIP: { 82 skip "alarm, single-float timer resolution", 1 if $PConfig{nvsize} == 4; 83 84 my @todo = $ENV{TEST_PROG_ARGS} =~ /-j/ 85 ? ( todo => 'RT #49718, add scheduler features to JIT' ) 86 : (); 82 87 83 pir_output_is( << 'CODE', << 'OUTPUT', "one alarm", @todo );88 pir_output_is( << 'CODE', << 'OUTPUT', "one alarm", @todo ); 84 89 .loadlib "myops_ops" 85 90 86 91 .sub main :main … … 109 114 3 110 115 done. 111 116 OUTPUT 117 } 112 118 113 119 SKIP: { 114 120 skip "three alarms, infinite loop under mingw32", 2 if $is_mingw; … … 169 175 /7/ 170 176 OUTPUT 171 177 178 skip "alarm, single-float timer resolution", 1 if $PConfig{nvsize} == 4; 172 179 pir_output_like( << 'CODE', << 'OUTPUT', "repeating alarm", @todo ); 173 180 174 181 .loadlib "myops_ops" -
t/library/dumper.t
old new 763 763 .local pmc float1 764 764 765 765 new float1, 'Float' 766 float1 = 12345.67 8766 float1 = 12345.67 767 767 _dumper( float1, "Float:" ) 768 768 .end 769 769 .include "library/dumper.pir" 770 770 CODE 771 "Float:" => 12345.67 8771 "Float:" => 12345.67 772 772 OUTPUT 773 773 774 774 # no. 18 -
t/library/mt19937ar.t
old new 7 7 use lib qw( t . lib ../lib ../../lib ); 8 8 use Test::More; 9 9 use Parrot::Test tests => 10; 10 use Parrot::Config; 10 11 11 12 =head1 NAME 12 13 … … 144 145 OUTPUT 145 146 146 147 147 my $out = Parrot::Test::slurp_file(File::Spec->catfile( 't', 'library', 'mt19937ar.txt' )); 148 my $out = Parrot::Test::slurp_file(File::Spec->catfile 149 ( 't', 'library', $PConfig{numvalsize} > 4 150 ? 'mt19937ar.txt' : 'mt_float.txt')); 148 151 pir_output_is( << 'CODE', $out, 'mt19937ar output' ); 149 152 .sub test :main 150 153 load_bytecode 'library/Math/Random/mt19937ar.pbc' … … 177 180 goto L1 178 181 L2: 179 182 print "\n1000 outputs of genrand_real2()\n" 183 .local int nvsize 184 load_bytecode "config.pbc" 185 $P1 = _config() 186 nvsize = $P1['nvsize'] 180 187 i = 0 181 188 L4: 182 189 unless i < 1000 goto L5 183 190 $N0 = mt.'genrand_real2'() 184 191 $P0[0] = $N0 192 if nvsize > 4 goto no_singlefloat 193 $S0 = sprintf "%10.5f ", $P0 194 goto L7 195 no_singlefloat: 185 196 $S0 = sprintf "%10.8f ", $P0 197 L7: 186 198 print $S0 187 199 $I0 = i % 5 188 200 unless $I0 == 4 goto L6 -
(a) /dev/null vs. (b) parrot-svn/t/library/mt_float.txt
a b 1 1000 outputs of genrand_int32() 2 1067595299 955945823 477289528 4107218783 4228976476 3 3344332714 3355579695 227628506 810200273 2591290167 4 2560260675 3242736208 646746669 1479517882 4245472273 5 1143372638 3863670494 3221021970 1773610557 1138697238 6 1421897700 1269916527 2859934041 1764463362 3874892047 7 3965319921 72549643 2383988930 2600218693 3237492380 8 2792901476 725331109 605841842 271258942 715137098 9 3297999536 1322965544 4229579109 1395091102 3735697720 10 2101727825 3730287744 2950434330 1661921839 2895579582 11 2370511479 1004092106 2247096681 2111242379 3237345263 12 4082424759 219785033 2454039889 3709582971 835606218 13 2411949883 2735205030 756421180 2175209704 1873865952 14 2762534237 4161807854 3351099340 181129879 3269891896 15 776029799 2218161979 3001745796 1866825872 2133627728 16 34862734 1191934573 3102311354 2916517763 1012402762 17 2184831317 4257399449 2899497138 3818095062 3030756734 18 1282161629 420003642 2326421477 2741455717 1278020671 19 3744179621 271777016 2626330018 2560563991 3055977700 20 4233527566 1228397661 3595579322 1077915006 2395931898 21 1851927286 3013683506 1999971931 3006888962 1049781534 22 1488758959 3491776230 104418065 2448267297 3075614115 23 3872332600 891912190 3936547759 2269180963 2633455084 24 1047636807 2604612377 2709305729 1952216715 207593580 25 2849898034 670771757 2210471108 467711165 263046873 26 3569667915 1042291111 3863517079 1464270005 2758321352 27 3790799816 2301278724 3106281430 7974801 2792461636 28 555991332 621766759 1322453093 853629228 686962251 29 1455120532 957753161 1802033300 1021534190 3486047311 30 1902128914 3701138056 4176424663 1795608698 560858864 31 3737752754 3141170998 1553553385 3367807274 711546358 32 2475125503 262969859 251416325 2980076994 1806565895 33 969527843 3529327173 2736343040 2987196734 1649016367 34 2206175811 3048174801 3662503553 3138851612 2660143804 35 1663017612 1816683231 411916003 3887461314 2347044079 36 1015311755 1203592432 2170947766 2569420716 813872093 37 1105387678 1431142475 220570551 4243632715 4179591855 38 2607469131 3090613241 282341803 1734241730 1391822177 39 1001254810 827927915 1886687171 3935097347 2631788714 40 3905163266 110554195 2447955646 3717202975 3304793075 41 3739614479 3059127468 953919171 2590123714 1132511021 42 3795593679 2788030429 982155079 3472349556 859942552 43 2681007391 2299624053 647443547 233600422 608168955 44 3689327453 1849778220 1608438222 3968158357 2692977776 45 2851872572 246750393 3582818628 3329652309 4036366910 46 1012970930 950780808 3959768744 2538550045 191422718 47 2658142375 3276369011 2927737484 1234200027 1920815603 48 3536074689 1535612501 2184142071 3276955054 428488088 49 2378411984 4059769550 3913744741 2732139246 64369859 50 3755670074 842839565 2819894466 2414718973 1010060670 51 1839715346 2410311136 152774329 3485009480 4102101512 52 2852724304 879944024 1785007662 2748284463 1354768064 53 3267784736 2269127717 3001240761 3179796763 895723219 54 865924942 4291570937 89355264 1471026971 4114180745 55 3201939751 2867476999 2460866060 3603874571 2238880432 56 3308416168 2072246611 2755653839 3773737248 1709066580 57 4282731467 2746170170 2832568330 433439009 3175778732 58 26248366 2551382801 183214346 3893339516 1928168445 59 1337157619 3429096554 3275170900 1782047316 4264403756 60 1876594403 4289659572 3223834894 1728705513 4068244734 61 2867840287 1147798696 302879820 1730407747 1923824407 62 1180597908 1569786639 198796327 560793173 2107345620 63 2705990316 3448772106 3678374155 758635715 884524671 64 486356516 1774865603 3881226226 2635213607 1181121587 65 1508809820 3178988241 1594193633 1235154121 326117244 66 2304031425 937054774 2687415945 3192389340 2003740439 67 1823766188 2759543402 10067710 1533252662 4132494984 68 82378136 420615890 3467563163 541562091 3535949864 69 2277319197 3330822853 3215654174 4113831979 4204996991 70 2162248333 3255093522 2219088909 2978279037 255818579 71 2859348628 3097280311 2569721123 1861951120 2907080079 72 2719467166 998319094 2521935127 2404125338 259456032 73 2086860995 1839848496 1893547357 2527997525 1489393124 74 2860855349 76448234 2264934035 744914583 2586791259 75 1385380501 66529922 1819103258 1899300332 2098173828 76 1793831094 276463159 360132945 4178212058 595015228 77 177071838 2800080290 1573557746 1548998935 378454223 78 1460534296 1116274283 3112385063 3709761796 827999348 79 3580042847 1913901014 614021289 4278528023 1905177404 80 45407939 3298183234 1184848810 3644926330 3923635459 81 1627046213 3677876759 969772772 1160524753 1522441192 82 452369933 1527502551 832490847 1003299676 1071381111 83 2891255476 973747308 4086897108 1847554542 3895651598 84 2227820339 1621250941 2881344691 3583565821 3510404498 85 849362119 862871471 797858058 2867774932 2821282612 86 3272403146 3997979905 209178708 1805135652 6783381 87 2823361423 792580494 4263749770 776439581 3798193823 88 2853444094 2729507474 1071873341 1329010206 1289336450 89 3327680758 2011491779 80157208 922428856 1158943220 90 1667230961 2461022820 2608845159 387516115 3345351910 91 1495629111 4098154157 3156649613 3525698599 4134908037 92 446713264 2137537399 3617403512 813966752 1157943946 93 3734692965 1680301658 3180398473 3509854711 2228114612 94 1008102291 486805123 863791847 3189125290 1050308116 95 3777341526 4291726501 844061465 1347461791 2826481581 96 745465012 2055805750 4260209475 2386693097 2980646741 97 447229436 2077782664 1232942813 4023002732 1399011509 98 3140569849 2579909222 3794857471 900758066 2887199683 99 1720257997 3367494931 2668921229 955539029 3818726432 100 1105704962 3889207255 2277369307 2746484505 1761846513 101 2413916784 2685127085 4240257943 1166726899 4215215715 102 3082092067 3960461946 1663304043 2087473241 4162589986 103 2507310778 1579665506 767234210 970676017 492207530 104 1441679602 1314785090 3262202570 3417091742 1561989210 105 3011406780 1146609202 3262321040 1374872171 1634688712 106 1280458888 2230023982 419323804 3262899800 39783310 107 1641619040 1700368658 2207946628 2571300939 2424079766 108 780290914 2715195096 3390957695 163151474 2309534542 109 1860018424 555755123 280320104 1604831083 2713022383 110 1728987441 3639955502 623065489 3828630947 4275479050 111 3516347383 2343951195 2430677756 635534992 3868699749 112 808442435 3070644069 4282166003 2093181383 2023555632 113 1568662086 3422372620 4134522350 3016979543 3259320234 114 2888030729 3185253876 4258779643 1267304371 1022517473 115 815943045 929020012 2995251018 3371283296 3608029049 116 2018485115 122123397 2810669150 1411365618 1238391329 117 1186786476 3155969091 2242941310 1765554882 279121160 118 4279838515 1641578514 3796324015 13351065 103516986 119 1609694427 551411743 2493771609 1316337047 3932650856 120 4189700203 463397996 2937735066 1855616529 2626847990 121 55091862 3823351211 753448970 4045045500 1274127772 122 1124182256 92039808 2126345552 425973257 386287896 123 2589870191 1987762798 4084826973 2172456685 3366583455 124 3602966653 2378803535 2901764433 3716929006 3710159000 125 2653449155 3469742630 3096444476 3932564653 2595257433 126 318974657 3146202484 853571438 144400272 3768408841 127 782634401 2161109003 570039522 1886241521 14249488 128 2230804228 1604941699 3928713335 3921942509 2155806892 129 134366254 430507376 1924011722 276713377 196481886 130 3614810992 1610021185 1785757066 851346168 3761148643 131 2918835642 3364422385 3012284466 3735958851 2643153892 132 3778608231 1164289832 205853021 2876112231 3503398282 133 3078397001 3472037921 1748894853 2740861475 316056182 134 1660426908 168885906 956005527 3984354789 566521563 135 1001109523 1216710575 2952284757 3834433081 3842608301 136 2467352408 3974441264 3256601745 1409353924 1329904859 137 2307560293 3125217879 3622920184 3832785684 3882365951 138 2308537115 2659155028 1450441945 3532257603 3186324194 139 1225603425 1124246549 175808705 3009142319 2796710159 140 3651990107 160762750 1902254979 1698648476 1134980669 141 497144426 3302689335 4057485630 3603530763 4087252587 142 427812652 286876201 823134128 1627554964 3745564327 143 2589226092 4202024494 62878473 3275585894 3987124064 144 2791777159 1916869511 2585861905 1375038919 1403421920 145 60249114 3811870450 3021498009 2612993202 528933105 146 2757361321 3341402964 2621861700 273128190 4015252178 147 3094781002 1621621288 2337611177 1796718448 1258965619 148 4241913140 2138560392 3022190223 4174180924 450094611 149 3274724580 617150026 2704660665 1469700689 1341616587 150 356715071 1188789960 2278869135 1766569160 2795896635 151 57824704 2893496380 1235723989 1630694347 3927960522 152 428891364 1814070806 2287999787 4125941184 3968103889 153 3548724050 1025597707 1404281500 2002212197 92429143 154 2313943944 2403086080 3006180634 3561981764 1671860914 155 1768520622 1803542985 844848113 3006139921 1410888995 156 1157749833 2125704913 1789979528 1799263423 741157179 157 2405862309 767040434 2655241390 3663420179 2172009096 158 2511931187 1680542666 231857466 1154981000 157168255 159 1454112128 3505872099 1929775046 2309422350 2143329496 160 2960716902 407610648 2938108129 2581749599 538837155 161 2342628867 430543915 740188568 1937713272 3315215132 162 2085587024 4030765687 766054429 3517641839 689721775 163 1294158986 1753287754 4202601348 1974852792 33459103 164 3568087535 3144677435 1686130825 4134943013 3005738435 165 3599293386 426570142 754104406 3660892564 1964545167 166 829466833 821587464 1746693036 1006492428 1595312919 167 1256599985 1024482560 1897312280 2902903201 691790057 168 1037515867 3176831208 1968401055 2173506824 1089055278 169 1748401123 2941380082 968412354 1818753861 2973200866 170 3875951774 1119354008 3988604139 1647155589 2232450826 171 3486058011 3655784043 3759258462 847163678 1082052057 172 989516446 2871541755 3196311070 3929963078 658187585 173 3664944641 2175149170 2203709147 2756014689 2456473919 174 3890267390 1293787864 2830347984 3059280931 4158802520 175 1561677400 2586570938 783570352 1355506163 31495586 176 3789437343 3340549429 2092501630 896419368 671715824 177 3530450081 3603554138 1055991716 3442308219 1499434728 178 3130288473 3639507000 17769680 2259741420 487032199 179 4227143402 3693771256 1880482820 3924810796 381462353 180 4017855991 2452034943 2736680833 2209866385 2128986379 181 437874044 595759426 641721026 1636065708 3899136933 182 629879088 3591174506 351984326 2638783544 2348444281 183 2341604660 2123933692 143443325 1525942256 364660499 184 599149312 939093251 1523003209 106601097 376589484 185 1346282236 1297387043 764598052 3741218111 933457002 186 1886424424 3219631016 525405256 3014235619 323149677 187 2038881721 4100129043 2851715101 2984028078 1888574695 188 2014194741 3515193880 4180573530 3461824363 2641995497 189 3179230245 2902294983 2217320456 4040852155 1784656905 190 3311906931 87498458 2752971818 2635474297 2831215366 191 3682231106 2920043893 3772929704 2816374944 309949752 192 2383758854 154870719 385111597 1191604312 1840700563 193 872191186 2925548701 1310412747 2102066999 1504727249 194 3574298750 1191230036 3330575266 3180292097 3539347721 195 681369118 3305125752 3648233597 950049240 4173257693 196 1760124957 512151405 681175196 580563018 1169662867 197 4015033554 2687781101 699691603 2673494188 1137221356 198 123599888 472658308 1053598179 1012713758 3481064843 199 3759461013 3981457956 3830587662 1877191791 3650996736 200 988064871 3515461600 4089077232 2225147448 1249609188 201 2643151863 3896204135 2416995901 1397735321 3460025646 202 203 1000 outputs of genrand_real2() 204 0.76275 0.99001 0.98670 0.10143 0.27933 205 0.69867 0.94219 0.03427 0.78842 0.28181 206 0.92179 0.20786 0.54535 0.69644 0.38108 207 0.23978 0.65287 0.07515 0.22765 0.94873 208 0.74558 0.62664 0.54708 0.90959 0.42043 209 0.86335 0.19189 0.14719 0.70260 0.63426 210 0.77408 0.04532 0.04606 0.88596 0.69398 211 0.05377 0.61711 0.05566 0.10134 0.41501 212 0.91811 0.22321 0.23354 0.92872 0.98897 213 0.19787 0.80559 0.06961 0.55840 0.90479 214 0.63288 0.95010 0.54948 0.20645 0.45001 215 0.87051 0.70807 0.19407 0.79286 0.49333 216 0.78484 0.75145 0.12342 0.42030 0.16728 217 0.59906 0.37575 0.97815 0.39816 0.43595 218 0.04952 0.33918 0.76510 0.61034 0.90655 219 0.92916 0.85366 0.18812 0.65913 0.28815 220 0.59476 0.27836 0.60723 0.68310 0.69387 221 0.03700 0.65898 0.17527 0.02889 0.86777 222 0.12352 0.91439 0.32023 0.44446 0.34904 223 0.74639 0.65918 0.92493 0.31873 0.77750 224 0.85414 0.76386 0.32744 0.91326 0.27458 225 0.22190 0.19865 0.31227 0.85321 0.84243 226 0.78544 0.71854 0.92504 0.82703 0.88306 227 0.47284 0.70059 0.48004 0.38672 0.60466 228 0.41747 0.47163 0.72751 0.65830 0.10955 229 0.64215 0.23456 0.95945 0.72822 0.40888 230 0.69980 0.26677 0.57334 0.39792 0.85378 231 0.76963 0.72005 0.90903 0.51377 0.37733 232 0.12692 0.71250 0.81218 0.37037 0.32772 233 0.14238 0.05615 0.74363 0.39773 0.94859 234 0.31452 0.11730 0.62963 0.33334 0.45547 235 0.10090 0.56551 0.60539 0.16028 0.13245 236 0.60960 0.04672 0.99356 0.57661 0.40270 237 0.45275 0.06700 0.85064 0.87743 0.54508 238 0.87243 0.29321 0.67661 0.68231 0.79052 239 0.48592 0.25186 0.93770 0.28565 0.47219 240 0.99055 0.13155 0.47110 0.98557 0.84398 241 0.12875 0.90953 0.49129 0.23793 0.79481 242 0.44338 0.96564 0.67749 0.55685 0.27287 243 0.79538 0.61965 0.22488 0.02226 0.49248 244 0.42247 0.91798 0.99250 0.23450 0.52532 245 0.10246 0.78686 0.34311 0.89893 0.40455 246 0.68608 0.30752 0.83601 0.54956 0.63778 247 0.82200 0.24891 0.48801 0.48662 0.51224 248 0.32970 0.31075 0.21393 0.73453 0.15566 249 0.58585 0.28977 0.97621 0.61499 0.23891 250 0.28519 0.46810 0.18372 0.37598 0.13492 251 0.66849 0.82811 0.56240 0.37549 0.27563 252 0.27522 0.74096 0.77177 0.13748 0.99747 253 0.92505 0.09175 0.21389 0.21767 0.31183 254 0.23271 0.21207 0.57903 0.77523 0.13243 255 0.31038 0.01205 0.71653 0.84488 0.14982 256 0.57423 0.45678 0.48420 0.53465 0.52667 257 0.46881 0.49850 0.05671 0.79022 0.03872 258 0.21697 0.20443 0.28949 0.81678 0.87629 259 0.92297 0.27373 0.84625 0.51506 0.00583 260 0.33296 0.91848 0.92537 0.91760 0.07541 261 0.71746 0.61159 0.00942 0.03136 0.71527 262 0.24822 0.63637 0.86160 0.26450 0.60160 263 0.35558 0.24477 0.07186 0.51757 0.62120 264 0.97981 0.69955 0.21066 0.13383 0.27693 265 0.59644 0.71501 0.04111 0.95730 0.91601 266 0.47705 0.26183 0.34707 0.07545 0.29398 267 0.93236 0.60486 0.48015 0.08870 0.45549 268 0.91873 0.38143 0.10669 0.01398 0.04520 269 0.93822 0.18012 0.57577 0.91428 0.30911 270 0.95853 0.23611 0.69620 0.69602 0.76765 271 0.58516 0.49479 0.11289 0.97188 0.32095 272 0.57564 0.40761 0.78703 0.43261 0.90878 273 0.84686 0.10599 0.72873 0.19315 0.66153 274 0.10211 0.06258 0.47951 0.47062 0.72701 275 0.48915 0.66110 0.60171 0.24517 0.12726 276 0.03451 0.90865 0.83495 0.94800 0.91035 277 0.14481 0.88459 0.53498 0.15963 0.55379 278 0.35171 0.28720 0.09098 0.00668 0.32310 279 0.87561 0.42535 0.91749 0.73908 0.41793 280 0.99280 0.87908 0.28458 0.59133 0.98672 281 0.28547 0.09452 0.89911 0.53681 0.37931 282 0.62683 0.56610 0.24802 0.52948 0.98329 283 0.66404 0.55524 0.75887 0.84785 0.86830 284 0.71449 0.84670 0.43923 0.20771 0.64158 285 0.25664 0.73056 0.86396 0.65853 0.99062 286 0.40281 0.39146 0.07291 0.97201 0.20556 287 0.59616 0.08138 0.45796 0.33681 0.33989 288 0.18717 0.53546 0.60551 0.86521 0.34291 289 0.72743 0.73024 0.34196 0.65020 0.02765 290 0.72576 0.32710 0.03421 0.26062 0.56998 291 0.28439 0.84423 0.77638 0.55982 0.06720 292 0.58449 0.71657 0.15820 0.58043 0.07948 293 0.40194 0.11376 0.88763 0.67532 0.71224 294 0.27829 0.04806 0.21144 0.58830 0.04140 295 0.43216 0.12953 0.94669 0.87391 0.98382 296 0.27751 0.90850 0.90963 0.59270 0.96102 297 0.49545 0.32007 0.62586 0.03120 0.85953 298 0.22018 0.05834 0.80731 0.53800 0.74167 299 0.77427 0.43938 0.54862 0.58576 0.15886 300 0.73214 0.11649 0.77464 0.85789 0.17062 301 0.66838 0.96076 0.07949 0.68522 0.89986 302 0.05667 0.12741 0.83471 0.63969 0.46613 303 0.10200 0.01195 0.10476 0.90285 0.31221 304 0.32981 0.46042 0.52025 0.05425 0.28331 305 0.60427 0.00598 0.97244 0.21136 0.78562 306 0.78429 0.63423 0.32910 0.44771 0.27381 307 0.14967 0.18156 0.65687 0.28726 0.97075 308 0.63676 0.96649 0.24526 0.08297 0.54258 309 0.03167 0.33735 0.15947 0.02103 0.46228 310 0.11892 0.33408 0.29876 0.29848 0.73768 311 0.02081 0.62980 0.08082 0.22993 0.25031 312 0.87788 0.45150 0.13673 0.63408 0.97908 313 0.52242 0.50580 0.06274 0.05270 0.77032 314 0.05113 0.24393 0.75036 0.37436 0.22878 315 0.59975 0.85708 0.88691 0.85547 0.36641 316 0.58720 0.45463 0.09244 0.32982 0.07820 317 0.25422 0.36005 0.60092 0.46192 0.36759 318 0.98424 0.08020 0.68594 0.45826 0.29962 319 0.79365 0.89231 0.49479 0.87646 0.23591 320 0.28107 0.75026 0.08136 0.79582 0.76011 321 0.82793 0.27948 0.72483 0.82191 0.46172 322 0.79190 0.96044 0.51610 0.88996 0.28999 323 0.55192 0.03935 0.83034 0.49553 0.98010 324 0.19018 0.98348 0.33452 0.87144 0.72106 325 0.71272 0.71466 0.88362 0.85571 0.73782 326 0.20920 0.34855 0.46767 0.02780 0.74898 327 0.03681 0.44867 0.77426 0.91026 0.25195 328 0.87320 0.63265 0.25552 0.27422 0.95217 329 0.39282 0.66442 0.09159 0.94516 0.07801 330 0.02508 0.39901 0.17383 0.12141 0.85502 331 0.19903 0.02160 0.44461 0.14689 0.68020 332 0.71324 0.60922 0.95400 0.99611 0.90898 333 0.41074 0.66207 0.32065 0.62805 0.50677 334 0.52690 0.87473 0.73918 0.39827 0.43684 335 0.80459 0.32423 0.01958 0.95320 0.98326 336 0.83932 0.69061 0.33671 0.68063 0.65152 337 0.33393 0.03452 0.95227 0.68201 0.85074 338 0.64721 0.51234 0.73402 0.00970 0.93835 339 0.80804 0.31485 0.20090 0.01323 0.59934 340 0.31585 0.20210 0.33755 0.68604 0.24443 341 0.19952 0.78163 0.10337 0.11361 0.23537 342 0.23262 0.67804 0.48750 0.74658 0.92157 343 0.56706 0.36683 0.99157 0.23421 0.45184 344 0.91610 0.85573 0.37706 0.77043 0.30892 345 0.40710 0.06945 0.61343 0.88817 0.58735 346 0.98711 0.14744 0.63243 0.87704 0.68347 347 0.84447 0.43265 0.25146 0.04130 0.34260 348 0.92697 0.40879 0.56990 0.76204 0.19820 349 0.66315 0.02483 0.06669 0.50206 0.26084 350 0.65139 0.41650 0.09734 0.56344 0.62652 351 0.67332 0.58037 0.47258 0.21011 0.05713 352 0.89391 0.10781 0.32037 0.07628 0.34228 353 0.42191 0.58202 0.77364 0.49595 0.86031 354 0.83907 0.81098 0.26694 0.14216 0.88210 355 0.53634 0.12091 0.82480 0.75930 0.31847 356 0.92768 0.01038 0.56202 0.88107 0.35926 357 0.85861 0.61109 0.70408 0.58435 0.92192 358 0.62668 0.75988 0.06859 0.36156 0.58057 359 0.13636 0.57720 0.59340 0.63531 0.22976 360 0.71916 0.41163 0.63980 0.09931 0.79344 361 0.10894 0.84450 0.23122 0.99486 0.73637 362 0.17276 0.13358 0.74966 0.64992 0.61990 363 0.41523 0.05878 0.05687 0.05497 0.42868 364 0.42571 0.25811 0.89643 0.30440 0.39310 365 0.11357 0.04288 0.23398 0.11201 0.85621 366 0.89734 0.37509 0.42077 0.68597 0.72781 367 0.19296 0.61699 0.31667 0.67756 0.00177 368 0.05725 0.79475 0.18885 0.06725 0.68193 369 0.42202 0.22082 0.28555 0.64996 0.87852 370 0.29125 0.61010 0.87375 0.05744 0.69903 371 0.81925 0.45654 0.37237 0.31119 0.52734 372 0.39673 0.38185 0.30164 0.17375 0.04913 373 0.90405 0.25743 0.58266 0.97663 0.79823 374 0.36438 0.15206 0.26530 0.22690 0.05839 375 0.84721 0.18622 0.37809 0.55707 0.49829 376 0.47659 0.24290 0.88478 0.07807 0.56246 377 0.73491 0.21099 0.13165 0.75840 0.66877 378 0.28988 0.44046 0.24967 0.80048 0.26030 379 0.30417 0.64152 0.52068 0.12881 0.85465 380 0.02691 0.19149 0.49630 0.79683 0.43566 381 0.00288 0.81484 0.03764 0.68529 0.01340 382 0.38405 0.30537 0.22995 0.44000 0.27218 383 0.53831 0.02870 0.86282 0.61831 0.09165 384 0.25610 0.07446 0.72186 0.90059 0.30071 385 0.94477 0.56822 0.21934 0.96773 0.80063 386 0.26308 0.31183 0.16501 0.55436 0.68562 387 0.23829 0.86512 0.57869 0.81888 0.20127 388 0.93172 0.66028 0.21787 0.78516 0.10262 389 0.35390 0.79304 0.63428 0.90480 0.31025 390 0.60635 0.56198 0.63574 0.91854 0.99701 391 0.83086 0.31692 0.01926 0.97446 0.98751 392 0.60944 0.13751 0.69520 0.68957 0.56969 393 0.46440 0.88342 0.36754 0.89224 0.39786 394 0.85055 0.12750 0.79452 0.89450 0.14568 395 0.45717 0.74822 0.28200 0.42546 0.17465 396 0.68309 0.65497 0.52935 0.12736 0.61524 397 0.81591 0.63108 0.39787 0.20102 0.53293 398 0.75486 0.59847 0.32862 0.12126 0.58917 399 0.07638 0.86845 0.29193 0.03990 0.52180 400 0.32503 0.64072 0.69517 0.74255 0.54587 401 0.48713 0.32920 0.08720 0.63497 0.54328 402 0.64179 0.45584 0.70694 0.85213 0.86074 403 0.33163 0.85740 0.59908 0.74566 0.72157 -
t/library/yaml_dumper.t
old new 8 8 9 9 use Test::More; 10 10 use Parrot::Test tests => 26; 11 use Parrot::Config; 11 12 12 13 =head1 NAME 13 14 … … 820 821 } 821 822 OUTPUT 822 823 824 my $float = $PConfig{numvalsize} > 4 ? "12345.6789" : "12345.67"; 823 825 824 pir_output_is( << 'CODE', <<'OUTPUT', "dumping Float PMC" );826 pir_output_is( <<"CODE", <<"OUTPUT", "dumping Float PMC" ); 825 827 826 828 .sub test :main 827 829 .local pmc float1 828 830 829 831 new float1, 'Float' 830 float1 = 12345.678831 yaml( float1, "Float")832 float1 = $float 833 yaml( float1, 'Float' ) 832 834 .end 833 .include "library/yaml_dumper.pir"835 .include 'library/yaml_dumper.pir' 834 836 CODE 835 837 --- 836 838 { 837 "Float" : !Float [ 12345.678],839 \"Float\" : !Float [ $float ], 838 840 } 839 841 OUTPUT 840 842 -
t/tools/pbc_merge.t
old new 100 100 101 101 .sub _get_years 102 102 .local num n 103 n = 10.39857 1103 n = 10.39857 104 104 .return(n) 105 105 .end 106 106 PIR 107 107 pbc_merge( "pbc_merge_t2", "pbc_merge_t2_1", "pbc_merge_t2_2" ); 108 is( run_pbc("pbc_merge_t2"), "Rammstein have rocked for over 10.39857 1years!" );108 is( run_pbc("pbc_merge_t2"), "Rammstein have rocked for over 10.39857 years!" ); 109 109 } 110 110 111 111 # Third test - sub calls back and forth between blocks.