Skip to content

Commit cd86390

Browse files
committed
new dtoa algorithm
1 parent 8541662 commit cd86390

File tree

2 files changed

+175
-151
lines changed

2 files changed

+175
-151
lines changed

src/dtoa/dtoa_dragonbox.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
/*
22
Code from https://github.com/jk-jeon/dragonbox
3+
4+
This is the dragonbox algorithm author's code.
5+
But the output is always in scientific notation.
36
*/
4-
#include <stdio.h>
57
#include "dragonbox/dragonbox_to_chars.h"
6-
78
extern "C" {
8-
9-
char *dtoa_dragonbox(double val, char *buf) {
9+
char *dtoa_dragonbox_jk(double val, char *buf) {
1010
return jkj::dragonbox::to_chars(val, buf); // null-terminate
1111
// return jkj::dragonbox::to_chars_n(val, buf); // no null-terminate
1212
}
13+
}
14+
15+
1316

17+
/*
18+
Code from https://github.com/abolz/Drachennest
19+
*/
20+
#include "dragonbox.h"
21+
extern "C" {
22+
char *dtoa_dragonbox(double val, char *buf) {
23+
buf = dragonbox::Dtoa(buf, val); // need 64 bytes
24+
*buf = '\0';
25+
return buf;
26+
}
1427
}

0 commit comments

Comments
 (0)