tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bigint-and-non-finite.js (1632B)


      1 // Copyright (C) 2017 Josh Wolfe. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 description: Comparisons of BigInt and non-finite Number values
      5 esid: sec-abstract-relational-comparison
      6 info: |
      7  ...
      8  3. If both px and py are Strings, then
      9    ...
     10  4. Else,
     11    a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important.
     12    b. Let ny be ? ToNumeric(py).
     13    c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny).
     14    d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt.
     15    e. If x or y are any of NaN, return undefined.
     16    f. If x is -∞, or y is +∞, return true.
     17    g. If x is +∞, or y is -∞, return false.
     18 features: [BigInt]
     19 ---*/
     20 assert.sameValue(1n < Infinity, true, 'The result of (1n < Infinity) is true');
     21 assert.sameValue(Infinity < 1n, false, 'The result of (Infinity < 1n) is false');
     22 assert.sameValue(-1n < Infinity, true, 'The result of (-1n < Infinity) is true');
     23 assert.sameValue(Infinity < -1n, false, 'The result of (Infinity < -1n) is false');
     24 assert.sameValue(1n < -Infinity, false, 'The result of (1n < -Infinity) is false');
     25 assert.sameValue(-Infinity < 1n, true, 'The result of (-Infinity < 1n) is true');
     26 assert.sameValue(-1n < -Infinity, false, 'The result of (-1n < -Infinity) is false');
     27 assert.sameValue(-Infinity < -1n, true, 'The result of (-Infinity < -1n) is true');
     28 assert.sameValue(0n < NaN, false, 'The result of (0n < NaN) is false');
     29 assert.sameValue(NaN < 0n, false, 'The result of (NaN < 0n) is false');
     30 
     31 reportCompare(0, 0);