Hi All,

I am playing around with a mocked-up recast facility.

The following fails.

proc fp754putZ(v : uint(?w)) : real(w)
{
        return jam(real(w), v);
}

module T
{
        proc main()
        {
                type R = real(32);
                type U = uint(numBits(R));
                const zero = 0:U;

                writeln(fp754putZ(zero));
        }
}

However, if I use

        proc fpReal(type T) type where T == uint(32) return real(32);
        proc fpReal(type T) type where T == uint(64) return real(64);

to provide the types of the variable and return for fp754putZ, then
this works.

proc fp754putZ(v : ?Zsef) : fpReal(Zsef)
{
        return jam(fpReal(Zsef), v);
}

module T
{
        proc main()
        {
                type R = real(32);
                type U = uint(numBits(R));
                const zero = 0:U;

                writeln(fp754putZ(zero));
        }
}

What am I doing wrong?

Happy to share the full test code. What is the protocol for sharing a total of 3 files, a .chpl, a .c and a .h. Put a shar-file in the body or just attach the stuff. Total line count is 61 lines.

For the record, the mirror image which follows of the offensive little nuisance above, works!

proc fp754getZ(v : real(?w)) : uint(w)
{
        return jam(uint(w), v);
}

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to