This seems to solve it - the tests now run successfully:
"
root@tinypxa263:/var/tmp/parrot-0.3.0# /usr/bin/perl5.8.4 t/harness
--gc-debug --running-make-test t/pmc/integer.t
t/pmc/integer....ok
All tests successful.
Files=1, Tests=11, 12 wallclock secs ( 6.30 cusr + 3.87 csys = 10.17 CPU)
"
And - as expected - complex.t revolts because it does not get "-0.0" any
more
Simon
Leopold Toetsch wrote:
> Simon Vogl wrote:
>
> [ ... ]
>
> Here are some relevant snippets auf Parrot on ARM (see also
> http://use.perl.org/~koobla/journal/ )
>
>> root@tinypxa263:/var/tmp/parrot-0.3.0# ./parrot -t
>> t/pmc/perlint_40.pasm
>> 0 new P0, 35 - P0=PMCNULL,
>> 3 new P1, 35 - P1=PMCNULL,
>> 6 set N0, 4000.04 - N0=0.000000,
>> 9 set P0, 123 - P0=PerlInt=PMC(0x348ea0 Num:0 Int:0),
>> 12 multiply P1, P0, N0 - P1=PerlInt=PMC(0x348e88 Num:0
>> Int:0), P0=PerlInt=PMC(0x348ea0 Num:123 Int:123), N0=4000.040000
>> 17 print P1 - P1=PerlNum=PMC(0x348e88 Num:492005 Int:492004)
>> 19 print "\n"
>> -492004.920000
>
>
> There are 2 problems. The trace dump truncates numbers and more
> importantly PerlNum.get_string() is very likely failing due to our
> 'signbit' hack that exists merely for the darn -0.0 negative zero.
>
> I think it's time to rewrite this code once again. Attached is a patch
> that should correct above error type. Unfortunately it causes
> different errors (of course +- 0.0) in t/pmc/complex.t. But it might
> very well be that the expected output of the test is bogus.
>
> The code in src/spf_render.c is also rather weird. At line 663 a
> STRING is created just to be converted back to a cstring in the next
> statement. This is probably not the most efficient way to strdup the
> format string ;-)
>
> Commenents & testers very welcome,
> leo
>
>------------------------------------------------------------------------
>
>Index: src/trace.c
>===================================================================
>--- src/trace.c (revision 9481)
>+++ src/trace.c (working copy)
>@@ -107,7 +107,7 @@
> else if (pmc->vtable->base_type == enum_class_PerlUndef
> || pmc->vtable->base_type == enum_class_PerlInt
> || pmc->vtable->base_type == enum_class_PerlNum) {
>- PIO_eprintf(interpreter, "%S=PMC(%#p Num:%Pg Int:%Pd)",
>+ PIO_eprintf(interpreter, "%S=PMC(%#p Num:%Pf Int:%Pd)",
> VTABLE_name(interpreter, pmc), pmc, pmc, pmc);
> }
> else if (pmc->vtable->base_type == enum_class_RetContinuation
>Index: src/spf_render.c
>===================================================================
>--- src/spf_render.c (revision 9481)
>+++ src/spf_render.c (working copy)
>@@ -658,7 +658,7 @@
> thefloat = obj->getfloat
> (interpreter, info.type, obj);
> /* turn -0.0 into 0.0 */
>- if( thefloat == 0.0 ) { thefloat = 0.0; }
>+ /* WTF if( thefloat == 0.0 ) { thefloat = 0.0; } */
> gen_sprintf_call(interpreter, tc, &info, ch);
> ts = cstr2pstr(tc);
> /* XXX lost precision if %Hg or whatever
>Index: classes/perlnum.pmc
>===================================================================
>--- classes/perlnum.pmc (revision 9481)
>+++ classes/perlnum.pmc (working copy)
>@@ -35,12 +35,20 @@
> */
>
> STRING* get_string () {
>+#if 0
> double d = (double) PMC_num_val(SELF);
> const char *sign = "-";
> if (!signbit(PMC_num_val(SELF)))
> sign = "";
> d = fabs(d);
> return Parrot_sprintf_c(INTERP, "%s" FLOATVAL_FMT, sign, d);
>+#else
>+ /* XXX signbit isn't portable and as we are calling Parrot_sprintf_c
>+ * anyway, we can use the builtin number formatting too
>+ * this might still be a problem with -0.0
>+ */
>+ return Parrot_sprintf_c(INTERP, "%Pf", SELF);
>+#endif
> }
>
>
>
>
--
_______________________________________________________________________
Dr. Simon Vogl
ARC Seibersdorf research GmbH
Research Studios Austria, Studio Pervasive Computing Applications
Altenberger Straße 69, A-4040 Linz, Austria
Tel: +43 732 2468-8517, Fax: +43 732 2468-8426
mailto: simon...@researchstudio.at