Mercurial Hosting > luan
changeset 341:410e59ebad7d
add more Math functions
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 03 Apr 2015 06:17:11 -0600 |
parents | fb18724521d2 |
children | 93fa3dbe0c2f |
files | core/src/luan/modules/Math.luan core/src/luan/modules/MathLuan.java |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r fb18724521d2 -r 410e59ebad7d core/src/luan/modules/Math.luan --- a/core/src/luan/modules/Math.luan Tue Mar 31 02:35:40 2015 -0600 +++ b/core/src/luan/modules/Math.luan Fri Apr 03 06:17:11 2015 -0600 @@ -1,6 +1,7 @@ java() local MathLuan = require "java:luan.modules.MathLuan" local JavaMath = require "java:java.lang.Math" +local Integer = require "java:java.lang.Integer" abs = MathLuan.abs acos = MathLuan.acos @@ -15,7 +16,9 @@ floor = MathLuan.floor log = MathLuan.log min = MathLuan.min +min_integer = Integer.MIN_VALUE max = MathLuan.max +max_integer = Integer.MAX_VALUE modf = MathLuan.modf pi = JavaMath.PI pow = MathLuan.pow @@ -26,3 +29,4 @@ sqrt = MathLuan.sqrt tan = MathLuan.tan tanh = MathLuan.tanh +to_string = MathLuan.to_string
diff -r fb18724521d2 -r 410e59ebad7d core/src/luan/modules/MathLuan.java --- a/core/src/luan/modules/MathLuan.java Tue Mar 31 02:35:40 2015 -0600 +++ b/core/src/luan/modules/MathLuan.java Fri Apr 03 06:17:11 2015 -0600 @@ -115,4 +115,8 @@ return Math.tanh(x); } + public static String to_string(long i,Integer radix) { + return radix==null ? Long.toString(i) : Long.toString(i,radix); + } + }