*fixed a mod by zero bug with real number.
This commit is contained in:
parent
c394f5ac19
commit
c41de6cd70
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
|||||||
|
Nov. 10 2018
|
||||||
|
Fixed a mod by zero bug with real number
|
||||||
|
|
||||||
Nov. 5 2018
|
Nov. 5 2018
|
||||||
Fixed a crash bug when using an iterator in a conditional expression
|
Fixed a crash bug when using an iterator in a conditional expression
|
||||||
Fixed a memory leak with wrong iterator usage
|
Fixed a memory leak with wrong iterator usage
|
||||||
|
@ -1142,11 +1142,11 @@ static _object_t* _exp_assign = 0;
|
|||||||
#ifndef _instruct_obj_meta_obj
|
#ifndef _instruct_obj_meta_obj
|
||||||
# define _instruct_obj_meta_obj(__s, __tuple, __optr, __result, __exit) do { ((void)(__s)); ((void)(__tuple)); ((void)(__result)); } while(0)
|
# define _instruct_obj_meta_obj(__s, __tuple, __optr, __result, __exit) do { ((void)(__s)); ((void)(__tuple)); ((void)(__result)); } while(0)
|
||||||
#endif /* _instruct_obj_meta_obj */
|
#endif /* _instruct_obj_meta_obj */
|
||||||
#define _proc_div_by_zero(__s, __tuple, __exit, __result, __kind) \
|
#define _proc_div_by_zero(__s, __tuple, __cast, __exit, __result, __kind) \
|
||||||
do { \
|
do { \
|
||||||
_instruct_common(__tuple) \
|
_instruct_common(__tuple) \
|
||||||
if((opndv2.type == _DT_INT && opndv2.data.integer == 0) || (opndv2.type == _DT_REAL && opndv2.data.float_point == 0.0f)) { \
|
if((opndv2.type == _DT_INT && opndv2.data.integer == 0) || (opndv2.type == _DT_REAL && (__cast)opndv2.data.float_point == 0)) { \
|
||||||
if((opndv1.type == _DT_INT && opndv1.data.integer == 0) || (opndv1.type == _DT_REAL && opndv1.data.float_point == 0.0f)) { \
|
if((opndv1.type == _DT_INT && opndv1.data.integer == 0) || (opndv1.type == _DT_REAL && opndv1.data.float_point == 0)) { \
|
||||||
val->type = _DT_REAL; \
|
val->type = _DT_REAL; \
|
||||||
_set_real_with_hex(val->data.float_point, MB_FNAN); \
|
_set_real_with_hex(val->data.float_point, MB_FNAN); \
|
||||||
} else { \
|
} else { \
|
||||||
@ -14879,7 +14879,7 @@ static int _core_div(mb_interpreter_t* s, void** l) {
|
|||||||
|
|
||||||
_ONCALC(s, l, div, result, _exit);
|
_ONCALC(s, l, div, result, _exit);
|
||||||
_instruct_obj_meta_obj(s, l, div, result, _exit);
|
_instruct_obj_meta_obj(s, l, div, result, _exit);
|
||||||
_proc_div_by_zero(s, l, _exit, result, SE_RN_DIVIDE_BY_ZERO);
|
_proc_div_by_zero(s, l, real_t, _exit, result, SE_RN_DIVIDE_BY_ZERO);
|
||||||
_instruct_num_op_num(/, l);
|
_instruct_num_op_num(/, l);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
@ -14892,7 +14892,7 @@ static int _core_mod(mb_interpreter_t* s, void** l) {
|
|||||||
|
|
||||||
mb_assert(s && l);
|
mb_assert(s && l);
|
||||||
|
|
||||||
_proc_div_by_zero(s, l, _exit, result, SE_RN_DIVIDE_BY_ZERO);
|
_proc_div_by_zero(s, l, int_t, _exit, result, SE_RN_DIVIDE_BY_ZERO);
|
||||||
_instruct_int_op_int(%, l);
|
_instruct_int_op_int(%, l);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user