001: //
002: // Copyright (C) 2005 United States Government as represented by the
003: // Administrator of the National Aeronautics and Space Administration
004: // (NASA). All Rights Reserved.
005: //
006: // This software is distributed under the NASA Open Source Agreement
007: // (NOSA), version 1.3. The NOSA has been approved by the Open Source
008: // Initiative. See the file NOSA-1.3-JPF at the top of the distribution
009: // directory tree for the complete NOSA document.
010: //
011: // THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
012: // KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
013: // LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
014: // SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
015: // A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
016: // THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
017: // DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
018: //
019: package gov.nasa.jpf.jvm;
020:
021: /**
022: * MJI NativePeer class for java.lang.Math library abstraction
023: */
024: public class JPF_java_lang_Math {
025: public static double abs__D(MJIEnv env, int clsObjRef, double a) {
026: return Math.abs(a);
027: }
028:
029: public static float abs__F(MJIEnv env, int clsObjRef, float a) {
030: return Math.abs(a);
031: }
032:
033: public static int abs__I(MJIEnv env, int clsObjRef, int a) {
034: return Math.abs(a);
035: }
036:
037: public static long abs__J(MJIEnv env, int clsObjRef, long a) {
038: return Math.abs(a);
039: }
040:
041: public static double max__DD(MJIEnv env, int clsObjRef, double a,
042: double b) {
043: return Math.max(a, b);
044: }
045:
046: public static float max__FF(MJIEnv env, int clsObjRef, float a,
047: float b) {
048: return Math.max(a, b);
049: }
050:
051: public static int max__II(MJIEnv env, int clsObjRef, int a, int b) {
052: return Math.max(a, b);
053: }
054:
055: public static long max__JJ(MJIEnv env, int clsObjRef, long a, long b) {
056: return Math.max(a, b);
057: }
058:
059: public static double min__DD(MJIEnv env, int clsObjRef, double a,
060: double b) {
061: return Math.min(a, b);
062: }
063:
064: public static float min__FF(MJIEnv env, int clsObjRef, float a,
065: float b) {
066: return Math.min(a, b);
067: }
068:
069: public static int min__II(MJIEnv env, int clsObjRef, int a, int b) {
070: return Math.min(a, b);
071: }
072:
073: public static long min__JJ(MJIEnv env, int clsObjRef, long a, long b) {
074: return Math.min(a, b);
075: }
076:
077: public static double pow__DD(MJIEnv env, int clsObjRef, double a,
078: double b) {
079: return Math.pow(a, b);
080: }
081:
082: public static double sqrt__D(MJIEnv env, int clsObjRef, double a) {
083: return Math.sqrt(a);
084: }
085:
086: public static double random__(MJIEnv env, int clsObjRef) {
087: return Math.random();
088: }
089:
090: public static double exp__D(MJIEnv env, int clsObjRef, double a) {
091: return Math.exp(a);
092: }
093:
094: public static double asin__D(MJIEnv env, int clsObjRef, double a) {
095: return Math.asin(a);
096: }
097:
098: public static double acos__D(MJIEnv env, int clsObjRef, double a) {
099: return Math.acos(a);
100: }
101:
102: public static double atan__D(MJIEnv env, int clsObjRef, double a) {
103: return Math.atan(a);
104: }
105:
106: public static double atan2__DD(MJIEnv env, int clsObjRef, double a,
107: double b) {
108: return Math.atan2(a, b);
109: }
110:
111: public static double ceil__D(MJIEnv env, int clsObjRef, double a) {
112: return Math.ceil(a);
113: }
114:
115: public static double cos__D(MJIEnv env, int clsObjRef, double a) {
116: return Math.cos(a);
117: }
118:
119: public static double floor__D(MJIEnv env, int clsObjRef, double a) {
120: return Math.floor(a);
121: }
122:
123: public static double log__D(MJIEnv env, int clsObjRef, double a) {
124: return Math.log(a);
125: }
126:
127: public static double rint__D(MJIEnv env, int clsObjRef, double a) {
128: return Math.rint(a);
129: }
130:
131: public static double sin__D(MJIEnv env, int clsObjRef, double a) {
132: return Math.sin(a);
133: }
134:
135: public static double tan__D(MJIEnv env, int clsObjRef, double a) {
136: return Math.tan(a);
137: }
138: }
|