本文整理汇总了Java中org.mozilla.javascript.v8dtoa.FastDtoa类的典型用法代码示例。如果您正苦于以下问题:Java FastDtoa类的具体用法?Java FastDtoa怎么用?Java FastDtoa使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FastDtoa类属于org.mozilla.javascript.v8dtoa包,在下文中一共展示了FastDtoa类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: numberToString
import org.mozilla.javascript.v8dtoa.FastDtoa; //导入依赖的package包/类
public static String numberToString(double d, int base) {
if (d != d)
return "NaN";
if (d == Double.POSITIVE_INFINITY)
return "Infinity";
if (d == Double.NEGATIVE_INFINITY)
return "-Infinity";
if (d == 0.0)
return "0";
if ((base < 2) || (base > 36)) {
throw Context.reportRuntimeError1(
"msg.bad.radix", Integer.toString(base));
}
if (base != 10) {
return DToA.JS_dtobasestr(base, d);
} else {
// V8 FastDtoa can't convert all numbers, so try it first but
// fall back to old DToA in case it fails
String result = FastDtoa.numberToString(d);
if (result != null) {
return result;
}
StringBuilder buffer = new StringBuilder();
DToA.JS_dtostr(buffer, DToA.DTOSTR_STANDARD, 0, d);
return buffer.toString();
}
}
开发者ID:tiffit,项目名称:TaleCraft,代码行数:31,代码来源:ScriptRuntime.java
示例2: numberToString
import org.mozilla.javascript.v8dtoa.FastDtoa; //导入依赖的package包/类
public static String numberToString(double d, int base) {
if ((base < 2) || (base > 36)) {
throw Context.reportRuntimeError1(
"msg.bad.radix", Integer.toString(base));
}
if (d != d)
return "NaN";
if (d == Double.POSITIVE_INFINITY)
return "Infinity";
if (d == Double.NEGATIVE_INFINITY)
return "-Infinity";
if (d == 0.0)
return "0";
if (base != 10) {
return DToA.JS_dtobasestr(base, d);
} else {
// V8 FastDtoa can't convert all numbers, so try it first but
// fall back to old DToA in case it fails
String result = FastDtoa.numberToString(d);
if (result != null) {
return result;
}
StringBuilder buffer = new StringBuilder();
DToA.JS_dtostr(buffer, DToA.DTOSTR_STANDARD, 0, d);
return buffer.toString();
}
}
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:31,代码来源:ScriptRuntime.java
示例3: numberToString
import org.mozilla.javascript.v8dtoa.FastDtoa; //导入依赖的package包/类
public static String numberToString(double d, int base) {
if (Double.isNaN(d))
return "NaN";
if (d == Double.POSITIVE_INFINITY)
return "Infinity";
if (d == Double.NEGATIVE_INFINITY)
return "-Infinity";
if (d == 0.0)
return "0";
if ((base < 2) || (base > 36)) {
throw Context.reportRuntimeError1(
"msg.bad.radix", Integer.toString(base));
}
if (base != 10) {
return DToA.JS_dtobasestr(base, d);
} else {
// V8 FastDtoa can't convert all numbers, so try it first but
// fall back to old DToA in case it fails
String result = FastDtoa.numberToString(d);
if (result != null) {
return result;
}
StringBuilder buffer = new StringBuilder();
DToA.JS_dtostr(buffer, DToA.DTOSTR_STANDARD, 0, d);
return buffer.toString();
}
}
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:31,代码来源:ScriptRuntime.java
示例4: ToStringSlow
import org.mozilla.javascript.v8dtoa.FastDtoa; //导入依赖的package包/类
private static String ToStringSlow(double value) {
// call DToA for general number-to-string
String result = FastDtoa.numberToString(value);
if (result != null) {
return result;
}
StringBuilder buffer = new StringBuilder();
DToA.JS_dtostr(buffer, DToA.DTOSTR_STANDARD, 0, value);
return buffer.toString();
}
开发者ID:anba,项目名称:es6draft,代码行数:11,代码来源:AbstractOperations.java
注:本文中的org.mozilla.javascript.v8dtoa.FastDtoa类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论