mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Scrub double-conversion and add quick wrapper
This commit is contained in:
parent
b1de862e16
commit
5cd0e876bd
46 changed files with 322 additions and 804 deletions
|
@ -16,11 +16,14 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/fenv.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/double-conversion/wrapper.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
|
||||
#define HEX(d) (union Pun){d}.i
|
||||
|
@ -401,3 +404,14 @@ TEST(strtod, testTowardzero) {
|
|||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
BENCH(strtod, bench) {
|
||||
char buf[128];
|
||||
EZBENCH2("strtod", donothing, strtod("-1.79769313486231e+308", 0));
|
||||
EZBENCH2("StringToDouble", donothing,
|
||||
StringToDouble("-1.79769313486231e+308", 22, 0));
|
||||
EZBENCH2("snprintf %g", donothing,
|
||||
snprintf(buf, 128, "%g", -1.79769313486231e+308));
|
||||
EZBENCH2("DoubleToEcmascript", donothing,
|
||||
DoubleToEcmascript(buf, -1.79769313486231e+308));
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ TEST_LIBC_TINYMATH_DIRECTDEPS = \
|
|||
LIBC_TINYMATH \
|
||||
LIBC_UNICODE \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_GDTOA
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_DOUBLECONVERSION
|
||||
|
||||
TEST_LIBC_TINYMATH_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue