Personally, I don't think it would be THAT useful... but...I think there is something behind this proposal that makes sense.
I do believe it could be useful for developers to have an easier access to number parts or characteristics. Perhaps something like: const i = 1234.567; console.log( i.float ); // 567 console.log( i.abs ); // 1234 console.log( i.thousands ); // 1 console.log( i.million ); // 0 console.log( i.hundred ); // 2 console.log( i.hundreds ); // 12 console.log( i.ten ); // 2 console.log( i.tens ); // 123 console.log( i.tenth ); // 5 console.log( i.tenths ); // 5 console.log( i.hundredth ); // 6 console.log( i.hundredth ); // 56 There is this table with some patterns: Large Numbers *Number....................* *Name* *Symbol* *Description (Short Scale)* Description (Long Scale) 1,000,000,000,000,000,000,000,000 yotta Y Septillion Quadrillion 1,000,000,000,000,000,000,000 zetta Z Sextillion Thousand Trillion/Trilliard 1,000,000,000,000,000,000 exa E Quintillion Trillion 1,000,000,000,000,000 peta P Quadrillion Thousand Billion/Billiard 1,000,000,000,000 tera T Trillion Billion 1,000,000,000 giga G Billion Thousand Million/Milliard 1,000,000 mega M Million Million 1,000 kilo k Thousand Thousand 100 hecto h Hundred Hundred 10 deca da Ten Ten>Small Numbers *Number....................* *Name* *Symbol* *Description (Short Scale)* *Description (Long Scale)* 0.1 deci d Tenth Tenth 0.01 centi c Hundredth Hundredth 0.001 milli m Thousandth Thousandth 0.000 001 micro u Millionth Millionth 0.000 000 001 nano n Billionth Thousand Millionth 0.000 000 000 001 pico p Trillionth Billionth 0.000 000 000 000 001 femto f Quadrillionth Thousand Billionth 0.000 000 000 000 000 001 atto a Quitillionth Trillionth 0.000 000 000 000 000 000 001 zepto z Sextillionth Thousand Trillionth 0.000 000 000 000 000 000 000 001 yocto y Septillionth Quadrillionth I mean...something like that could make sense to offer faster access to parts of numbers... - Could be useful for games, statics, animations, transitions, etc - Very useful to deal with the recently added bigInt - The implementation of something like this is not trivial, and there must be many different ways to accomplish similar results, what increases the granularization of implementations in different libs - I don't think this would bring trouble to current language implementation Just adding my 2 cents to the discussion :) [ ]s *--* *Felipe N. Moura* Web Developer, Google Developer Expert <https://developers.google.com/experts/people/felipe-moura>, Founder of BrazilJS <https://braziljs.org/> and Nasc <http://nasc.io/>. Website: http://felipenmoura.com / http://nasc.io/ Twitter: @felipenmoura <http://twitter.com/felipenmoura> Facebook: http://fb.com/felipenmoura LinkedIn: http://goo.gl/qGmq --------------------------------- *Changing the world* is the least I expect from myself! On Fri, Mar 8, 2019 at 2:38 PM Naveen Chawla <[email protected]> wrote: > I've probably missed it, but what application are you building that would > use this feature? Or, under what circumstances would an application use > this feature? > > On Fri, 8 Mar 2019 at 17:24 guest271314 <[email protected]> wrote: > >> The code for "transforming" numeric values to array and array to numeric >> value has at least one complete implementation. That is not the goal of >> this proposal. >> >> The goal of this proposal is to suggest to this body to take up the task >> of defining the various manners in which that transformation can be >> achieved, as illustrated at the example for the number *e* at >> https://esdiscuss.org/topic/fwd-proposal-1-number-integer-or-decimal-to-array-2-array-to-number-integer-or-decimal#content-21 >> . >> >> From perspective here, the third example provides the output (in array >> representation) which can be manipulated more extensively than the previous >> two examples. >> >> [2, .718281828459045] // example 1 >> >> [2.7, 18281828459045] // example 2 >> >> [2, 0.7, 1, 8, 2, 8, 1, 8, 2, 8, 4, 5, 9] // example 3 >> >> >> How should those three examples be named for disambiguation as to the >> output? >> >> If this body does decide to take up the matter of actually defining >> Number and/or Math, and Array methods to perform the conversions, it would >> be helpful if each of the three (and potentially more) possible outputs >> have a clearly defined name for that output. >> >> AFAIK, there is no prior art relevant to conversion or "transforming" >> JavaScript numeric values to array and array to numeric values. >> >> Does the above make sense to you relevant to the purpose of this proposal >> and what this proposal actually suggests? >> >> On Fri, Mar 8, 2019 at 4:45 PM Jeremy Martin <[email protected]> wrote: >> >>> Is it fair to suggest that transforming numeric values to and from >>> arrays isn't the ultimate goal of this proposal? Based on your examples, it >>> seems there are specific manipulations you would like to be able to perform >>> to numeric values, and your contention is that these manipulations would be >>> more straightforward if various components of that value (i.e., the >>> individual digits, the decimal location, and the sign) were represented in >>> a "more structured" way (i.e., an array). Is that much a fair assessment? >>> >>> If that's the case, could you expand on the specific manipulations >>> themselves? Preferably something more explicit and scoped than linking out >>> to one of these external references, if possible. >>> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

