Skip to content

Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles.

License

BSD-3-Clause, BSD-3-Clause licenses found

Licenses found

BSD-3-Clause
LICENSE
BSD-3-Clause
COPYING
Notifications You must be signed in to change notification settings

google/double-conversion

Folders and files

NameName
Last commit message
Last commit date
Feb 24, 2025
Sep 7, 2017
Mar 1, 2025
Jul 11, 2023
Feb 14, 2025
Feb 14, 2021
Aug 1, 2019
Nov 13, 2024
Feb 20, 2025
Feb 5, 2012
May 18, 2023
Feb 5, 2012
Nov 13, 2024
Dec 4, 2021
Oct 31, 2024
May 18, 2023
Dec 16, 2015

Double Conversion

https://github.com/google/double-conversion

OpenSSF Scorecard

This project (double-conversion) provides binary-decimal and decimal-binary routines for IEEE doubles.

The library consists of efficient conversion routines that have been extracted from the V8 JavaScript engine. The code has been refactored and improved so that it can be used more easily in other projects.

There is extensive documentation in double-conversion/string-to-double.h and double-conversion/double-to-string.h. Other examples can be found in test/cctest/test-conversions.cc.

Building

This library can be built with scons, cmake or bazel. The checked-in Makefile simply forwards to scons, and provides a shortcut to run all tests:

make
make test

Scons

The easiest way to install this library is to use scons. It builds the static and shared library, and is set up to install those at the correct locations:

scons install

Use the DESTDIR option to change the target directory:

scons DESTDIR=alternative_directory install

Cmake

To use cmake run cmake . in the root directory. This overwrites the existing Makefile.

Use -DBUILD_SHARED_LIBS=ON to enable the compilation of shared libraries. Note that this disables static libraries. There is currently no way to build both libraries at the same time with cmake.

Use -DBUILD_TESTING=ON to build the test executable.

cmake . -DBUILD_TESTING=ON
make
test/cctest/cctest

Bazel

The simplest way to adopt this library is through the Bazel Central Registry.

To build the library from the latest repository, run:

bazel build //:double-conversion

To run the unit test, run:

bazel test //:cctest