en JavaScript implementation for Z13587 Z15955en Implementation
Değişiklik özeti yok |
18 was missing |
||
11. liniya: | 11. liniya: | ||
"Z1K1": "Z16", |
"Z1K1": "Z16", |
||
"Z16K1": "Z600", |
"Z16K1": "Z600", |
||
"Z16K2": "function Z13587( Z13587K1 )\r\n{\r\n function spell_block(x)\r\n {\r\n var integers = [\"\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"];\r\n var teens = [\"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"nineteen\"];\r\n var tys = [\"\", \"ten\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\r\n \r\n var hundreds_spelling = \"\", tens_and_ones_spelling = \"\", tens_spelling = \"\", ones_spelling = \"\";\r\n var hundreds = x / 100n;\r\n if(hundreds != 0n) {hundreds_spelling = integers[hundreds] + \" hundred\";}\r\n \r\n var tens_and_ones = x % 100n;\r\n if(tens_and_ones \u003E= 11n \u0026\u0026 tens_and_ones \u003C=19n) {tens_and_ones_spelling = teens[tens_and_ones-11n];}\r\n else\r\n {\r\n var tens = tens_and_ones / 10n;\r\n var ones = tens_and_ones % 10n;\r\n if (tens != 0n) {tens_spelling = tys[tens];}\r\n if (ones != 0n) {ones_spelling = integers[ones];}\r\n \r\n if(tens_spelling != \"\" \u0026\u0026 ones_spelling != \"\")\r\n {tens_and_ones_spelling = tens_spelling + \"-\" + ones_spelling;}\r\n else if(tens_spelling != \"\" \u0026\u0026 ones_spelling == \"\")\r\n {tens_and_ones_spelling = tens_spelling;}\r\n else if(tens_spelling == \"\" \u0026\u0026 ones_spelling != \"\")\r\n {tens_and_ones_spelling = ones_spelling;}\r\n else {}\r\n }\r\n \r\n if(hundreds_spelling != \"\" \u0026\u0026 tens_and_ones_spelling != \"\")\r\n {return hundreds_spelling + \" and \" + tens_and_ones_spelling;}\r\n else {return hundreds_spelling + tens_and_ones_spelling;}\r\n }\r\n\r\n var x = Z13587K1;\r\n \r\n var blocks_names = [\"\", \"thousand\", \"million\", \"billion\", \"trillion\", \"quadrillion\", \"quintillion\", \"sextillion\", \"septillion\", \"octillion\", \"nonillion\", \"decillion\", \"undecillion\", \"duodecillion\", \"tredecillion\", \"quattuordecillion\"]\r\n var blocks_spelling = [];\r\n \r\n if(x == 0n) {blocks_spelling.push(\"zero\");}\r\n else if (x \u003E 999999999999999999999999999999999999999999999999n)\r\n { return \"ERROR: number is too large for this algorithm\"; }\r\n else\r\n {\r\n var x_remainder = x;\r\n for(var i=0; i!=blocks_names.length; i++)\r\n {\r\n var cur_block = x_remainder % 1000n;\r\n x_remainder = x_remainder / 1000n;\r\n var cur_block_spelling = spell_block(cur_block);\r\n if(cur_block_spelling != \"\")\r\n {blocks_spelling.push(cur_block_spelling + (blocks_names[i]==\"\" ? \"\" : (\" \"+blocks_names[i]) ) );}\r\n }\r\n }\r\n \r\n var tens_and_ones = x % 100n;\r\n var tens = tens_and_ones / 10n;\r\n var ones = tens_and_ones % 10n;\r\n \r\n return blocks_spelling.reverse().join(\" \");\r\n}" |
"Z16K2": "function Z13587( Z13587K1 )\r\n{\r\n function spell_block(x)\r\n {\r\n var integers = [\"\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"];\r\n var teens = [\"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\"];\r\n var tys = [\"\", \"ten\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\r\n \r\n var hundreds_spelling = \"\", tens_and_ones_spelling = \"\", tens_spelling = \"\", ones_spelling = \"\";\r\n var hundreds = x / 100n;\r\n if(hundreds != 0n) {hundreds_spelling = integers[hundreds] + \" hundred\";}\r\n \r\n var tens_and_ones = x % 100n;\r\n if(tens_and_ones \u003E= 11n \u0026\u0026 tens_and_ones \u003C=19n) {tens_and_ones_spelling = teens[tens_and_ones-11n];}\r\n else\r\n {\r\n var tens = tens_and_ones / 10n;\r\n var ones = tens_and_ones % 10n;\r\n if (tens != 0n) {tens_spelling = tys[tens];}\r\n if (ones != 0n) {ones_spelling = integers[ones];}\r\n \r\n if(tens_spelling != \"\" \u0026\u0026 ones_spelling != \"\")\r\n {tens_and_ones_spelling = tens_spelling + \"-\" + ones_spelling;}\r\n else if(tens_spelling != \"\" \u0026\u0026 ones_spelling == \"\")\r\n {tens_and_ones_spelling = tens_spelling;}\r\n else if(tens_spelling == \"\" \u0026\u0026 ones_spelling != \"\")\r\n {tens_and_ones_spelling = ones_spelling;}\r\n else {}\r\n }\r\n \r\n if(hundreds_spelling != \"\" \u0026\u0026 tens_and_ones_spelling != \"\")\r\n {return hundreds_spelling + \" and \" + tens_and_ones_spelling;}\r\n else {return hundreds_spelling + tens_and_ones_spelling;}\r\n }\r\n\r\n var x = Z13587K1;\r\n \r\n var blocks_names = [\"\", \"thousand\", \"million\", \"billion\", \"trillion\", \"quadrillion\", \"quintillion\", \"sextillion\", \"septillion\", \"octillion\", \"nonillion\", \"decillion\", \"undecillion\", \"duodecillion\", \"tredecillion\", \"quattuordecillion\"]\r\n var blocks_spelling = [];\r\n \r\n if(x == 0n) {blocks_spelling.push(\"zero\");}\r\n else if (x \u003E 999999999999999999999999999999999999999999999999n)\r\n { return \"ERROR: number is too large for this algorithm\"; }\r\n else\r\n {\r\n var x_remainder = x;\r\n for(var i=0; i!=blocks_names.length; i++)\r\n {\r\n var cur_block = x_remainder % 1000n;\r\n x_remainder = x_remainder / 1000n;\r\n var cur_block_spelling = spell_block(cur_block);\r\n if(cur_block_spelling != \"\")\r\n {blocks_spelling.push(cur_block_spelling + (blocks_names[i]==\"\" ? \"\" : (\" \"+blocks_names[i]) ) );}\r\n }\r\n }\r\n \r\n var tens_and_ones = x % 100n;\r\n var tens = tens_and_ones / 10n;\r\n var ones = tens_and_ones % 10n;\r\n \r\n return blocks_spelling.reverse().join(\" \");\r\n}" |
||
} |
} |
||
}, |
}, |
Sayfanın 07.33, 19 Hederlez 2024 datasındaki hali
Bu sayfa, JavaScript olmadan sınırlı bir şekilde görüntülenir.