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:
parent
a8d4e4734f
commit
bd4b180f4e
1 changed files with 2 additions and 2 deletions
|
@ -1020,8 +1020,8 @@ public class JSONObject {
|
||||||
if (val instanceof BigInteger){
|
if (val instanceof BigInteger){
|
||||||
return new BigDecimal((BigInteger) val);
|
return new BigDecimal((BigInteger) val);
|
||||||
}
|
}
|
||||||
if (val instanceof Double){
|
if (val instanceof Double || val instanceof Float){
|
||||||
return new BigDecimal(((Double) val).doubleValue());
|
return new BigDecimal(((Number) val).doubleValue());
|
||||||
}
|
}
|
||||||
if (val instanceof Long || val instanceof Integer
|
if (val instanceof Long || val instanceof Integer
|
||||||
|| val instanceof Short || val instanceof Byte){
|
|| val instanceof Short || val instanceof Byte){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue