mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Increase String::num default decimal precision
Fixes #34541 Renamed MAX_DIGITS to MAX_DECIMALS, since it only changes the amount of digits after the decimal point. Increased MAX_DECIMALS to 32, and made String::num use MAX_DECIMALS consistently. If -1 is passed as decimal precision to String::num, it now gets changed to the correct precision based on the number's magnitude, instead of using printf default(which is 6) String::num_real also calculates the correct precision now. Also made the types used in floating-point math more consistent in a few places.
This commit is contained in:
committed by
Aaron Franke
parent
b63f9b5961
commit
09a905ca80
@@ -2415,12 +2415,12 @@ Variant JSONParseResult::get_result() const {
|
||||
}
|
||||
|
||||
void _JSON::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys"), &_JSON::print, DEFVAL(String()), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("print", "value", "indent", "sort_keys", "full_precision"), &_JSON::print, DEFVAL(String()), DEFVAL(false), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("parse", "json"), &_JSON::parse);
|
||||
}
|
||||
|
||||
String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys) {
|
||||
return JSON::print(p_value, p_indent, p_sort_keys);
|
||||
String _JSON::print(const Variant &p_value, const String &p_indent, bool p_sort_keys, bool p_full_precision) {
|
||||
return JSON::print(p_value, p_indent, p_sort_keys, p_full_precision);
|
||||
}
|
||||
|
||||
Ref<JSONParseResult> _JSON::parse(const String &p_json) {
|
||||
|
||||
Reference in New Issue
Block a user