1 /******************************************************************************* 2 * Copyright (c) 2013, Daniel Murphy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 * and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 20 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 22 * POSSIBILITY OF SUCH DAMAGE. 23 ******************************************************************************/ 24 package java.lang; 25 26 /** 27 * GWT doesn't support strict math, so we "emulate" it with non-strict math. 28 */ 29 public class StrictMath { 30 abs(float a)31 public static float abs(float a) { 32 return Math.abs(a); 33 } 34 atan2(double y, double x)35 public static double atan2(double y, double x) { 36 return Math.atan2(y,x); 37 } 38 ceil(double a)39 public static double ceil(double a) { 40 return Math.ceil(a); 41 } 42 cos(double a)43 public static double cos(double a){ 44 return Math.cos(a); 45 } 46 floor(double a)47 public static double floor(double a) { 48 return Math.floor(a); 49 } 50 pow(double a, double b)51 public static double pow(double a, double b){ 52 return Math.pow(a, b); 53 } 54 round(float a)55 public static int round(float a){ 56 return Math.round(a); 57 } 58 sin(double a)59 public static double sin(double a){ 60 return Math.sin(a); 61 } 62 sqrt(double a)63 public static double sqrt(double a){ 64 return Math.sqrt(a); 65 } 66 } 67