Update `MRB_FLO_TO_STR_FMT` to "%.16g"; fix #4016

parent 2a38eb93
......@@ -3049,8 +3049,8 @@ loop_pop(codegen_scope *s, int val)
if (val) push();
}
MRB_API struct RProc*
mrb_generate_code(mrb_state *mrb, parser_state *p)
static struct RProc*
generate_code(mrb_state *mrb, parser_state *p, int val)
{
codegen_scope *scope = scope_new(mrb, 0, 0);
struct RProc *proc;
......@@ -3067,7 +3067,7 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
MRB_TRY(&scope->jmp) {
mrb->jmp = &scope->jmp;
/* prepare irep */
codegen(scope, p->tree, NOVAL);
codegen(scope, p->tree, val);
proc = mrb_proc_new(mrb, scope->irep);
mrb_irep_decref(mrb, scope->irep);
mrb_pool_close(scope->mpool);
......@@ -3086,3 +3086,9 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
}
MRB_END_EXC(&scope->jmp);
}
MRB_API struct RProc*
mrb_generate_code(mrb_state *mrb, parser_state *p)
{
return generate_code(mrb, p, VAL);
}
......@@ -23,9 +23,9 @@
#define floor(f) floorf(f)
#define ceil(f) ceilf(f)
#define fmod(x,y) fmodf(x,y)
#define MRB_FLO_TO_STR_FMT "%.7g"
#define MRB_FLO_TO_STR_FMT "%.8g"
#else
#define MRB_FLO_TO_STR_FMT "%.14g"
#define MRB_FLO_TO_STR_FMT "%.16g"
#endif
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment