| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- function write(v) { WScript.Echo(v + ""); }
- function is_negative_zero(n)
- {
- if(n == 0 && 1/n < 0)
- return true;
- else
- return false;
- }
- function itself(a) { return a; }
- var x; var y;
- // mul
- x = 0*0; write(" 0* 0 : " + x + " " + is_negative_zero(x));
- x = -0*0; write("-0* 0 : " + x + " " + is_negative_zero(x));
- x = 0*-0; write(" 0*-0 : " + x + " " + is_negative_zero(x));
- x = -0*-0; write("-0*-0 : " + x + " " + is_negative_zero(x));
- x = 5*5; write(" 5* 5 : " + x + " " + is_negative_zero(x));
- x = -5*5; write("-5* 5 : " + x + " " + is_negative_zero(x));
- x = 5*-5; write(" 5*-5 : " + x + " " + is_negative_zero(x));
- x = -5*-5; write("-5*-5 : " + x + " " + is_negative_zero(x));
- x = 0*5; write(" 0* 5 : " + x + " " + is_negative_zero(x));
- x = -0*5; write("-0* 5 : " + x + " " + is_negative_zero(x));
- x = 0*-5; write(" 0*-5 : " + x + " " + is_negative_zero(x));
- x = -0*-5; write("-0*-5 : " + x + " " + is_negative_zero(x));
- // Div
- x = 0/0; write(" 0/ 0 : " + x + " " + is_negative_zero(x));
- x = -0/0; write("-0/ 0 : " + x + " " + is_negative_zero(x));
- x = 0/-0; write(" 0/-0 : " + x + " " + is_negative_zero(x));
- x = -0/-0; write("-0/-0 : " + x + " " + is_negative_zero(x));
- x = 5/5; write(" 5/ 5 : " + x + " " + is_negative_zero(x));
- x = -5/5; write("-5/ 5 : " + x + " " + is_negative_zero(x));
- x = 5/-5; write(" 5/-5 : " + x + " " + is_negative_zero(x));
- x = -5/-5; write("-5/-5 : " + x + " " + is_negative_zero(x));
- x = 0/5; write(" 0/ 5 : " + x + " " + is_negative_zero(x));
- x = -0/5; write("-0/ 5 : " + x + " " + is_negative_zero(x));
- x = 0/-5; write(" 0/-5 : " + x + " " + is_negative_zero(x));
- x = -0/-5; write("-0/-5 : " + x + " " + is_negative_zero(x));
- // Mod
- x = 0%0; write(" 0% 0 : " + x + " " + is_negative_zero(x));
- x = -0%0; write("-0% 0 : " + x + " " + is_negative_zero(x));
- x = 0%-0; write(" 0%-0 : " + x + " " + is_negative_zero(x));
- x = -0%-0; write("-0%-0 : " + x + " " + is_negative_zero(x));
- x = 5%5; write(" 5% 5 : " + x + " " + is_negative_zero(x));
- x = -5%5; write("-5% 5 : " + x + " " + is_negative_zero(x));
- x = 5%-5; write(" 5%-5 : " + x + " " + is_negative_zero(x));
- x = -5%-5; write("-5%-5 : " + x + " " + is_negative_zero(x));
- x = 0%5; write(" 0% 5 : " + x + " " + is_negative_zero(x));
- x = -0%5; write("-0% 5 : " + x + " " + is_negative_zero(x));
- x = 0%-5; write(" 0%-5 : " + x + " " + is_negative_zero(x));
- x = -0%-5; write("-0%-5 : " + x + " " + is_negative_zero(x));
- y = 1 / (0 / -1); write(y + " " + (y === -Infinity));
- y = 1 / (0 * -1); write(y + " " + (y === -Infinity));
- y = 1 / (+0 / -1); write(y + " " + (y === Number.NEGATIVE_INFINITY));
- y = 1 / (+0 * -1); write(y + " " + (y === Number.NEGATIVE_INFINITY));
- y = 2 / (-5 % 5 ); write(y + " " + (y === Number.NEGATIVE_INFINITY));
- y = -2/ (-5 % 5 ); write(y + " " + (y === Number.NEGATIVE_INFINITY));
- y = 2 / (-5 %-5 ); write(y + " " + (y === Number.NEGATIVE_INFINITY));
- y = -2/ (-5 %-5 ); write(y + " " + (y === Number.NEGATIVE_INFINITY));
-
- function op_test() {
- var x = 0;
- var y = 0;
- if ( itself(1) )
- {
- x = 0;
- y = -1;
- }
- else
- {
- x = 5;
- y = 10;
- }
-
- var r;
-
- r = x * y; write(r + " " + is_negative_zero(r));
- r = x / y; write(r + " " + is_negative_zero(r));
- r = x % y; write(r + " " + is_negative_zero(r));
- }
- op_test();
|