*fixed a real number formatting bug with different locales.
This commit is contained in:
parent
c2937a89db
commit
1d25d54f54
17
HISTORY
17
HISTORY
@ -1,3 +1,6 @@
|
|||||||
|
Jul. 25 2018
|
||||||
|
Fixed a real number formatting bug with different locales
|
||||||
|
|
||||||
Jul. 14 2018
|
Jul. 14 2018
|
||||||
Fixed a multiple disposing bug with upvalues
|
Fixed a multiple disposing bug with upvalues
|
||||||
|
|
||||||
@ -310,7 +313,7 @@ Jul. 16 2016
|
|||||||
Added class format support with the STR statement
|
Added class format support with the STR statement
|
||||||
|
|
||||||
Jul. 14 2016
|
Jul. 14 2016
|
||||||
Fixed a boolean operation bug with the NOT statement on float number
|
Fixed a boolean operation bug with the NOT statement on real number
|
||||||
Improved boolean operation
|
Improved boolean operation
|
||||||
|
|
||||||
Jul. 13 2016
|
Jul. 13 2016
|
||||||
@ -374,7 +377,7 @@ Jun. 14 2016
|
|||||||
Fixed some bugs with meta method calling
|
Fixed some bugs with meta method calling
|
||||||
|
|
||||||
Jun. 7 2016
|
Jun. 7 2016
|
||||||
Simplified double precision float number redefinition
|
Simplified double precision real number redefinition
|
||||||
|
|
||||||
May. 24 2016
|
May. 24 2016
|
||||||
Refactored error raising of string manipulation
|
Refactored error raising of string manipulation
|
||||||
@ -892,7 +895,7 @@ Added recursive sub routine support
|
|||||||
Fixed a wrong argument detection bug in mb_has_arg
|
Fixed a wrong argument detection bug in mb_has_arg
|
||||||
|
|
||||||
Sep. 18 2015
|
Sep. 18 2015
|
||||||
Fixed a float number parsing bug, thanks to Cybermonkey342 for pointing it out
|
Fixed a real number parsing bug, thanks to Cybermonkey342 for pointing it out
|
||||||
Added directly expression evaluation shell command
|
Added directly expression evaluation shell command
|
||||||
|
|
||||||
Sep. 17 2015
|
Sep. 17 2015
|
||||||
@ -902,7 +905,7 @@ Fixed a repeated disposing bug when using sub routine
|
|||||||
|
|
||||||
Sep. 16 2015
|
Sep. 16 2015
|
||||||
Added Nil type handling, including assignment, boolean operation, serialization, etc.
|
Added Nil type handling, including assignment, boolean operation, serialization, etc.
|
||||||
Added an MB_CONVERT_TO_INT_LEVEL macro, would convert float to integer as much as possible if this macro was enabled
|
Added an MB_CONVERT_TO_INT_LEVEL macro, would convert real to integer as much as possible if this macro was enabled
|
||||||
|
|
||||||
Sep. 11 2015
|
Sep. 11 2015
|
||||||
Added a duplicate sub routine error handling
|
Added a duplicate sub routine error handling
|
||||||
@ -973,7 +976,7 @@ Apr. 15 2015
|
|||||||
Added mb_pop_usertype, mb_push_usertype to support user defined type
|
Added mb_pop_usertype, mb_push_usertype to support user defined type
|
||||||
|
|
||||||
Apr. 13 2015
|
Apr. 13 2015
|
||||||
Added mixed integer/float array support
|
Added mixed integer/real array support
|
||||||
Added warning prompt when passing strings to maths functions
|
Added warning prompt when passing strings to maths functions
|
||||||
Fixed a memory leak when storing strings in an array
|
Fixed a memory leak when storing strings in an array
|
||||||
Improved the interpreter commands
|
Improved the interpreter commands
|
||||||
@ -986,7 +989,7 @@ Disposed parsing context at runtime to reduce memory occupation
|
|||||||
|
|
||||||
Apr. 10 2015
|
Apr. 10 2015
|
||||||
Improved compatibility with PellesC
|
Improved compatibility with PellesC
|
||||||
Fixed a double precision float parsing bug on all 32bit systems, thanks to Pito for pointing it out
|
Fixed a double precision real parsing bug on all 32bit systems, thanks to Pito for pointing it out
|
||||||
Fixed an exponential number parsing bug, thanks to Pito for pointing it out
|
Fixed an exponential number parsing bug, thanks to Pito for pointing it out
|
||||||
Fixed a crash bug when a script begins with meaningless negtive number
|
Fixed a crash bug when a script begins with meaningless negtive number
|
||||||
|
|
||||||
@ -1089,7 +1092,7 @@ Fixed some memory leaks
|
|||||||
Jul. 3 2012
|
Jul. 3 2012
|
||||||
Modified/added math functions: FLOOR, CEIL, FIX
|
Modified/added math functions: FLOOR, CEIL, FIX
|
||||||
Fixed an INPUT type issue
|
Fixed an INPUT type issue
|
||||||
Changed float number formatting from using "%f" to "%g" in PRINT, thanks to Bruce Kendall for pointing above three issues out
|
Changed real number formatting from using "%f" to "%g" in PRINT, thanks to Bruce Kendall for pointing above three issues out
|
||||||
Refactored the way to load a script file
|
Refactored the way to load a script file
|
||||||
Done several small improvements
|
Done several small improvements
|
||||||
|
|
||||||
|
@ -1739,6 +1739,10 @@ static char* _extract_string(_object_t* obj);
|
|||||||
#ifdef MB_MANUAL_REAL_FORMATTING
|
#ifdef MB_MANUAL_REAL_FORMATTING
|
||||||
static void _real_to_str(real_t r, char* str, size_t size, size_t afterpoint);
|
static void _real_to_str(real_t r, char* str, size_t size, size_t afterpoint);
|
||||||
#endif /* MB_MANUAL_REAL_FORMATTING */
|
#endif /* MB_MANUAL_REAL_FORMATTING */
|
||||||
|
static void _real_to_str_std(real_t r, char* str, size_t size);
|
||||||
|
#ifndef mb_realtostr
|
||||||
|
# define mb_realtostr(__r, __s, __z) _real_to_str_std((__r), (__s), (__z))
|
||||||
|
#endif /* mb_realtostr */
|
||||||
|
|
||||||
#ifdef _HAS_REF_OBJ_LOCK
|
#ifdef _HAS_REF_OBJ_LOCK
|
||||||
static bool_t _lock_ref_object(_lock_t* lk, _ref_t* ref, void* obj);
|
static bool_t _lock_ref_object(_lock_t* lk, _ref_t* ref, void* obj);
|
||||||
@ -6204,6 +6208,20 @@ static void _real_to_str(real_t r, char* str, size_t size, size_t afterpoint) {
|
|||||||
}
|
}
|
||||||
#endif /* MB_MANUAL_REAL_FORMATTING */
|
#endif /* MB_MANUAL_REAL_FORMATTING */
|
||||||
|
|
||||||
|
/* Convert a real number to string the standard way */
|
||||||
|
static void _real_to_str_std(real_t r, char* str, size_t size) {
|
||||||
|
if((size_t)sprintf(str, MB_REAL_FMT, r) >= size) {
|
||||||
|
mb_assert(0 && "Buffer overflow.");
|
||||||
|
}
|
||||||
|
for(size_t i = 0; i < size; ++i) {
|
||||||
|
if(str[i] == ',') {
|
||||||
|
str[i] = '.';
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _HAS_REF_OBJ_LOCK
|
#ifdef _HAS_REF_OBJ_LOCK
|
||||||
/* Lock a referenced object */
|
/* Lock a referenced object */
|
||||||
static bool_t _lock_ref_object(_lock_t* lk, _ref_t* ref, void* obj) {
|
static bool_t _lock_ref_object(_lock_t* lk, _ref_t* ref, void* obj) {
|
||||||
@ -17668,9 +17686,7 @@ static int _std_str(mb_interpreter_t* s, void** l) {
|
|||||||
#ifdef MB_MANUAL_REAL_FORMATTING
|
#ifdef MB_MANUAL_REAL_FORMATTING
|
||||||
_real_to_str(arg.value.float_point, _CHAR_BUF_PTR(buf), lbuf, 5);
|
_real_to_str(arg.value.float_point, _CHAR_BUF_PTR(buf), lbuf, 5);
|
||||||
#else /* MB_MANUAL_REAL_FORMATTING */
|
#else /* MB_MANUAL_REAL_FORMATTING */
|
||||||
if((size_t)sprintf(_CHAR_BUF_PTR(buf), MB_REAL_FMT, arg.value.float_point) >= lbuf) {
|
mb_realtostr(arg.value.float_point, _CHAR_BUF_PTR(buf), lbuf);
|
||||||
mb_assert(0 && "Buffer overflow.");
|
|
||||||
}
|
|
||||||
#endif /* MB_MANUAL_REAL_FORMATTING */
|
#endif /* MB_MANUAL_REAL_FORMATTING */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user