Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #37434] [PATCH] number formatting (was: ARM Parrot benchmarks / Parrot on ARM platform)

0 views
Skip to first unread message

Leopold Toetsch

unread,
Oct 14, 2005, 7:58:50 AM10/14/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Leopold Toetsch
# Please include the string: [perl #37434]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37434 >


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

num.patch

François PERRAD

unread,
Oct 20, 2005, 2:34:04 PM10/20/05
to perl6-i...@perl.org

With MinGW (gcc 3.4.2 on MSWin32) :

$ perl t/harness t/pmc/perlnum.t
t/pmc/perlnum.......NOK 47
# Failed test (t/pmc/perlnum.t at line 961)
# got: '0
# 0.000000
# '
# expected: '0
# -0.000000
# '
t/pmc/perlnum.......NOK 55# Looks like you failed 1 test of 55.
t/pmc/perlnum.......dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED tests 47, 55
Failed 2/55 tests, 96.36% okay
Failed Test Status Wstat Total Fail Failed List of Failed
--------------------------------------------------------------------------------

Temporarily, I reactivate the old code in perlnum.pmc

François

>leo


0 new messages