Skip to content

Commit 932b972

Browse files
committed
teju now pass the exhaustivefloat32 test
By default, it only supports strictly positive floats (cassioneri/teju_jagua#5 (comment)) so we have to manually treat 0 separately
1 parent fa752df commit 932b972

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

benchmarks/algorithms.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ int ryu(T d, std::span<char>& buffer) {
217217

218218
template<arithmetic_float T>
219219
int teju_jagua(T d, std::span<char>& buffer) {
220+
if(d == 0.0) {
221+
std::copy_n("0E0", 3, buffer.data());
222+
return 3;
223+
}
220224
const auto fields = teju::traits_t<T>::teju(d);
221225
const bool sign = std::signbit(d);
222226
return to_chars(fields.mantissa, fields.exponent, sign, buffer.data());

0 commit comments

Comments
 (0)