From a7a7dd477d0de7da658262d6e6e92a3deb70e02f Mon Sep 17 00:00:00 2001 From: Ken Kahn Date: Tue, 22 Oct 2024 07:54:48 +0100 Subject: [PATCH] New Shannon app --- apps/number to english o1-mini.html | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/number to english o1-mini.html b/apps/number to english o1-mini.html index 9d5519a..28e43fe 100644 --- a/apps/number to english o1-mini.html +++ b/apps/number to english o1-mini.html @@ -69,7 +69,7 @@

Number to English Converter

// Latin prefixes for scale name construction const unitsPrefixes = ['', 'Un', 'Duo', 'Tre', 'Quattuor', 'Quin', 'Sex', 'Septen', 'Octo', 'Novem']; - const tensPrefixes = ['', 'Deca', 'Vigint', 'Trigint', 'Quadragint', 'Quinquagint', 'Sexagint', 'Septuagint', 'Octogint', 'Nonagint']; + const tensPrefixes = ['', 'Dec', 'Vigint', 'Trigint', 'Quadragint', 'Quinquagint', 'Sexagint', 'Septuagint', 'Octogint', 'Nonagint']; const hundredsPrefixes = ['', 'Cent', 'Ducent', 'Trecent', 'Quadringent', 'Quingent', 'Sexcent', 'Septingent', 'Octingent', 'Nongent']; // Predefined scales up to Decillion for reference @@ -100,8 +100,13 @@

Number to English Converter

if (hundreds < hundredsPrefixes.length) { name += hundredsPrefixes[hundreds]; } else { - // Handle cases where hundreds exceed predefined prefixes - name += 'Cent'; // Fallback or custom handling + // For extremely large scales beyond defined hundredsPrefixes + // Repeat 'Cent' for each additional hundred + let extraHundreds = hundreds - (hundredsPrefixes.length - 1); + name += hundredsPrefixes[hundredsPrefixes.length -1]; + for(let i = 0; i < extraHundreds; i++) { + name += 'Cent'; + } } } @@ -110,8 +115,13 @@

Number to English Converter

if (tensIndex < tensPrefixes.length) { name += tensPrefixes[tensIndex]; } else { - // Handle cases where tens exceed predefined prefixes - name += 'Deca'; // Fallback or custom handling + // For extremely large scales beyond defined tensPrefixes + // Repeat 'Dec' for each additional ten + let extraTens = tensIndex - (tensPrefixes.length - 1); + name += tensPrefixes[tensPrefixes.length -1]; + for(let i = 0; i < extraTens; i++) { + name += 'Dec'; + } } } @@ -120,8 +130,13 @@

Number to English Converter

if (unitsDigit < unitsPrefixes.length) { name += unitsPrefixes[unitsDigit]; } else { - // Handle cases where units exceed predefined prefixes - name += 'Un'; // Fallback or custom handling + // For extremely large scales beyond defined unitsPrefixes + // Repeat 'Un' for each additional unit + let extraUnits = unitsDigit - (unitsPrefixes.length - 1); + name += unitsPrefixes[unitsPrefixes.length -1]; + for(let i = 0; i < extraUnits; i++) { + name += 'Un'; + } } }