guest271314 (2019-03-12T06:13:23.000Z)
guest271314 at gmail.com (2019-03-12T07:42:14.320Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. numberToArray(0.1) // should output [.1], not [0, 1] unless that is the output you decide to output from the function As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See _How do I add 1 to a big integer represented as a string in JavaScript?_ https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/. An individual could use BigInteger.js for example as used at the accepted answer could be used, or, (long form addition, subtraction, other mathematics) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is a simple form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T07:28:48.597Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See _How do I add 1 to a big integer represented as a string in JavaScript?_ https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/. An individual could use BigInteger.js for example as used at the accepted answer could be used, or, (long form addition, subtraction, other mathematics) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is a simple form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T07:10:50.230Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See _How do I add 1 to a big integer represented as a string in JavaScript?_ https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/. An individual could use BigInteger.js for example as used at the accepted answer could be used, or, (long form addition, subtraction, other mathematics) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T07:08:26.762Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See _How do I add 1 to a big integer represented as a string in JavaScript?_ https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T07:08:02.078Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See How do I add 1 to a big integer represented as a string in JavaScript? https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:57:00.606Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) from perspective here, is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:55:26.727Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:45:51.502Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array Math.E (2.718281828459) <=> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] <=> 2.718281828459 // example 3 (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:43:30.538Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings, if the requirement was to add, subtract, or perform some other mathematical operation with the input number. Though that is the developers' prerogative what they do with the number formatted as an array in integers and a single decimal, if any. The point of the proposal is that determining the integer, decimal if any, portions of a number and _spreading_ those values to an array (with optional corresponding property name, "ones", "tens", "hundreds", etc., for each of 3 groups of values, or other naming conventions, for example, in a key, value pair in a Map) is simpler to perform tasks with than a built-in literal number that does not have any corresponding name for each digit in the value accessible by method or getter or setter. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:36:29.655Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three ("ones", "tens", "hundreds"). That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:35:08.503Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three. That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. See https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript https://stackoverflow.com/questions/43614407/how-do-i-add-1-to-a-big-integer-represented-as-a-string-in-javascript/ example an individual could use BigInteger.js (BigInt, which ) could be used, or for example (long form) > You can create an array from the string in .lengths of 3 beginning from the end of the string. > Use a pattern which checks if adding 1 would result in the index of the array as a number would sum to 1000, if true, increment previous array index by 1 and fill the current array index with "000". > The pattern below only checks and adjusts last two elements of array; the same pattern can be extended to check each index of array, to properly adjust one or more of the indexes to "000" and increment the previous index by 1. let message1 = "12345612345678901234567890"; let message2 = "12345612345678901234567999"; let message3 = "12345612345678901234999999"; function addNumberToString(str, numToAdd, digits = []) { const [N, len, max] = [3, str.length, 1000]; for (let i = -N, l = len; digits.length < len / N; i -= N, l -= N) { digits.unshift(str.slice(i, l)); } function add(m) { if (+digits[digits.length - m] + numToAdd < max) { let n = +digits[digits.length - m]; digits[digits.length - m] = String(Number(n + numToAdd)); } else { const M = m + 1; if (+digits[digits.length - M] + numToAdd < max) { let n = +digits[digits.length - M]; digits[digits.length - M] = String(Number(n + numToAdd)); digits[digits.length - (M - 1)] = "0".repeat(N); } else { if (digits[digits.length - (m + 1)]) { digits[digits.length - (M - 1)] = "0".repeat(N); add(m + 1); } } } return digits.join("") } return add(1); } console.log( addNumberToString(message1, 1) , addNumberToString(message2, 1) , addNumberToString(message3, 1) ); which can be substituted for an array of integers instead of using strings. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat.prototype.formatToParts, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:26:33.423Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. As for adding fractions, to overcome JavaScript floating point issues, the digits (or indexes of an array) can be divided by and processed in groups of three. That is possible using strings, or digits, once the finite number of integer or decimal places of the input is determined. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:17:15.666Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.
guest271314 at gmail.com (2019-03-12T06:16:57.011Z)
> With respect, it's still not clear how you want to interact with the array > of values once you've destructured a Float into your array format. > If all you have is an array of single-digit numbers that represent the > values in the tenths/hundredths/etc. positions of the source number, how > does this actually circumvent the challenges of representing Decimal values > that aren't exactly representable as a Float? It is not clear how your examples of adding specific values in JavaScript are relevant to the proposal. All of the test cases used at the code which fixed the bugs in the proof of concept at the original post output the expected result. If you have more test cases, number or decimal, to suggest for input relevant to the code at the original proposal, number to array, array to number, kindly post those tests cases listing input and expected output. The proposal does not seek to solve all JavaScript number issues. The proposal seeks to standardize the naming conventions of number to array and array to number, including decimals. An array is the simplest form of structured output. An object of key, value pairs (similar to Intl.NumberFormat, with JavaScript numbers instead of strings) can also be utilized for each of the digits of integer and decimal (fraction), if any.