-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathdouble_t02.dart
36 lines (31 loc) · 1.09 KB
/
double_t02.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion The predefined Dart function identical() is defined such that
/// identical(c1, c2) iff:
/// . . .
/// • c1 and c2 are instances of double and one of the following holds:
/// – c1 and c2 are non-zero and c1 == c2.
/// – Both c1 and c2 are +0.0.
/// – Both c1 and c2 are −0.0.
/// – Both c1 and c2 represent a NaN value with the same underlying bit
/// pattern.
/// @description Checks that two NaNs are identical.
/// @author kaigorodov
/// @issue 42224
import "../../../Utils/expect.dart";
div(var a, var b) {
return a / b;
}
var nol = 0.0;
main() {
double nan1 = div(nol, nol);
double nan2 = div(nol, nol);
if (isJS) {
Expect.isFalse(identical(nan1, nan2));
Expect.isFalse(identical(double.nan, double.nan));
} else {
Expect.isTrue(identical(nan1, nan2));
Expect.isTrue(identical(double.nan, double.nan));
}
}