Hi All,

Given a number

        m : real(?w) where w = 32, 64, 128???

and
        half = 0.5:real(w)

say, I want to know whether

        abs(m) < sqrt(2.0:real(w)) * 0.5:real(w)

Using a number accurate to 40 decimal places, I could write

        const sqrtTwo = 1.4142135623730950488016887242096980785696:real(w);

If I rely on the truncation error of the compiler as it approximates that constant (originally accurate to 40 places) to w binary digits, I use

        abs(m) < sqrtTwo * Half

and I know that the multiplication on the right does not damage accuracy.

I could rely on the truncation error of the multiplication to just do

        m * m < half // nominally the same

Am I going to sacrifice accuracy for portability by using the latter?

What looks more readable?

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