1# Copyright 2013 the V8 project authors. All rights reserved. 2# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 13# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24This test checks the behavior of the Math object as described in 15.8 of the language specification. 25 26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29PASS Math.abs(NaN) is NaN 30PASS Math.abs(0) is 0 31PASS Math.abs(-0) is 0 32PASS Math.abs(1) is 1 33PASS Math.abs(-1) is 1 34PASS Math.abs(Number.MIN_VALUE) is Number.MIN_VALUE 35PASS Math.abs(-Number.MIN_VALUE) is Number.MIN_VALUE 36PASS Math.abs(Number.MAX_VALUE) is Number.MAX_VALUE 37PASS Math.abs(-Number.MAX_VALUE) is Number.MAX_VALUE 38PASS Math.abs(Infinity) is Infinity 39PASS Math.abs(-Infinity) is Infinity 40PASS Math.acos(NaN) is NaN 41PASS Math.acos(-0) is Math.acos(0) 42PASS Math.acos(1) is 0 43PASS Math.acos(1.1) is NaN 44PASS Math.acos(-1.1) is NaN 45PASS Math.acos(Infinity) is NaN 46PASS Math.acos(-Infinity) is NaN 47PASS Math.asin(NaN) is NaN 48PASS Math.asin(0) is 0 49PASS Math.asin(-0) is -0 50PASS Math.asin(1) is -Math.asin(-1) 51PASS Math.asin(1.1) is NaN 52PASS Math.asin(-1.1) is NaN 53PASS Math.asin(Infinity) is NaN 54PASS Math.asin(-Infinity) is NaN 55PASS Math.atan(NaN) is NaN 56PASS Math.atan(0) is 0 57PASS Math.atan(-0) is -0 58PASS Math.atan(Infinity) is -Math.atan(-Infinity) 59PASS Math.atan2(NaN, NaN) is NaN 60PASS Math.atan2(NaN, 0) is NaN 61PASS Math.atan2(NaN, -0) is NaN 62PASS Math.atan2(NaN, 1) is NaN 63PASS Math.atan2(NaN, Infinity) is NaN 64PASS Math.atan2(NaN, -Infinity) is NaN 65PASS Math.atan2(0, NaN) is NaN 66PASS Math.atan2(-0, NaN) is NaN 67PASS Math.atan2(1, NaN) is NaN 68PASS Math.atan2(Infinity, NaN) is NaN 69PASS Math.atan2(-Infinity, NaN) is NaN 70PASS testStr is "onetwo" 71PASS Math.ceil(NaN) is NaN 72PASS Math.ceil(0) is 0 73PASS Math.ceil(-0) is -0 74PASS Math.ceil(-0.5) is -0 75PASS Math.ceil(1) is 1 76PASS Math.ceil(-1) is -1 77PASS Math.ceil(1.1) is 2 78PASS Math.ceil(-1.1) is -1 79PASS Math.ceil(Number.MIN_VALUE) is 1 80PASS Math.ceil(-Number.MIN_VALUE) is -0 81PASS Math.ceil(Number.MAX_VALUE) is Number.MAX_VALUE 82PASS Math.ceil(-Number.MAX_VALUE) is -Number.MAX_VALUE 83PASS Math.ceil(Infinity) is Infinity 84PASS Math.ceil(-Infinity) is -Infinity 85PASS Math.cos(NaN) is NaN 86PASS Math.cos(0) is 1 87PASS Math.cos(-0) is 1 88PASS Math.cos(Infinity) is NaN 89PASS Math.cos(-Infinity) is NaN 90PASS Math.exp(NaN) is NaN 91PASS Math.exp(0) is 1 92PASS Math.exp(-0) is 1 93PASS Math.exp(Infinity) is Infinity 94PASS Math.exp(-Infinity) is 0 95PASS Math.floor(NaN) is NaN 96PASS Math.floor(0) is 0 97PASS Math.floor(-0) is -0 98PASS Math.floor(0.5) is 0 99PASS Math.floor(1) is 1 100PASS Math.floor(-1) is -1 101PASS Math.floor(1.1) is 1 102PASS Math.floor(-1.1) is -2 103PASS Math.floor(Number.MIN_VALUE) is 0 104PASS Math.floor(-Number.MIN_VALUE) is -1 105PASS Math.floor(Number.MAX_VALUE) is Number.MAX_VALUE 106PASS Math.floor(-Number.MAX_VALUE) is -Number.MAX_VALUE 107PASS Math.floor(Infinity) is Infinity 108PASS Math.floor(-Infinity) is -Infinity 109PASS Math.log(NaN) is NaN 110PASS Math.log(0) is -Infinity 111PASS Math.log(-0) is -Infinity 112PASS Math.log(1) is 0 113PASS Math.log(-1) is NaN 114PASS Math.log(-1.1) is NaN 115PASS Math.log(Infinity) is Infinity 116PASS Math.log(-Infinity) is NaN 117PASS Math.max() is -Infinity 118PASS Math.max(NaN) is NaN 119PASS Math.max(NaN,1) is NaN 120PASS Math.max(0) is 0 121PASS Math.max(-0) is -0 122PASS Math.max(-0, 0) is 0 123PASS Math.min() is Infinity 124PASS Math.min(NaN) is NaN 125PASS Math.min(NaN,1) is NaN 126PASS Math.min(0) is 0 127PASS Math.min(-0) is -0 128PASS Math.min(-0, 0) is -0 129PASS Math.pow(NaN, NaN) is NaN 130PASS Math.pow(NaN, 0) is 1 131PASS Math.pow(NaN, -0) is 1 132PASS Math.pow(NaN, 1) is NaN 133PASS Math.pow(NaN, Infinity) is NaN 134PASS Math.pow(NaN, -Infinity) is NaN 135PASS Math.pow(0, NaN) is NaN 136PASS Math.pow(-0, NaN) is NaN 137PASS Math.pow(1, NaN) is NaN 138PASS Math.pow(Infinity, NaN) is NaN 139PASS Math.pow(-Infinity, NaN) is NaN 140PASS Math.round(NaN) is NaN 141PASS Math.round(0) is 0 142PASS Math.round(-0) is -0 143PASS Math.round(0.4) is 0 144PASS Math.round(-0.4) is -0 145PASS Math.round(0.5) is 1 146PASS Math.round(-0.5) is -0 147PASS Math.round(0.6) is 1 148PASS Math.round(-0.6) is -1 149PASS Math.round(1) is 1 150PASS Math.round(-1) is -1 151PASS Math.round(1.1) is 1 152PASS Math.round(-1.1) is -1 153PASS Math.round(1.5) is 2 154PASS Math.round(-1.5) is -1 155PASS Math.round(1.6) is 2 156PASS Math.round(-1.6) is -2 157PASS Math.round(8640000000000000) is 8640000000000000 158PASS Math.round(8640000000000000.5) is 8640000000000000 159PASS Math.round(8640000000000001) is 8640000000000001 160PASS Math.round(8640000000000002) is 8640000000000002 161PASS Math.round(9007199254740990) is 9007199254740990 162PASS Math.round(9007199254740991) is 9007199254740991 163PASS Math.round(1.7976931348623157e+308) is 1.7976931348623157e+308 164PASS Math.round(-8640000000000000) is -8640000000000000 165PASS Math.round(-8640000000000001) is -8640000000000001 166PASS Math.round(-8640000000000002) is -8640000000000002 167PASS Math.round(-9007199254740990) is -9007199254740990 168PASS Math.round(-9007199254740991) is -9007199254740991 169PASS Math.round(-1.7976931348623157e+308) is -1.7976931348623157e+308 170PASS Math.round(Infinity) is Infinity 171PASS Math.round(-Infinity) is -Infinity 172PASS Math.sin(NaN) is NaN 173PASS Math.sin(0) is 0 174PASS Math.sin(-0) is -0 175PASS Math.sin(Infinity) is NaN 176PASS Math.sin(-Infinity) is NaN 177PASS Math.sqrt(NaN) is NaN 178PASS Math.sqrt(0) is 0 179PASS Math.sqrt(-0) is -0 180PASS Math.sqrt(1) is 1 181PASS Math.sqrt(-1) is NaN 182PASS Math.sqrt(Infinity) is Infinity 183PASS Math.sqrt(-Infinity) is NaN 184PASS Math.tan(NaN) is NaN 185PASS Math.tan(0) is 0 186PASS Math.tan(-0) is -0 187PASS Math.tan(Infinity) is NaN 188PASS Math.tan(-Infinity) is NaN 189PASS delete Math; is true 190PASS 'Math' in global() is false 191PASS successfullyParsed is true 192 193TEST COMPLETE 194 195