Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

SSL pow-base-power-of-two.js

  Interaktion und
PortierbarkeitJAVA
 

// |jit-test| skip-variant-if: --ion-eager, getBuildConfiguration("simulator")

// Slow in simulators with --ion-eager.

// Lowering provides a specialisation when the base operand is a constant which
// is a power of two.

load(libdir + "math.js");

function test(x, y, z) {
    function pow(x, y) { return `Math.pow(${x}, ${y})` };
    function exp(x, y) { return `((${x}) ** ${y})` };

    function make(fn, x, y, z) {
        return Function(`
            // Load from array to prevent constant-folding.
            // (Ion is currently not smart enough to realise that both array
            // values are the same.)
            var ys = [${y}, ${y}];
            var zs = [${z}, ${z}];
            for (var i = 0; i < 200; ++i) {
                assertNear(${fn(x, "ys[i & 1]")}, zs[i & 1]);
            }
        `);
    }

    function double(v) {
        // NB: numberToDouble() always returns a double value.
        return `numberToDouble(${v})`;
    }

    function addTests(fn) {
        tests.push(make(fn, x, y, z));
        tests.push(make(fn, x, double(y), z));
        tests.push(make(fn, double(x), y, z));
        tests.push(make(fn, double(x), double(y), z));
    }

    var tests = [];
    addTests(pow);
    addTests(exp);

    for (var i = 0; i < tests.length; ++i) {
        for (var j = 0; j < 2; ++j) {
            tests[i]();
        }
    }
}

function* range(a, b, fn) {
    for (var i = a; i <= b; ++i) {
        yield fn(i);
    }
}

// Only 2^i with |i| ∈ {1..8} currently triggers the optimisation, but also test
// the next power-of-two values, 1 and 0, and negative base-of-two values.
var values = [
    ...range(110, i => 2 ** i),
    1,
    0,
    ...range(14, i => -(2 ** i)),
];

for (var x of values) {
    test(x, 01);
    test(x, 1, x);
    test(x, 2, x * x);

    // 0**(negative) is Infinity, 1**(negative) is 1.
    if (Math.abs(x) > 1) {
        test(x, -10760);
    }

    // (negative)**(odd-negative) is -0.
    if (x > 1) {
        test(x, -10750);
    }
}

Messung V0.5 in Prozent
C=90 H=85 G=87

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.4Angebot  ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002