1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Support for float to BigDecimal in optBigDecimal

This commit is contained in:
John J. Aylward 2017-05-17 10:51:06 -04:00
parent a8d4e4734f
commit bd4b180f4e

View file

@ -1020,8 +1020,8 @@ public class JSONObject {
if (val instanceof BigInteger){
return new BigDecimal((BigInteger) val);
}
if (val instanceof Double){
return new BigDecimal(((Double) val).doubleValue());
if (val instanceof Double || val instanceof Float){
return new BigDecimal(((Number) val).doubleValue());
}
if (val instanceof Long || val instanceof Integer
|| val instanceof Short || val instanceof Byte){