version 1.4.0 (11.9 KB) by
Convert a number to a string giving the value using Knuth's Myriad/Yllion naming scheme.

Updated 17 Jan 2022

Convert a numeric scalar into text giving the number value using Donald Knuth's Myriad (aka -Yllion) number naming scheme, e.g. 1024e6 -> 'Ten Myllion Twenty-Four Hundred Myriad', or '10;2400,0000' as digits.
Syntax:
The input numeric value is rounded and the output precision is defined to ensure the least-unexpected output: single=6 digits; double=15 digits; while int/uint values are parsed at their full precision. The function implements an efficient algorithm without using recursion and with just one for-loop.
Donald Knuth's Myriad number naming system uses a logarithmic increase in group magnitudes for a much more efficient usage of the group names:
• 10^0 one
• 10^1 ten
• 10^2 hundred
• 10^8 myllion
• 10^16 byllion
• 10^32 tryllion
• 10^128 quintyllion
• 10^256 sextyllion
Knuth defined the pronunciation as "a myllion (pronounced mile-yun)".
Original Reference: "Supernatural Numbers" by Donald E. Knuth (pp. 310-325 in The Mathematical Gardner, editor David A. Klarner, 1981). Online References:
Examples
ans = 'Zero'
>> num2myriad(-1e303) % aka one centillion (short scale)
ans = 'Negative Ten Hundred Myriad Myllion Tryllion Sextyllion'
ans = 'Ninety-Eight Myllion Seventy-Six Hundred Fifty-Four Myriad Thirty-Two Hundred Ten'
ans = '98;7654,3210'
ans = '+98;7654,3210'
ans = 'Positive Ninety-Eight Myllion Seventy-Six Hundred Fifty-Four Myriad Thirty-Two Hundred Ten'
ans = '1::0000,0000;0000,0000:0000,0000;0000,0000;;0000,0000;0000,0000:0000,0000;0000,0000'

Cite As

Stephen (2022). Number to Myriad (https://www.mathworks.com/matlabcentral/fileexchange/51261-number-to-myriad), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with R2009b and later releases
Platform Compatibility
Windows macOS Linux