On Wed, 6 Mar 2019, Damian McGuckin wrote:

The output is

         Brad's Test Does Not Match
         Damian's cubeRoot(5.30499e-315) rel.error = 0.0
         Chapel's cubeRoot(5.30499e-315) rel.error = 0.5

The above is with

        chpl cbrt.chpl

If instead I use

        chpl -O cbrt.chpl

then I get

         Chapel's cubeRoot(5.30499e-315) rel.error = 0.0

All good. So maybe not so weird after all.

When I re-run my tests in C without any optimization, I do not see that problem. So the problem is that without '-O', the answers in Chapel are different to what they are with that optimization which is understandable
but a little unexpected because -O is not doing what say --ieee-fast will
do.

Let me know if you want my code. I cannot reproduce the error with the small standalone program :

proc test()
{
    var x = 0x1.0p-1044;
    {
        const system = cbrt(x);
        const exact = 0x1.0p-348;
        const ypsilon = 0x1.0p+52;
        const brad = if system == exact then "Matches" else "Does Not Match";
        var y : x.type;

        writeln("Brad's Test ", brad);
        y = ypsilon * abs(exact - system)/exact;
        writeln("System's cubeRoot(", x, ") rel.error = ", y);
    }
}

test();

Which explains what you saw.

I will leave it with you. Beyond my expertise. More work for Michael. He
must really be starting to be annoyed by me! Maybe annoyed is not quite the word.

Work harder - 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


_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to