Skip to content

Commit

Permalink
Showing 2 changed files with 13 additions and 7 deletions.
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/string/modulo_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -3460,7 +3460,8 @@ public static abstract class StringToFPrimitiveNode extends PrimitiveArrayArgume

@TruffleBoundary(throwsControlFlowException = true)
@Specialization
public Object stringToF(DynamicObject string, boolean strict) {
public Object stringToF(DynamicObject string, boolean strict,
@Cached("create(getContext(), getSourceSection())") FixnumOrBignumNode fixnumOrBignumNode) {
final Rope rope = rope(string);
final ByteList byteList = RopeOperations.getByteListReadOnly(rope);
if (byteList.getRealSize() == 0) {
@@ -3470,7 +3471,17 @@ public Object stringToF(DynamicObject string, boolean strict) {
try {
return Double.parseDouble(string.toString());
} catch (NumberFormatException e) {
return null;
// Try falling back to this implementation if the first fails, niether 100% complete
final Object result = ConvertBytes.byteListToInum19(getContext(), this, fixnumOrBignumNode, string, 16, true);
if (result instanceof Integer) {
return ((Integer) result).doubleValue();
} else if (result instanceof Long) {
return ((Long) result).doubleValue();
} else if (result instanceof Double) {
return result;
} else {
return null;
}
}
}
try {

0 comments on commit 415acd5

Please sign in to comment.