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 24 This test checks the behavior of the Math object as described in 15.8 of the language specification. 25 26 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 27 28 29 PASS Math.abs(NaN) is NaN 30 PASS Math.abs(0) is 0 31 PASS Math.abs(-0) is 0 32 PASS Math.abs(1) is 1 33 PASS Math.abs(-1) is 1 34 PASS Math.abs(Number.MIN_VALUE) is Number.MIN_VALUE 35 PASS Math.abs(-Number.MIN_VALUE) is Number.MIN_VALUE 36 PASS Math.abs(Number.MAX_VALUE) is Number.MAX_VALUE 37 PASS Math.abs(-Number.MAX_VALUE) is Number.MAX_VALUE 38 PASS Math.abs(Infinity) is Infinity 39 PASS Math.abs(-Infinity) is Infinity 40 PASS Math.acos(NaN) is NaN 41 PASS Math.acos(-0) is Math.acos(0) 42 PASS Math.acos(1) is 0 43 PASS Math.acos(1.1) is NaN 44 PASS Math.acos(-1.1) is NaN 45 PASS Math.acos(Infinity) is NaN 46 PASS Math.acos(-Infinity) is NaN 47 PASS Math.asin(NaN) is NaN 48 PASS Math.asin(0) is 0 49 PASS Math.asin(-0) is -0 50 PASS Math.asin(1) is -Math.asin(-1) 51 PASS Math.asin(1.1) is NaN 52 PASS Math.asin(-1.1) is NaN 53 PASS Math.asin(Infinity) is NaN 54 PASS Math.asin(-Infinity) is NaN 55 PASS Math.atan(NaN) is NaN 56 PASS Math.atan(0) is 0 57 PASS Math.atan(-0) is -0 58 PASS Math.atan(Infinity) is -Math.atan(-Infinity) 59 PASS Math.atan2(NaN, NaN) is NaN 60 PASS Math.atan2(NaN, 0) is NaN 61 PASS Math.atan2(NaN, -0) is NaN 62 PASS Math.atan2(NaN, 1) is NaN 63 PASS Math.atan2(NaN, Infinity) is NaN 64 PASS Math.atan2(NaN, -Infinity) is NaN 65 PASS Math.atan2(0, NaN) is NaN 66 PASS Math.atan2(-0, NaN) is NaN 67 PASS Math.atan2(1, NaN) is NaN 68 PASS Math.atan2(Infinity, NaN) is NaN 69 PASS Math.atan2(-Infinity, NaN) is NaN 70 PASS testStr is "onetwo" 71 PASS Math.ceil(NaN) is NaN 72 PASS Math.ceil(0) is 0 73 PASS Math.ceil(-0) is -0 74 PASS Math.ceil(-0.5) is -0 75 PASS Math.ceil(1) is 1 76 PASS Math.ceil(-1) is -1 77 PASS Math.ceil(1.1) is 2 78 PASS Math.ceil(-1.1) is -1 79 PASS Math.ceil(Number.MIN_VALUE) is 1 80 PASS Math.ceil(-Number.MIN_VALUE) is -0 81 PASS Math.ceil(Number.MAX_VALUE) is Number.MAX_VALUE 82 PASS Math.ceil(-Number.MAX_VALUE) is -Number.MAX_VALUE 83 PASS Math.ceil(Infinity) is Infinity 84 PASS Math.ceil(-Infinity) is -Infinity 85 PASS Math.cos(NaN) is NaN 86 PASS Math.cos(0) is 1 87 PASS Math.cos(-0) is 1 88 PASS Math.cos(Infinity) is NaN 89 PASS Math.cos(-Infinity) is NaN 90 PASS Math.exp(NaN) is NaN 91 PASS Math.exp(0) is 1 92 PASS Math.exp(-0) is 1 93 PASS Math.exp(Infinity) is Infinity 94 PASS Math.exp(-Infinity) is 0 95 PASS Math.floor(NaN) is NaN 96 PASS Math.floor(0) is 0 97 PASS Math.floor(-0) is -0 98 PASS Math.floor(0.5) is 0 99 PASS Math.floor(1) is 1 100 PASS Math.floor(-1) is -1 101 PASS Math.floor(1.1) is 1 102 PASS Math.floor(-1.1) is -2 103 PASS Math.floor(Number.MIN_VALUE) is 0 104 PASS Math.floor(-Number.MIN_VALUE) is -1 105 PASS Math.floor(Number.MAX_VALUE) is Number.MAX_VALUE 106 PASS Math.floor(-Number.MAX_VALUE) is -Number.MAX_VALUE 107 PASS Math.floor(Infinity) is Infinity 108 PASS Math.floor(-Infinity) is -Infinity 109 PASS Math.log(NaN) is NaN 110 PASS Math.log(0) is -Infinity 111 PASS Math.log(-0) is -Infinity 112 PASS Math.log(1) is 0 113 PASS Math.log(-1) is NaN 114 PASS Math.log(-1.1) is NaN 115 PASS Math.log(Infinity) is Infinity 116 PASS Math.log(-Infinity) is NaN 117 PASS Math.max() is -Infinity 118 PASS Math.max(NaN) is NaN 119 PASS Math.max(NaN,1) is NaN 120 PASS Math.max(0) is 0 121 PASS Math.max(-0) is -0 122 PASS Math.max(-0, 0) is 0 123 PASS Math.min() is Infinity 124 PASS Math.min(NaN) is NaN 125 PASS Math.min(NaN,1) is NaN 126 PASS Math.min(0) is 0 127 PASS Math.min(-0) is -0 128 PASS Math.min(-0, 0) is -0 129 PASS Math.pow(NaN, NaN) is NaN 130 PASS Math.pow(NaN, 0) is 1 131 PASS Math.pow(NaN, -0) is 1 132 PASS Math.pow(NaN, 1) is NaN 133 PASS Math.pow(NaN, Infinity) is NaN 134 PASS Math.pow(NaN, -Infinity) is NaN 135 PASS Math.pow(0, NaN) is NaN 136 PASS Math.pow(-0, NaN) is NaN 137 PASS Math.pow(1, NaN) is NaN 138 PASS Math.pow(Infinity, NaN) is NaN 139 PASS Math.pow(-Infinity, NaN) is NaN 140 PASS Math.round(NaN) is NaN 141 PASS Math.round(0) is 0 142 PASS Math.round(-0) is -0 143 PASS Math.round(0.4) is 0 144 PASS Math.round(-0.4) is -0 145 PASS Math.round(0.5) is 1 146 PASS Math.round(-0.5) is -0 147 PASS Math.round(0.6) is 1 148 PASS Math.round(-0.6) is -1 149 PASS Math.round(1) is 1 150 PASS Math.round(-1) is -1 151 PASS Math.round(1.1) is 1 152 PASS Math.round(-1.1) is -1 153 PASS Math.round(1.5) is 2 154 PASS Math.round(-1.5) is -1 155 PASS Math.round(1.6) is 2 156 PASS Math.round(-1.6) is -2 157 PASS Math.round(8640000000000000) is 8640000000000000 158 PASS Math.round(8640000000000000.5) is 8640000000000000 159 PASS Math.round(8640000000000001) is 8640000000000001 160 PASS Math.round(8640000000000002) is 8640000000000002 161 PASS Math.round(9007199254740990) is 9007199254740990 162 PASS Math.round(9007199254740991) is 9007199254740991 163 PASS Math.round(1.7976931348623157e+308) is 1.7976931348623157e+308 164 PASS Math.round(-8640000000000000) is -8640000000000000 165 PASS Math.round(-8640000000000001) is -8640000000000001 166 PASS Math.round(-8640000000000002) is -8640000000000002 167 PASS Math.round(-9007199254740990) is -9007199254740990 168 PASS Math.round(-9007199254740991) is -9007199254740991 169 PASS Math.round(-1.7976931348623157e+308) is -1.7976931348623157e+308 170 PASS Math.round(Infinity) is Infinity 171 PASS Math.round(-Infinity) is -Infinity 172 PASS Math.sin(NaN) is NaN 173 PASS Math.sin(0) is 0 174 PASS Math.sin(-0) is -0 175 PASS Math.sin(Infinity) is NaN 176 PASS Math.sin(-Infinity) is NaN 177 PASS Math.sqrt(NaN) is NaN 178 PASS Math.sqrt(0) is 0 179 PASS Math.sqrt(-0) is -0 180 PASS Math.sqrt(1) is 1 181 PASS Math.sqrt(-1) is NaN 182 PASS Math.sqrt(Infinity) is Infinity 183 PASS Math.sqrt(-Infinity) is NaN 184 PASS Math.tan(NaN) is NaN 185 PASS Math.tan(0) is 0 186 PASS Math.tan(-0) is -0 187 PASS Math.tan(Infinity) is NaN 188 PASS Math.tan(-Infinity) is NaN 189 PASS delete Math; is true 190 PASS 'Math' in global() is false 191 PASS successfullyParsed is true 192 193 TEST COMPLETE 194 195