michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.8.2.5.js michael@0: ECMA Section: 15.8.2.5 atan2( y, x ) michael@0: Description: michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 7 july 1997 michael@0: michael@0: */ michael@0: var SECTION = "15.8.2.5"; michael@0: var VERSION = "ECMA_1"; michael@0: var TITLE = "Math.atan2(x,y)"; michael@0: var BUGNUMBER="76111"; michael@0: michael@0: startTest(); michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2.length", michael@0: 2, michael@0: Math.atan2.length ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(NaN, 0)", michael@0: Number.NaN, michael@0: Math.atan2(Number.NaN,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(null, null)", michael@0: 0, michael@0: Math.atan2(null, null) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(void 0, void 0)", michael@0: Number.NaN, michael@0: Math.atan2(void 0, void 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2()", michael@0: Number.NaN, michael@0: Math.atan2() ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(0, NaN)", michael@0: Number.NaN, michael@0: Math.atan2(0,Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(1, 0)", michael@0: Math.PI/2, michael@0: Math.atan2(1,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(1,-0)", michael@0: Math.PI/2, michael@0: Math.atan2(1,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(0,0.001)", michael@0: 0, michael@0: Math.atan2(0,0.001) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(0,0)", michael@0: 0, michael@0: Math.atan2(0,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(0, -0)", michael@0: Math.PI, michael@0: Math.atan2(0,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(0, -1)", michael@0: Math.PI, michael@0: Math.atan2(0, -1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-0, 1)", michael@0: -0, michael@0: Math.atan2(-0, 1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Infinity/Math.atan2(-0, 1)", michael@0: -Infinity, michael@0: Infinity/Math.atan2(-0,1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-0, 0)", michael@0: -0, michael@0: Math.atan2(-0,0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-0, -0)", michael@0: -Math.PI, michael@0: Math.atan2(-0, -0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-0, -1)", michael@0: -Math.PI, michael@0: Math.atan2(-0, -1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-1, 0)", michael@0: -Math.PI/2, michael@0: Math.atan2(-1, 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-1, -0)", michael@0: -Math.PI/2, michael@0: Math.atan2(-1, -0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(1, Infinity)", michael@0: 0, michael@0: Math.atan2(1, Number.POSITIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(1,-Infinity)", michael@0: Math.PI, michael@0: Math.atan2(1, Number.NEGATIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-1, Infinity)", michael@0: -0, michael@0: Math.atan2(-1,Number.POSITIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Infinity/Math.atan2(-1, Infinity)", michael@0: -Infinity, michael@0: Infinity/Math.atan2(-1,Infinity) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-1,-Infinity)", michael@0: -Math.PI, michael@0: Math.atan2(-1,Number.NEGATIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity, 0)", michael@0: Math.PI/2, michael@0: Math.atan2(Number.POSITIVE_INFINITY, 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity, 1)", michael@0: Math.PI/2, michael@0: Math.atan2(Number.POSITIVE_INFINITY, 1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity,-1)", michael@0: Math.PI/2, michael@0: Math.atan2(Number.POSITIVE_INFINITY,-1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity,-0)", michael@0: Math.PI/2, michael@0: Math.atan2(Number.POSITIVE_INFINITY,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity, 0)", michael@0: -Math.PI/2, michael@0: Math.atan2(Number.NEGATIVE_INFINITY, 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity,-0)", michael@0: -Math.PI/2, michael@0: Math.atan2(Number.NEGATIVE_INFINITY,-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity, 1)", michael@0: -Math.PI/2, michael@0: Math.atan2(Number.NEGATIVE_INFINITY, 1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity, -1)", michael@0: -Math.PI/2, michael@0: Math.atan2(Number.NEGATIVE_INFINITY,-1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity, Infinity)", michael@0: Math.PI/4, michael@0: Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(Infinity, -Infinity)", michael@0: 3*Math.PI/4, michael@0: Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity, Infinity)", michael@0: -Math.PI/4, michael@0: Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-Infinity, -Infinity)", michael@0: -3*Math.PI/4, michael@0: Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.atan2(-1, 1)", michael@0: -Math.PI/4, michael@0: Math.atan2( -1, 1) ); michael@0: michael@0: test();