org.luaj.vm2.lib.MathLib Java Examples
The following examples show how to use
org.luaj.vm2.lib.MathLib.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmePlatform.java From luaj with MIT License | 6 votes |
/** * Create a standard set of globals for JME including all the libraries. * * @return Table of globals initialized with the standard JME libraries * @see #debugGlobals() * @see org.luaj.vm2.lib.jse.JsePlatform * @see org.luaj.vm2.lib.jme.JmePlatform */ public static Globals standardGlobals() { Globals globals = new Globals(); globals.load(new BaseLib()); globals.load(new PackageLib()); globals.load(new Bit32Lib()); globals.load(new OsLib()); globals.load(new MathLib()); globals.load(new TableLib()); globals.load(new StringLib()); globals.load(new CoroutineLib()); globals.load(new JmeIoLib()); LoadState.install(globals); LuaC.install(globals); return globals; }
Example #2
Source File: LuaString.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue pow(int rhs) { return MathLib.dpow(checkarith(), rhs); }
Example #3
Source File: LexState.java From luaj with MIT License | 4 votes |
LuaValue strx2number(String str, SemInfo seminfo) { char[] c = str.toCharArray(); int s = 0; while ( s < c.length && isspace(c[s])) ++s; // Check for negative sign double sgn = 1.0; if (s < c.length && c[s] == '-') { sgn = -1.0; ++s; } /* Check for "0x" */ if (s + 2 >= c.length ) return LuaValue.ZERO; if (c[s++] != '0') return LuaValue.ZERO; if (c[s] != 'x' && c[s] != 'X') return LuaValue.ZERO; ++s; // read integer part. double m = 0; int e = 0; while (s < c.length && isxdigit(c[s])) m = (m * 16) + hexvalue(c[s++]); if (s < c.length && c[s] == '.') { ++s; // skip dot while (s < c.length && isxdigit(c[s])) { m = (m * 16) + hexvalue(c[s++]); e -= 4; // Each fractional part shifts right by 2^4 } } if (s < c.length && (c[s] == 'p' || c[s] == 'P')) { ++s; int exp1 = 0; boolean neg1 = false; if (s < c.length && c[s] == '-') { neg1 = true; ++s; } while (s < c.length && isdigit(c[s])) exp1 = exp1 * 10 + c[s++] - '0'; if (neg1) exp1 = -exp1; e += exp1; } return LuaValue.valueOf(sgn * m * MathLib.dpow_d(2.0, e)); }
Example #4
Source File: LexState.java From HtmlNative with Apache License 2.0 | 4 votes |
LuaValue strx2number(String str, SemInfo seminfo) { char[] c = str.toCharArray(); int s = 0; while ( s < c.length && isspace(c[s])) ++s; // Check for negative sign double sgn = 1.0; if (s < c.length && c[s] == '-') { sgn = -1.0; ++s; } /* Check for "0x" */ if (s + 2 >= c.length ) return LuaValue.ZERO; if (c[s++] != '0') return LuaValue.ZERO; if (c[s] != 'x' && c[s] != 'X') return LuaValue.ZERO; ++s; // read integer part. double m = 0; int e = 0; while (s < c.length && isxdigit(c[s])) m = (m * 16) + hexvalue(c[s++]); if (s < c.length && c[s] == '.') { ++s; // skip dot while (s < c.length && isxdigit(c[s])) { m = (m * 16) + hexvalue(c[s++]); e -= 4; // Each fractional part shifts right by 2^4 } } if (s < c.length && (c[s] == 'p' || c[s] == 'P')) { ++s; int exp1 = 0; boolean neg1 = false; if (s < c.length && c[s] == '-') { neg1 = true; ++s; } while (s < c.length && isdigit(c[s])) exp1 = exp1 * 10 + c[s++] - '0'; if (neg1) exp1 = -exp1; e += exp1; } return LuaValue.valueOf(sgn * m * MathLib.dpow_d(2.0, e)); }
Example #5
Source File: LexState.java From XPrivacyLua with GNU General Public License v3.0 | 4 votes |
LuaValue strx2number(String str, SemInfo seminfo) { char[] c = str.toCharArray(); int s = 0; while ( s < c.length && isspace(c[s])) ++s; // Check for negative sign double sgn = 1.0; if (s < c.length && c[s] == '-') { sgn = -1.0; ++s; } /* Check for "0x" */ if (s + 2 >= c.length ) return LuaValue.ZERO; if (c[s++] != '0') return LuaValue.ZERO; if (c[s] != 'x' && c[s] != 'X') return LuaValue.ZERO; ++s; // read integer part. double m = 0; int e = 0; while (s < c.length && isxdigit(c[s])) m = (m * 16) + hexvalue(c[s++]); if (s < c.length && c[s] == '.') { ++s; // skip dot while (s < c.length && isxdigit(c[s])) { m = (m * 16) + hexvalue(c[s++]); e -= 4; // Each fractional part shifts right by 2^4 } } if (s < c.length && (c[s] == 'p' || c[s] == 'P')) { ++s; int exp1 = 0; boolean neg1 = false; if (s < c.length && c[s] == '-') { neg1 = true; ++s; } while (s < c.length && isdigit(c[s])) exp1 = exp1 * 10 + c[s++] - '0'; if (neg1) exp1 = -exp1; e += exp1; } return LuaValue.valueOf(sgn * m * MathLib.dpow_d(2.0, e)); }
Example #6
Source File: LexState.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
LuaValue strx2number(String str, SemInfo seminfo) { char[] c = str.toCharArray(); int s = 0; while (s < c.length && isspace(c[s])) ++s; // Check for negative sign double sgn = 1.0; if (s < c.length && c[s] == '-') { sgn = -1.0; ++s; } /* Check for "0x" */ if (s + 2 >= c.length) return LuaValue.ZERO; if (c[s++] != '0') return LuaValue.ZERO; if (c[s] != 'x' && c[s] != 'X') return LuaValue.ZERO; ++s; // read integer part. double m = 0; int e = 0; while (s < c.length && isxdigit(c[s])) m = (m * 16) + hexvalue(c[s++]); if (s < c.length && c[s] == '.') { ++s; // skip dot while (s < c.length && isxdigit(c[s])) { m = (m * 16) + hexvalue(c[s++]); e -= 4; // Each fractional part shifts right by 2^4 } } if (s < c.length && (c[s] == 'p' || c[s] == 'P')) { ++s; int exp1 = 0; boolean neg1 = false; if (s < c.length && c[s] == '-') { neg1 = true; ++s; } while (s < c.length && isdigit(c[s])) exp1 = exp1 * 10 + c[s++] - '0'; if (neg1) exp1 = -exp1; e += exp1; } return LuaValue.valueOf(sgn * m * MathLib.dpow_d(2.0, e)); }
Example #7
Source File: LuaDouble.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue powWith(int lhs) { return MathLib.dpow(lhs, v); }
Example #8
Source File: LuaString.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue pow(double rhs) { return MathLib.dpow(checkarith(), rhs); }
Example #9
Source File: LuaDouble.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue powWith(double lhs) { return MathLib.dpow(lhs, v); }
Example #10
Source File: LuaDouble.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue pow(int rhs) { return MathLib.dpow(v, rhs); }
Example #11
Source File: LuaDouble.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue pow(double rhs) { return MathLib.dpow(v, rhs); }
Example #12
Source File: LuaString.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue powWith(int lhs) { return MathLib.dpow(lhs, checkarith()); }
Example #13
Source File: LuaString.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue powWith(double lhs) { return MathLib.dpow(lhs, checkarith()); }
Example #14
Source File: LuaDouble.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue powWith( double lhs ) { return MathLib.dpow(lhs,v); }
Example #15
Source File: LuaDouble.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue pow( double rhs ) { return MathLib.dpow(v,rhs); }
Example #16
Source File: LuaDouble.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue powWith( int lhs ) { return MathLib.dpow(lhs,v); }
Example #17
Source File: LuaInteger.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue pow( double rhs ) { return MathLib.dpow(v,rhs); }
Example #18
Source File: LuaInteger.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue pow( int rhs ) { return MathLib.dpow(v,rhs); }
Example #19
Source File: LuaInteger.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue powWith( double lhs ) { return MathLib.dpow(lhs,v); }
Example #20
Source File: LuaInteger.java From HtmlNative with Apache License 2.0 | votes |
public LuaValue powWith( int lhs ) { return MathLib.dpow(lhs,v); }
Example #21
Source File: LuaString.java From luaj with MIT License | votes |
public LuaValue pow( double rhs ) { return MathLib.dpow(checkarith(),rhs); }
Example #22
Source File: LuaString.java From luaj with MIT License | votes |
public LuaValue pow( int rhs ) { return MathLib.dpow(checkarith(),rhs); }
Example #23
Source File: LuaString.java From luaj with MIT License | votes |
public LuaValue powWith( double lhs ) { return MathLib.dpow(lhs, checkarith()); }
Example #24
Source File: LuaString.java From luaj with MIT License | votes |
public LuaValue powWith( int lhs ) { return MathLib.dpow(lhs, checkarith()); }
Example #25
Source File: LuaDouble.java From luaj with MIT License | votes |
public LuaValue pow( double rhs ) { return MathLib.dpow(v,rhs); }
Example #26
Source File: LuaDouble.java From luaj with MIT License | votes |
public LuaValue pow( int rhs ) { return MathLib.dpow(v,rhs); }
Example #27
Source File: LuaDouble.java From luaj with MIT License | votes |
public LuaValue powWith( double lhs ) { return MathLib.dpow(lhs,v); }
Example #28
Source File: LuaDouble.java From luaj with MIT License | votes |
public LuaValue powWith( int lhs ) { return MathLib.dpow(lhs,v); }
Example #29
Source File: LuaInteger.java From luaj with MIT License | votes |
public LuaValue pow( double rhs ) { return MathLib.dpow(v,rhs); }
Example #30
Source File: LuaInteger.java From luaj with MIT License | votes |
public LuaValue pow( int rhs ) { return MathLib.dpow(v,rhs); }