mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-07 17:32:45 -04:00
Actually enable floating-point arithmetics in printf
This commit is contained in:
parent
c05c95d8a1
commit
082d3f5ffa
4 changed files with 11 additions and 0 deletions
|
@ -3,3 +3,4 @@
|
|||
* libkernaux 0.1.0 released
|
||||
* include/kernaux/assert.h: Added unconditional assertion (panic)
|
||||
* include/kernaux/assert.h: Added guards for unconditional assertion (panic)
|
||||
* src/printf.c: Fix bug and actually enable floating-point arithmetics
|
||||
|
|
|
@ -163,6 +163,7 @@ VALUE rb_KernAux_snprintf1(
|
|||
c == 'e' || c == 'E' ||
|
||||
c == 'g' || c == 'G')
|
||||
{
|
||||
// FIXME: this doesn't work
|
||||
RB_FLOAT_TYPE_P(arg_rb);
|
||||
arg.dbl = NUM2DBL(arg_rb);
|
||||
} else if (c == 'c') {
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
* Author: Marco Paland (info@paland.com) PALANDesign Hannover, Germany
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/libc.h>
|
||||
#include <kernaux/printf.h>
|
||||
|
||||
|
|
|
@ -96,5 +96,10 @@ int main()
|
|||
test("foo123a%", "%s%u%c%%", "foo", 123, 'a');
|
||||
test("fooa123%", "%s%c%u%%", "foo", 'a', 123);
|
||||
|
||||
#ifdef ENABLE_FLOAT
|
||||
test("1.200000", "%f", 1.2);
|
||||
test("123.456789", "%f", 123.456789);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue