lexical-core
Lexical, to- and from-string conversion routines.
1.0.6
143M downloads/mo
#634 most downloaded on crates.io
Alexhuszagh/rust-lexical
What this package is like to depend on
Last release 11 months ago
21 Sep 2025
Ships unpredictably
gaps range from 1 weeks to 2.3 years
Most releases are documented
notes for 24 of 40 stable releases
3 versions withdrawn
withdrawn after publishing
8 years old
43 releases · first in 2018
1 release in the last 12 months
see the full history below
Release timeline
43 releases · Dec 2018 to Sep 2025Releases
latest 43-
1.0.621 Sep 2025 -
1.0.508 Dec 2024 -
1.0.306 Dec 2024Release notes
Open source →Changed
- Improved performance of number formatting with non-decimal radices (#169).
Fixed
- Inaccurate number formatting with non-decimal radices (#169).
Release notes
Open source →Changed
- Improved performance of number formatting with non-decimal radices (#169).
Fixed
- Inaccurate number formatting with non-decimal radices (#169).
-
1.0.225 Sep 2024Release notes
Open source →Changed
- Higher performance when parsing floats with digit separators.
Fixed
- Inlining inconsistency between public API methods (credit to @zheland)
- Incorrectly accepting leading zeros when
no_integer_leading_zeroswas enabled. - Have consistent errors when an invalid leading digit is found for floating point numbers to always be
Error::InvalidDigit. - Incorrect parsing of consecutive digit separators.
- Inaccuracies when parsing digit separators at various positions leading to incorect errors being returned.
- Selecting only a subset of parse and/or write features would cause compilation errors.
- Fixed bug with writing integers with custom radices.
-
1.0.115 Sep 2024Release notes
Open source →Fixed
- A correctness regression.
- Regressions where parsing digit separators without the
compactpanicked.
-
1.0.014 Sep 2024Release notes
Open source →Added
- Added fuzzing and miri code safety analysis to our CI pipelines.
- Removed requirement of
allocinno_stdennvironments without thewritefeature. - Make multi-digit optimizations in integer parsing optional.
- Much higher miri coverage including for proptests and our corner cases from the golang test suite.
Changed
- Updated the MSRV to 1.63.0 (1.65.0 for development).
- Improved performance due to compiler regressions in rustc 1.81.0 and above.
Fixed
- Removed use of undefined behavior in
MaybeUninit. - Provide better safety documentation.
- Parsing of Ruby float literals.
- Performance regressions in Rust 1.81.0+.
- Removed incorrect bounds checking in reading from iterators.
- Overflow checking with integer parsing.
- Writing
-0.0with a leading-. - Reduced binary siezes when the compact feature was enabled.
- Improved performance of integer and float parsing, particularly with small integers.
- Removed almost all unsafety in
lexical-utiland clearly documented the preconditions to use safely. - Removed almost all unsafety in
lexical-write-integerand clearly documented the preconditions to use safely. - Writing special numbers even with invalid float formats is now always memory safe.
Removed
- Support for mips (MIPS), mipsel (MIPS LE), mips64 (MIPS64 BE), and mips64el (MIPS64 LE) on Linux.
- All
_uncheckedAPI methods, since the performance benefits are dubious and it makes safety invariant checking much harder. - The
safeandnightlyfeatures, since ASM is now supported by the MSRV on stable and opt-in for memory-safe indexing is no longer relevant.
-
0.8.518 May 2022Release notes
Open source →Changed
- Fixed the partial integer parser to correctly return negative values if parsing partial input.
-
0.8.310 Mar 2022Release notes
Open source →Added
- Added support for
-Zmiri-tag-raw-pointersin miri correctness checks. - Added the documented functions
format_errorandformat_is_validto determine if a format packed struct is valid, since the previous checks relied on undocumented behavior. - Added
from_radixtoParseFloatOptionsandWriteFloatOptions, to simplify creating the default options with a different radix.
Changed
- Fixed
no_stdinlexical-parse-floatwhen default features are disabled. - Fixed issue in parsing integers and floats with the
power-of-twofeature enabled for radixes 16 and 32.
- Added support for
-
0.8.204 Oct 2021Release notes
Open source →Changed
- Reproduce all dependent licenses in lexical, and document extensively what features are dependent on what licensing terms.
-
0.8.003 Sep 2021Release notes
Open source →This is a very large release that involved a full re-write from the ground-up.
Added
- Added the Options API
- ParseFloatOptions
- ParseIntegerOptions
- WriteFloatOptions
- WriteIntegerOptions
- Added
parse_with_options,parse_partial_with_options - Added
write_with_options. - Added a faster float writer and parser for power of 2 radixes.
- Added the
required_exponent_notationflag toNumberFormat. - Added the
power-of-twofeature, for conversion to and from strings with power-of-two bases. - Added the
compactfeature, optimized for binary size rather than performance. - Added extensive documentation on benchmarks, algorithms used, and internal implementation details.
Changed
- Made the Eisel-Lemire algorithm the default float-parser, leading to substantial improvements in performance.
- Made Dragonbox the default float writer.
- Removed pre-computed float tables of powers-of-two, and recreated stable powers of 2 through bit manipulations.
- Refactored all numeric conversions into separate crates, using workspaces.
- Improved the algorithms to write and parse 128-bit integers, using faster division and multiplication algorithms.
- Updated the MSRV to 1.51.0.
- Updated the benchmarks to note the significant algorithm changes.
- Added automatic formatting via Rustfmt, linting via Clippy, as well as increased documentation of safety guarantees.
- Re-wrote NumberFormat to allow more extensive configuration and use const generics.
- Added support for base prefixes and suffixes.
- Reduced static storage required for extended-float algorithms.
- Fixed a bug with trailing digit separators in special values.
- Updated the fuzz handlers and conformance tests.
- Simplified the big-integer arithmetic, improving performance and simplifying maintenance for float parsing algorithms.
Removed
- Remove the
write_format,write_radix, and similar functions. - Remove the
parse_format,parse_radix, and similar functions. - Removed the
dtoafeature. - Removed the
roundingfeature. - Removed the lexical-capi. Existing, high-performance C/C++ libraries exist, so it's no longer practical.
- Added the Options API
-
0.7.621 Apr 2021Release notes
Open source →Changed
- Updated cfg_if version.
- Downgraded rand to fix proptests.
- Fixed a bug on newer Rustc versions where
slice::sortis not present inno_std. - Added a feature
libmwhich enables stableno_stduse. - Patched an implementation of insert_many due to a security advisory which does not affect lexical.
-
0.7.513 Feb 2021 -
0.7.429 Jan 2020Release notes
Open source →Changed
- Changed NumberFormat to use 64-bit flags.
- Added
NO_INTEGER_LEADING_ZEROSandNO_FLOAT_LEADING_ZEROSNumberFormat flags. - Added
InvalidLeadingZerosto ErrorCode enum. - Added
validate_no_leading_zerosto reject invalid inputs. - Added new leading zero checks to all pre-defined NumberFormat constants.
-
0.7.326 Jan 2020Release notes
Open source →Changed
- Updated the format bitflags to make matches more efficient, allowing jumptables to be used for most situations.
-
0.7.225 Jan 2020 -
0.7.125 Jan 2020Release notes
Open source →Added
- Added
formatfeature to control parsing integers and floats from number specifications. - Added the
NumberFormatbitflags to control Number format specifications. These flags control how a number is parsed, including enabling the use of digit separators, requiring integer or fraction digits, and more. - Added pre-defined constants for
NumberFormat(RUST_STRING,PYTHON_LITERAL) to avoid compiling formats when not needed. - Added the
FromLexicalFormatandFromLexicalLossyFormattraits with theformatfeature, which enable you to specify the number format during parsing. - Implemented algorithms in terms of generic iterators, to allow skipping digit separators.
- Implemented data interfaces to simplify parsing and validating number format.
- Added more values to
ErrorCodeto signify more parse failures.
Changed
- Changed
ErrorCode::MissingFractionto beErrorCode::MissingMantissa, to differentiate between missing integers, missing fractions, and missing significant digits (mantissa). - Remove
RawFloatStateandFloatStateand replaced it logically withFastDataInterfaceandSlowDataInterface, allowing format-defined parsing.
- Added
-
0.7.007 Jan 2020Release notes
Open source →Changed
- Updated
arrayvecandstatic-assertionsversions. - Removed support for Rustc versions below 1.37.0.
- Updated
-
0.6.821 Apr 2021Nothing published for this version
-
0.6.729 Jan 2020Nothing published for this version
-
0.6.626 Jan 2020Nothing published for this version
-
0.6.525 Jan 2020Nothing published for this version
-
0.6.425 Jan 2020Nothing published for this version
-
0.6.222 Sep 2019 -
0.6.117 Sep 2019 -
0.6.008 Sep 2019Release notes
Open source →Added
- Added
get/set_exponent_default_char,get/set_exponent_backup_char, andget/set_float_rounding, to allow validation logic for config variables. - Added the
write*functions, which replace the*toamethods. - Added
parse*functions, which replace theato*methods. - Added tests to ensure lexical-core works with proc-macros.
- Substituted rust-stackvector with arrayvec, which has better support.
Removed
- Removed
EXPONENT_DEFAULT_CHAR,EXPONENT_BACKUP_CHAR, andFLOAT_ROUNDING. - Removed all expanded API signatures for
ato*to*toa, since these were for compatibility with the C-API and were therefore redundant. - Removed the FFI submodule, and moved all functionality to the
lexical-capicrate.
- Added
-
0.5.121 Apr 2021Nothing published for this version
-
0.5.021 Aug 2019Release notes
Open source →Added
- Added ffi::Result, an FFI-compatible tagged union, to store results for FFI-compatible functions.
- Added
MAX_*_SIZE_BASE10constants, to determine the maximum size in bytes a formatted type will take in base 10. - Added
ato*_partialfunctions, which parse until an invalid digit is found, returning the value and number of processed digits. - Added unittests for itoa designed to test uniform, sequential, and heterogeneous data, aimed to test both optimal performance and branch prediction misses.
Changed
- Improved code generation and reduced binary bloat. There are a few algorithmic differences that make this possible, but the parsers now generally extract the float subcomponents first, then parsed known-good data after for enhanced performance.
- Updated the benchmarks and benchmark results.
- Moved lexical::Error to lexical_core::Error. Error is re-exported in lexical.
- Add variants for lexical_core::ErrorCode. Added
Underflow, to detect numerical underflow,EmptyFraction, to detect floats with an empty integer and fraction components, andEmptyExponent, to detect floats with no value following the exponent character. - Changed Result to use
std::result::Result. - Fixed proptests and added more comprehensive proptests thanks to @dangrabcad.
- Moved FFI-compatible code to the public
ffimodule. - Removed
*_slicefrom functions in the public API, since there is no naming conflict with FFI code. - Removed
*_ffiand*_FFIfrom public functions and constants. - Optimized the itoa exporters using specialized optimizations for the type size and number of digits. The resulting performance excels for all values, providing 2-3x performance improvements, with exceptional performance for values with a small number of digits.
- Optimized integer division algorithm based off the compiler-builtins crate to avoid redundant calls to an expensive compiler intrinsic (
__udivmodti4). - Optimized the atoi algorithm for 128-bit integers by using intermediary 64-bit integers, leading to performance boosts of up to 30x.
Removed
- Removed the unchecked parsers from the public API.
try_parse*has been replaced withparse*. - Removed ErrorCode::Success, since with the new result types it was redundant.
-
0.4.821 Apr 2021Nothing published for this version
-
0.4.622 Sep 2019Nothing published for this version
-
0.4.509 Sep 2019Nothing published for this version
-
0.4.406 Sep 2019Nothing published for this version
-
0.4.326 Jul 2019Release notes
Open source →- Fixed a bug (issue #20) leading to incorrect float parsing (1 ULP error) for slow-path algorithms containing floats with a trailing 0-digit in the fraction component (discovery by @dangrabcad). Added in comprehensive unittests to avoid future regressions.
- Fixed CI for older Rustc versions due to issues with the
editionkeyword. - Updated dependencies (credit to @junhoo).
- Updated the benchmarks for float and integer formatting to use
Write::write_fmtrather thanto_stringto avoid heap allocation leading to misleading results (credit to @RazrFalcon).
-
0.4.225 Jun 2019Release notes
Open source →Added
- Comprehensive continuous integration unittests for numerous platforms, based off the trust templates.
- Added known issue for a non-default, lossy setting on armv6 architectures.
Changed
- Bug fix for 32-bit targets.
-
0.4.120 Jun 2019Release notes
Open source →Added
- Backwards compatible support for Rustc 1.24.0.
- Added
parse_partial*parsers, which parse until an invalid digit is found, returning the value and number of processed digits.
Changed
- Worked around a bug in the internal float formatter where
&arr[idx]creates a local copy in Rust versions before 1.28.0, creating a dangling reference after the scope ends. For more details, seecached_grisu_powerin/lexical-core/src/ftoa/grisu2.rs. - Changed public trait names for
FromBytes,FromBytesLossy, andToBytestoFromLexical,FromLexicalLossy, andToLexical. - Changed method names for trait
ToLexicalfromto_bytesandto_bytes_radixtoto_lexicalandto_lexical_radixto avoid conflict with unstable feature int_to_from_bytes. - Changed method names for trait
FromLexicalfromfrom_bytes,from_bytes_radix,try_from_bytes, andtry_from_bytes_radixtofrom_lexical,from_lexical_radix,try_from_lexical, andtry_from_lexical_radixto avoid conflict with unstable feature int_to_from_bytes. - Changed method names for trait
FromLexicalLossyfromfrom_bytes_lossy,from_bytes_lossy_radix,try_from_bytes_lossy, andtry_from_bytes_lossy_radixtofrom_lexical_lossy,from_lexical_lossy_radix,try_from_lexical_lossy, andtry_from_lexical_lossy_radixto avoid conflict with unstable feature int_to_from_bytes.
-
0.4.014 Feb 2019Nothing published for this version
-
0.3.123 Dec 2018Nothing published for this version
-
0.3.023 Dec 2018Nothing published for this version
-
0.2.119 Dec 2018Nothing published for this version
-
0.2.018 Dec 2018Nothing published for this version
-
0.1.316 Dec 2018Nothing published for this version
-
0.1.216 Dec 2018 withdrawnNothing published for this version
-
0.1.115 Dec 2018 withdrawnNothing published for this version
-
0.1.015 Dec 2018 withdrawnNothing published for this version