Next Article in Journal
LACE-Net: A Swin Transformer with Local Frequency-Domain Energy and Adaptive Contrast Enhancement for Fine-Grained Land Cover Classification
Next Article in Special Issue
A Nonlinear State-Space Model for Fatigue Attention Dynamics in Online Learning Environments
Previous Article in Journal
Reason2Decide-C: Adaptive Cycle-Consistent Training for Clinical Rationales
Previous Article in Special Issue
Case Studies on the Logical Structure of the Algorithms Tabu Search and Threshold Accepting for Generating Solutions in Searching and Solving the Bin-Packing Problem
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

xjb: Fast Float to String Algorithm

by
Junbo Xiang
and
Tiejun Wang
*
School of Computer Science, Chengdu University of Information Technology, Chengdu 610225, China
*
Author to whom correspondence should be addressed.
Computers 2026, 15(5), 280; https://doi.org/10.3390/computers15050280
Submission received: 29 March 2026 / Revised: 20 April 2026 / Accepted: 24 April 2026 / Published: 27 April 2026
(This article belongs to the Special Issue Computational Science and Its Applications 2025 (ICCSA 2025))

Abstract

Efficiently and accurately converting floating-point numbers to decimal strings remains a fundamental challenge in numerical computation, data serialization, and human–computer interaction. While modern algorithms such as Ryū, Dragonbox, and Schubfach rigorously satisfy the Steele–White criteria for correctness and minimal output length, their performance is frequently constrained by branch mispredictions, high-precision multiplication overhead, and suboptimal utilization of instruction-level parallelism. This paper introduces xjb, a novel floating-point–string conversion algorithm derived from Schubfach that systematically overcomes these bottlenecks. By restructuring the core computation to reduce instruction dependencies, adopting branchless decision logic, and exploiting SIMD instruction sets for decimal-to-ASCII formatting, xjb delivers state-of-the-art throughput across diverse hardware platforms. The algorithm requires only a single 64-by-128-bit multiplication for IEEE 754 binary64 conversions and a single 64-by-64-bit multiplication for binary32, drastically decreasing arithmetic complexity. Extensive benchmarking on AMD R7-7840H and Apple M1/M5 processors demonstrates that xjb consistently outperforms leading contemporary implementations. Notably, on the Apple M5, xjb achieves speedups of approximately 20% and 136% for binary64 and binary32 conversions, respectively, when compared to the highly optimized zmij library. The algorithm is fully compliant with the Steele–White principle; exhaustive validation over the entire binary32 space and extensive random testing across the binary64 range confirm both its theoretical soundness and practical robustness.
Keywords: floating point; printing; algorithm; performance; SIMD; branchless floating point; printing; algorithm; performance; SIMD; branchless

Share and Cite

MDPI and ACS Style

Xiang, J.; Wang, T. xjb: Fast Float to String Algorithm. Computers 2026, 15, 280. https://doi.org/10.3390/computers15050280

AMA Style

Xiang J, Wang T. xjb: Fast Float to String Algorithm. Computers. 2026; 15(5):280. https://doi.org/10.3390/computers15050280

Chicago/Turabian Style

Xiang, Junbo, and Tiejun Wang. 2026. "xjb: Fast Float to String Algorithm" Computers 15, no. 5: 280. https://doi.org/10.3390/computers15050280

APA Style

Xiang, J., & Wang, T. (2026). xjb: Fast Float to String Algorithm. Computers, 15(5), 280. https://doi.org/10.3390/computers15050280

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop