summaryrefslogtreecommitdiffhomepage
path: root/src/fmt_fp.c
AgeCommit message (Collapse)Author
2020-06-05Add proper cast.Yukihiro "Matz" Matsumoto
2020-06-05Add proper casts to silence VC warnings.Yukihiro "Matz" Matsumoto
2020-04-11Add `mrb_float_to_cstr()` MRB_API functiondearblue
In order to share the same operation with `mrb_float_to_str()`, the internal structure is modified.
2020-04-11Supports some specifier flags with `mrb_float_to_str()`dearblue
Changed to understand `#`, `0`, `-`, ` ` and `+`. Based on src/stdio/vfprintf.c in git://git.musl-libc.org/musl
2020-04-11Supports width specifier with `mrb_float_to_str()`dearblue
Based on src/stdio/vfprintf.c in git://git.musl-libc.org/musl
2020-04-11Add missing `MRB_API`dearblue
2020-01-01Do not include `stdint.h` before `mruby.h`; ref #4750dearblue
2019-04-03Modify `#else` and `#endif` annotations in `src/fmt_fp.c` [ci skip]KOBAYASHI Shuji
2019-03-15Use `fmt_fp()` for portable float representation.Yukihiro "Matz" Matsumoto
2018-11-07Wrong pool data length for negative floating value in a mrb file.Hiroshi Mimaki
2018-08-01Simply use `snprintf` instead of custom `fmt_fp`,Yukihiro "Matz" Matsumoto
Unless `MRB_DISABLE_STDIO` is set. `snprintf` is used anyway if mruby is configured to use `stdio`. This change reduces 8KB of program size on the Linux box.
2017-11-04Avoid compiling `fmt_fp.c` if `MRB_WITHOUT_FLOAT` is set; #3827Yukihiro "Matz" Matsumoto
2017-08-25fix fmt_fp.c(329) : warning C4244: 'return' : conversion from 'ptrdiff_t' to ↵Tomasz Dąbrowski
'int', possible loss of data
2017-08-25fix fmt_fp.c(251) : warning C4244: '=' : conversion from '__int64' to 'int', ↵Tomasz Dąbrowski
possible loss of data
2017-08-25fix fmt_fp.c(224) : warning C4244: '=' : conversion from 'ptrdiff_t' to ↵Tomasz Dąbrowski
'int', possible loss of data
2017-08-25fix fmt_fp.c(220) : warning C4244: '=' : conversion from '__int64' to 'int', ↵Tomasz Dąbrowski
possible loss of data
2017-08-25fix fmt_fp.c(206) : warning C4244: 'initializing' : conversion from ↵Tomasz Dąbrowski
'ptrdiff_t' to 'int', possible loss of data
2017-08-25fix fmt_fp.c(178) : warning C4244: 'return' : conversion from 'ptrdiff_t' to ↵Tomasz Dąbrowski
'int', possible loss of data
2017-08-25fix fmt_fp.c(123) : warning C4244: 'return' : conversion from 'ptrdiff_t' to ↵Tomasz Dąbrowski
'int', possible loss of data
2017-08-19Reduce signed/unsigned warnings in dump.cYukihiro "Matz" Matsumoto
2017-08-19Reduce signed/unsigned warnings in fmt_fp.cYukihiro "Matz" Matsumoto
2017-08-19Use `ptrdiff_t` instead of `int`.Yukihiro "Matz" Matsumoto
2017-08-18Separate `mrb_str_buf_new` and `mrb_str_new_capa`.Yukihiro "Matz" Matsumoto
`mrb_str_buf_new` is an old function that ensures capacity size of `MRB_STR_BUF_MIN_SIZE` minimum. Usually one need to use `mrb_str_new_capa` instead.
2017-08-12Reduce integer type mismatch warnings in VC.Yukihiro "Matz" Matsumoto
2016-09-28Removed trailing spacesNobuyoshi Nakada
2015-12-22fix build on VS2012Yasuhiro Matsumoto
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-07-29always call frexp() instead of frexpl()cremno
No values that can only be represented as long double are passed since mrb_float is either float or double.
2015-07-1664bit Cygwin also doesn't have frexpl(3)takkaw
2015-07-06fix androideabi cross-compile error : undefined reference to 'frexpl'xuejianqing
2015-06-06Fix build on MIPS of linuxNobuhiro Iwamatsu
MIPS of Linux platform is supported frexpl(3). This fixes to use the frexpl that are provided with gcc if user wants to build on MIPS of Linux platform. Signe-doff-by: Nobuhiro Iwamatsu <[email protected]>
2015-05-20NetBSD (6.1.5) does not have frexpl(3).Tomoyuki Sahara
2015-05-07Defining static version of frexpl also fro MIPS platforms.Paolo Bosetti
On MIPS/linaro, libm.so lacks frexpl() as CygWin does.
2015-04-18Suppress warnings generated by -Wwrite-stringsKouhei Sutou
Here are suppressed warnings: src/fmt_fp.c: In function 'fmt_fp': src/fmt_fp.c:124:16: warning: initialization discards 'const' qualifier from pointer target type char *ss = (t&32)?"inf":"INF"; ^ src/fmt_fp.c:125:17: warning: assignment discards 'const' qualifier from pointer target type if (y!=y) ss=(t&32)?"nan":"NAN"; ^ mrbgems/mruby-string-ext/src/string.c: In function 'mrb_str_succ_bang': mrbgems/mruby-string-ext/src/string.c:302:27: warning: assignment discards 'const' qualifier from pointer target type if (e == b) prepend = "1"; ^ mrbgems/mruby-string-ext/src/string.c:305:27: warning: assignment discards 'const' qualifier from pointer target type if (e == b) prepend = "a"; ^ mrbgems/mruby-string-ext/src/string.c:308:27: warning: assignment discards 'const' qualifier from pointer target type if (e == b) prepend = "A"; ^ mrbgems/mruby-bin-mruby/tools/mruby/mruby.c: In function 'main': mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:213:13: warning: assignment discards 'const' qualifier from pointer target type cmdline = args.cmdline ? args.cmdline : "-"; ^ mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c: In function 'print_breakpoint': mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c:159:3: warning: initialization discards 'const' qualifier from pointer target type char* enable_letter[] = {BREAK_INFO_MSG_DISABLE, BREAK_INFO_MSG_ENABLE}; ^ mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c:159:3: warning: initialization discards 'const' qualifier from pointer target type
2015-03-16I have added the #ifdef __CYGWIN32__ to modify the fmt_fp.cTarosa
2015-03-16I modified the undefined frexpl in cygwin of makeTarosa
2015-02-27fix MSVC initialization issue by a patch from @dyama; close #2734Yukihiro "Matz" Matsumoto
2015-02-16silence warnings in fmt_fp.cYukihiro "Matz" Matsumoto
2015-02-13re-implement mrb_float_to_str()cremno
The new implementation is backwards incompatible, but I couldn't find any usage outside mruby and I also couldn't think of a different and good name. All ISO C99 printf conversion specifiers for floating point numbers and an optional precision are supported. It is largely based on code from the MIT licensed musl libc (http://www.musl-libc.org/) and its floating point printing is exact (unlike the current code behind Float#to_s).