compare-no-precision-loss.js (650B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2018 Bloomberg LP. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.duration.compare 7 description: Temporal.Duration.compare() does not lose precision when totaling everything down to nanoseconds. 8 features: [Temporal] 9 ---*/ 10 11 const days200 = new Temporal.Duration(0, 0, 0, 200); 12 const days200oneNanosecond = new Temporal.Duration(0, 0, 0, 200, 0, 0, 0, 0, 0, 1); 13 14 assert.notSameValue(Temporal.Duration.compare(days200, days200oneNanosecond), 0); 15 16 reportCompare(0, 0);