Skip to content

Commit 9eaa510

Browse files
committed
having fun
1 parent a50e26a commit 9eaa510

File tree

4 files changed

+712
-5
lines changed

4 files changed

+712
-5
lines changed

benchmarks/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
include_directories(../include)
13
add_executable(benchmark
24
benchmark.cpp
35
)

benchmarks/algorithms.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#define YY_DOUBLE_SUPPORTED 0
4545
#endif
4646

47+
#include "champagne_lemire/champagne_lemire.h"
48+
4749
template<arithmetic_float T>
4850
struct BenchArgs {
4951
using Type = T;
@@ -333,15 +335,17 @@ int ryu(T d, std::span<char>& buffer) {
333335

334336
template<arithmetic_float T>
335337
int teju_jagua(T d, std::span<char>& buffer) {
336-
if(d == 0.0) {
337-
std::copy_n("0E0", 3, buffer.data());
338-
return 3;
338+
char * output = buffer.data();
339+
output[0] = '-';
340+
if(std::signbit(d)) {
341+
output++;
342+
// d = -d; // unnecessary, teju handles sign?
339343
}
340344
const auto fields = teju::traits_t<T>::teju(d);
341-
const bool sign = std::signbit(d);
342-
return to_chars(fields.mantissa, fields.exponent, sign, buffer.data());
345+
return champagne_lemire::to_chars(fields.mantissa, fields.exponent, output);
343346
}
344347

348+
345349
template<arithmetic_float T>
346350
int double_conversion(T d, std::span<char>& buffer) {
347351
using namespace double_conversion;

benchmarks/benchmark.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* data generated.
88
*/
99

10+
#include "champagne_lemire/champagne_lemire.h"
1011
#include "algorithms.h"
1112
#define IEEE_8087
1213
#include "benchutil.h"

0 commit comments

Comments
 (0)