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.2.js michael@0: ECMA Section: 15.8.2.2 acos( x ) michael@0: Description: return an approximation to the arc cosine of the michael@0: argument. the result is expressed in radians and michael@0: range is from +0 to +PI. special cases: michael@0: - if x is NaN, return NaN michael@0: - if x > 1, the result is NaN michael@0: - if x < -1, the result is NaN michael@0: - if x == 1, the result is +0 michael@0: Author: christine@netscape.com michael@0: Date: 7 july 1997 michael@0: */ michael@0: var SECTION = "15.8.2.2"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "Math.acos()"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos.length", michael@0: 1, michael@0: Math.acos.length ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(void 0)", michael@0: Number.NaN, michael@0: Math.acos(void 0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos()", michael@0: Number.NaN, michael@0: Math.acos() ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(null)", michael@0: Math.PI/2, michael@0: Math.acos(null) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(NaN)", michael@0: Number.NaN, michael@0: Math.acos(Number.NaN) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(a string)", michael@0: Number.NaN, michael@0: Math.acos("a string") ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos('0')", michael@0: Math.PI/2, michael@0: Math.acos('0') ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos('1')", michael@0: 0, michael@0: Math.acos('1') ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos('-1')", michael@0: Math.PI, michael@0: Math.acos('-1') ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(1.00000001)", michael@0: Number.NaN, michael@0: Math.acos(1.00000001) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(11.00000001)", michael@0: Number.NaN, michael@0: Math.acos(-1.00000001) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(1)", michael@0: 0, michael@0: Math.acos(1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(-1)", michael@0: Math.PI, michael@0: Math.acos(-1) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(0)", michael@0: Math.PI/2, michael@0: Math.acos(0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(-0)", michael@0: Math.PI/2, michael@0: Math.acos(-0) ); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(Math.SQRT1_2)", michael@0: Math.PI/4, michael@0: Math.acos(Math.SQRT1_2)); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(-Math.SQRT1_2)", michael@0: Math.PI/4*3, michael@0: Math.acos(-Math.SQRT1_2)); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(0.9999619230642)", michael@0: Math.PI/360, michael@0: Math.acos(0.9999619230642)); michael@0: michael@0: new TestCase( SECTION, michael@0: "Math.acos(-3.0)", michael@0: Number.NaN, michael@0: Math.acos(-3.0)); michael@0: michael@0: test();