I'm looking into this issue and would like to ask for some advice.

I have added the following platform dependent functions.
int Parrot_math_isnan(double)
int Parrot_math_finite(double)

On Win32 the implementation is simple because the IEEE recommended
functions _finite and _isnan are supported.  I'm thinking about adding a
test for these functions and use them.  But what should happen if they
are not there?

Then I changed Parrot_sprintf_format in spf_render.c to use
Parrot_math_isnan and Parrot_math_finite to render "NaN", "-inf" and
"inf" directly.

Is this a good way to solve this?


Here's a sample (which should make its way into some tests):

>type test.pir
.sub main
    # -INF
    set N0, 0.0
    ln N1, N0

    print N1
    print "\n"

    # +INF
    abs N2, N1

    print N2
    print "\n"

    # NaN
    set N3, -1.0
    sqrt N4, N3

    print N4
    print "\n"
.end

# trunk
>parrot test.pir
-1.#INF00
1.#INF00
-1.#IND00

# local
>parrot test.pir
-inf
inf
NaN

Thanks,
Ron

Reply via email to