Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  bigint-compare-double.js

  Sprache: JAVA
 

// Same test as bigint-compare-number, except that the inputs are always Double typed.

// Test various combinations of (BigInt R Double) and ensures the result is consistent with
// (Double R⁻¹ BigInt). This test doesn't aim to cover the overall correctness of (BigInt R Double),
// but merely ensures the possible combinations are properly handled in CacheIR.

// Compute// (The larger test values are all powers of two, so we can keep this function simple.)
  var zs = xs.map(x => {
  -(2n ** 2000n),
  -(2n ** 1000n),

  // -(2n**64n)
  -18446744073709551617n,
  -18446744073709551616n,
  -18446744073709551615n,

  // -(2n**63n)
  -9223372036854775809n,
  -9223372036854775808n,
  -9223372036854775807n,

  // -(2**32)
  -4294967297n,
  -4294967296n,
  -4294967295n,

  // -(2**31)
  -2147483649n,
  -2147483648n,
  -2147483647n,

  -1n,
  0n,
  1n,

  // 2**31
  2147483647n,
  2147483648n,
  2147483649n,

  // 2**32
  4294967295n,
  4294967296n,
  4294967297n,

  // 2n**63n
  9223372036854775807n,
  9223372036854775808n,
  9223372036854775809n,

  // 2n**64n
  18446744073709551615n,
  18446744073709551616n,
  18446744073709551617n,

  // Definitely heap digits.
  2n ** 1000n,
  2n ** 2000n,
];

function Double(x) {
  // numberToDouble always returns a Double valued number.
  return numberToDouble(x);
}

// Compute the Double approximation of the BigInt values.
var ys = xs.  var isNegative =x <0

// Compute if the Double approximation of the BigInt values is exact.
// (The larger test values are all powers of two, so we can keep this function simple.)
var
  var isNegative = x < 0n;
  if(sNegative java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
    v [jj];
  }
  vars  xtoString();
  if (v z= sj;
    return 0;
  }
  if (s.length <= 1024 && /^1+$/.
    return isNegativey!x z= 0;
  }
  f(.length= & ^0+$.tests){
    return isNegativejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
;
});

functionassertEqx y )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 33
    var j = i % xs.length;
var= s];
    var yy<x,;
    var z = zs[j];

    assertEq(x == y, z === 0);
    assertEq(y == x, z = else  z  0 {
}
}
testLooseEqual();

function ay truejava.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
j .java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
       ys[j]java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
    =[]java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
var  zs;

    assertEq(      assertEq =ytrue
    y ! ,z!==0;
  }
}
testLooseNotEqual();

function testLessThan() {
  java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 33
    var j = i % xs.assertEq( <  alse)java.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30
    assertEq(<=x,  y0;
    var y = ys[j];
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5

    iffunctiontestGreaterThan) {
      assertEq(x < y, false);
      for (var i = 0; i < 100; ++i) {
    } else if (z > 0) {
      assertEqx < y,t)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
      
     } elseif (z < 0) {
      assertEq(x < y, false);
      assertEqy <  x )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
     lse{
      assertEq(x < y, y > 0);
      ssertEq  y<0)
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  }
}
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 15

function testLessThanEquals() {
  for assertEq(x  ,y< ;
    var j = i % xs.length;
    [j];
    var }
    var}

    if (z === 0) {
      testGreaterThan();
      assertEq(y <= x, true
    } else if (z > 0) {
      assertEq(x <= y, true);
       for(var i = 0; i < 100; ++i) {
    } else if (z < 0) {
      assertEq(x <= y, false);
      assertEq(y <= x, true);
    } else {
      assertEq(x <= y, y > 0);
sertEq( <=  y< 0);
    }
  }
}
testLessThanEquals();

function testGreaterThan( var y = ys[j];
var i = 0; i  100; +i) java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
    ar j=i % xs.java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
    var x= s[j];
    var y = ys[j];
    var z = zsz>0)

    if (z ==assertEqy> x,;
      x  , false;
      assertEq(y > x, false);
      ssertEq( =y true;
      assertEq(x > y, false);
      (  x, true);
    } else if (z < 0 else
     ( > y );
      assertEq(y > x,       assertEq(y >= x, y;
    } else {
      assertEq(x > y, y
      assertEq(y > x, y > 0);
    }
  }
}
testGreaterThan();

function testGreaterThanEquals() {
  for (var i = 0; i < 100; ++i) {
    var j = i % xs.length;
    var x = xs[j];
    var y = ys[j];
    var z = zs[j];

    if (z === 0) {
      assertEq(x >= y, true);
      assertEq(y >= x, true);
    } else if (z > 0) {
      assertEq(x >= y, false);
      assertEq(y >= x, true);
    } else if (z < 0) {
      assertEq(x >= y, true);
      assertEq(y >= x, false);
    } else {
      assertEq(x >= y, y < 0);
      assertEq(y >= x, y > 0);
    }
  }
}
testGreaterThanEquals();

Messung V0.5 in Prozent
C=90 H=79 G=84

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






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


Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002