Proposal: 1) Number (integer or decimal) to Array 2) Array to Number (integer or decimal)

guest271314 guest271314 at gmail.com
Thu Mar 7 23:11:31 UTC 2019


Am not concerned with "down" votes. Do not really care about "up" or "down"
votes. Would only object directly to *censorship, *which unfortunately, is
practiced from top-down (CEO; management; moderators; "trusted users";
etc.) at the linked sites. That is beyond the scope of this proposal.
Nonetheless, have posted questions and answers at those sites, before being
censored - without notice - at those

The proposal states the specification is WIP. Handing leading 0's at
decimal portion of number was a challenged faced when initially conceived
the proof of concept. Which was solved by the answer at the SO post which
fixed the two bugs described at the question at SO.

The 1.0 is not a proper example, though illustrates the problems with
JavaScript number implementation. An appropriate example would be 1.1. That
is, a standardized way to represent a decimal as an array.

Have already described a "real world" example, at least twice above, citing
the original proposal. If you do not see that as a "real world" example, am
not interested in trying to convince you, or anyone else of that "real
world" example.

What will more than likely eventually occur is that your "community" will
ban this user after presenting evidence, as am not beholden to you or your
views, and have no need to fit into to your "community". Am well-suited to
solving own problems. Share when have a notion that what have experimented
with may be of interest to others.

Just posted the proposal to you here for your consideration. If the
proposal is not useful, then disregard and return to your important affairs
that you have deemed useful to your time.



On Thu, Mar 7, 2019 at 10:53 PM Jeremy Martin <jmar777 at gmail.com> wrote:

> It's entirely possible that I'm being thick here, but can you expand on
> the use case?
>
>    - The initial link that you posted results in a code challenge that
>    was voted down to a negative score as a result of ambiguity in the
>    challenge description, and...
>    - the two expressions you provided are already valid JavaScript.
>    - I'm also confused as to why we'd want `1.074` to convert to `[1.0,
>    7, 4]`. How is that different from, say, `1.74` also converting to `[1, 7,
>    4]` (given that `1 == 1.0`)?
>
> Going back to our request for a "real world" use case, we're asking you to
> provide an example of something that you'd want to do that has value
> external to the proposal itself. That is, if I proposed a `toX()` method
> that always converted the receiver to the character "X", I would need to
> provide a real world justification beyond "it's easier to convert things
> into the letter X". So, again, what is a real world utility of this
> transformation?
>
> On Thu, Mar 7, 2019 at 5:22 PM guest271314 <guest271314 at gmail.com> wrote:
>
>> Have you read the proposal, and the first response to your inquiry? It is
>> simpler to have the ability to add, subtract, divide, or otherwise
>> manipulate individual nth indexes of an integer or decimal represented as
>> an array of integers potentially containing one decimal than trying to
>> perform the same mathematical operations on a number in JavaScript
>> (essentially broken in JavaScript due to the floating-point number issues).
>>
>> Will re-post a use case, again
>> ~~(128.625*9*1.074)//1243
>> ~~(128.625*9*1.144)//1324 where if the requirement is to increment the
>> decimal portion of 1.074 or 1.144 if the decimal is first converted to an
>> array, we can use array methods to tests the matches we are looking for.
>> For example, [1.0, 7, 4]
>>
>> representation of 1.074 allows each of the portions of the number to be
>> adjusted independently. Since we have previously defined a .toNumber()
>> Array method we know we can get the value of the array as a JavaScript
>> number.
>>
>> On Thu, Mar 7, 2019 at 10:12 PM Jeremy Martin <jmar777 at gmail.com> wrote:
>>
>>> By "real world" we mean somewhere outside of a code challenge or
>>> similarly low utility program context.
>>>
>>> You mentioned statistics, for example. Can you reference a specific
>>> example from that domain where these methods would offer an advantage?
>>>
>>> On Thu, Mar 7, 2019, 5:05 PM guest271314 <guest271314 at gmail.com> wrote:
>>>
>>>> Not sure what you mean by "real world" use case. Described at least one
>>>> use case at the proposal. Statistics; graphs; number and integer
>>>> manipulation using indexes of arrays with ability to convert manipulated
>>>> array back to number.
>>>>
>>>> On Thu, Mar 7, 2019 at 9:56 PM Naveen Chawla <naveen.chwl at gmail.com>
>>>> wrote:
>>>>
>>>>> What is the real world use case, presuming it's not just an academic
>>>>> exercise
>>>>>
>>>>> On Thu, 7 Mar 2019, 9:08 pm guest271314, <guest271314 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Ability to adjust *nth* digit of an integer or decimal by adjusting
>>>>>> decimal or integer at *nth* index of array, to try to solve OEIS
>>>>>> A217626 oeis.org/A217626 directly, for example
>>>>>>     ~~(128.625*9*1.074)//1243
>>>>>>     ~~(128.625*9*1.144)//1324
>>>>>> where the decimal portion can be manipulated by referencing the index
>>>>>> of an array, then converting the array back to a number.
>>>>>>
>>>>>> On Thu, Mar 7, 2019 at 8:55 PM Jeremy Martin <jmar777 at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Can you explain the motivation for this proposal?
>>>>>>>
>>>>>>> At first blush, this seems like an incredibly arbitrary pair of
>>>>>>> value conversion utilities. Are there real world applications for this?
>>>>>>>
>>>>>>> On Thu, Mar 7, 2019 at 3:43 PM guest271314 <guest271314 at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------- Forwarded message ---------
>>>>>>>> From: guest271314 <guest271314 at gmail.com>
>>>>>>>> Date: Thu, Mar 7, 2019 at 8:35 PM
>>>>>>>> Subject: Proposal: 1) Number (integer or decimal) to Array 2) Array
>>>>>>>> to Number (integer or decimal)
>>>>>>>> To: <es-discuss at mozilla.org>
>>>>>>>>
>>>>>>>>
>>>>>>>> Original concept: Integer or decimal to array and array to decimal
>>>>>>>> or integer https://codegolf.meta.stackexchange.com/a/17223
>>>>>>>>
>>>>>>>> Proof of concept (with bugs)
>>>>>>>>
>>>>>>>> function numberToArray(n) {
>>>>>>>>
>>>>>>>>   if (Math.abs(n) == 0 || Math.abs(n) == -0) {
>>>>>>>>     return [n]
>>>>>>>>   }
>>>>>>>>
>>>>>>>>   const r = [];
>>>>>>>>
>>>>>>>>   let [
>>>>>>>>     a, int = Number.isInteger(a), d = g = [], e = i = 0
>>>>>>>>   ] = [ n || this.valueOf()];
>>>>>>>>
>>>>>>>>   if (!int) {
>>>>>>>>     let e = ~~a;
>>>>>>>>     d = a - e;
>>>>>>>>     do {
>>>>>>>>       if (d < 1) ++i;
>>>>>>>>       d *= 10;
>>>>>>>>     } while (!Number.isInteger(d));
>>>>>>>>   }
>>>>>>>>
>>>>>>>>   for (; ~~a; r.unshift(~~(a % 10)), a /= 10);
>>>>>>>>
>>>>>>>>   if (!int) {
>>>>>>>>     for (; ~~d; g.unshift<span class="gmail-m_-6167854157147748767gmail-m_3497810586139095759gmail-m_-4002267646491221157m_-5946038115082375453gmail-m_2662878951066317968m_7497912379499730396gmail-m_-49591865513921258gmail-m_191674293613409874m_-129
>>>>>>>>
>>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190307/c8e03dd5/attachment-0001.html>


More information about the es-discuss mailing list