Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28144

Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase.

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase.
Date 2015-06-23 23:37 +0200
Organization PointedEars Software (PES)
Message-ID <1447875.8cPT3z67Bs@PointedEars.de> (permalink)
References (5 earlier) <87a8vskcyp.fsf@bsb.me.uk> <4723ff16-0052-41e3-8d3a-6c249345696e@googlegroups.com> <87twu0iogk.fsf@bsb.me.uk> <3774f4ba-032f-4ecb-8542-355beb009200@googlegroups.com> <871th3ikr0.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse wrote:

> jonas.thornvall@gmail.com writes:
>> why do you think there is no
>> other javascript or program on the net that can transform a 100 digit
>> number into an 8 digit base.
> 
> https://github.com/silentmatt/javascript-biginteger/blob/master/biginteger.js
> 
> It does not do exactly what you asked for, but the reasons why it does
> not do that are worth considering.

It certainly leaves room for improvement.  For example,

  BigInteger.small = [
	ZERO,
	ONE,
	/* Assuming BigInteger_base > 36 */
	new BigInteger( [2], 1, CONSTRUCT),
	new BigInteger( [3], 1, CONSTRUCT),
	new BigInteger( [4], 1, CONSTRUCT),
	new BigInteger( [5], 1, CONSTRUCT),
	new BigInteger( [6], 1, CONSTRUCT),
	new BigInteger( [7], 1, CONSTRUCT),
	new BigInteger( [8], 1, CONSTRUCT),
	new BigInteger( [9], 1, CONSTRUCT),
	new BigInteger([10], 1, CONSTRUCT),
	new BigInteger([11], 1, CONSTRUCT),
	new BigInteger([12], 1, CONSTRUCT),
	new BigInteger([13], 1, CONSTRUCT),
	new BigInteger([14], 1, CONSTRUCT),
	new BigInteger([15], 1, CONSTRUCT),
	new BigInteger([16], 1, CONSTRUCT),
	new BigInteger([17], 1, CONSTRUCT),
	new BigInteger([18], 1, CONSTRUCT),
	new BigInteger([19], 1, CONSTRUCT),
	new BigInteger([20], 1, CONSTRUCT),
	new BigInteger([21], 1, CONSTRUCT),
	new BigInteger([22], 1, CONSTRUCT),
	new BigInteger([23], 1, CONSTRUCT),
	new BigInteger([24], 1, CONSTRUCT),
	new BigInteger([25], 1, CONSTRUCT),
	new BigInteger([26], 1, CONSTRUCT),
	new BigInteger([27], 1, CONSTRUCT),
	new BigInteger([28], 1, CONSTRUCT),
	new BigInteger([29], 1, CONSTRUCT),
	new BigInteger([30], 1, CONSTRUCT),
	new BigInteger([31], 1, CONSTRUCT),
	new BigInteger([32], 1, CONSTRUCT),
	new BigInteger([33], 1, CONSTRUCT),
	new BigInteger([34], 1, CONSTRUCT),
	new BigInteger([35], 1, CONSTRUCT),
	new BigInteger([36], 1, CONSTRUCT)
  ];

can be written in a DRY way as

  BigInteger.small = Array.apply(null, {length: 37}).map(function (e, i) {
    return {
      0: ZERO,
      1: ONE,
    }[i] || new BigInteger([i], 1, CONSTRUCT);
  });

whereas only Array.prototype.map() would need to be emulated in a conforming 
implementation of ECMAScript Edition 3.  [Assuming that both ZERO and ONE 
are not false-values.  Here we can see the value of a constructor being 
callable as a function, assuming that something like JSX’s 
Function.prototype.construct() is not available; unfortunately, ES6/2015 
still is not going to have something like this as a built-in.]

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-05-20 06:11 -0700
  Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-05-20 06:37 -0700
  Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-20 17:58 +0200
    Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 09:12 -0700
      Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 09:33 -0700
        Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 10:13 -0700
          Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 11:08 -0700
            Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 11:10 -0700
          Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-21 21:45 +0100
            Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 13:49 -0700
              Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-22 01:19 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 20:24 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-22 20:52 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-23 05:31 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-23 23:37 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-24 00:13 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-22 06:51 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-22 09:15 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Dr J R Stockton <reply1500@merlyn.demon.co.uk.invalid> - 2015-06-23 23:43 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-24 01:03 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-24 09:45 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-24 03:42 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 01:13 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-24 19:31 +0200
                OT: English dictionaries (was: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase.) "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-24 19:54 +0200
    Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 01:57 -0700
      Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-25 12:44 +0200
        Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 04:09 -0700
          Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. John Harris <niam@jghnorth.org.uk.invalid> - 2015-06-25 15:08 +0100
        Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 09:30 -0700
          Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Scott Sauyet <scott.sauyet@gmail.com> - 2015-06-25 13:12 -0700
            Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-25 22:21 +0200
              Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Scott Sauyet <scott.sauyet@gmail.com> - 2015-06-25 13:28 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 15:56 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-27 19:33 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-27 19:45 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 09:17 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:10 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:21 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:24 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 17:04 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 08:23 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 17:47 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:12 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 13:16 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:30 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:45 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 13:51 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:08 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:13 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:19 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:27 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:38 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-29 14:26 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 06:44 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Norman Peelman <npeelman@cfl.rr.com> - 2015-06-29 10:28 -0400
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 07:53 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 16:32 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-29 16:49 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 17:06 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 09:31 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 19:21 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Tim Streater <timstreater@greenbee.net> - 2015-06-29 18:26 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 10:34 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 19:52 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 11:08 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 20:14 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Tim Streater <timstreater@greenbee.net> - 2015-06-29 20:45 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-30 01:00 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 23:35 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 23:37 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-30 01:50 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-30 11:11 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 03:12 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 05:06 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-01 15:24 +0100
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 09:12 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 08:28 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:04 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 14:37 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:19 -0700
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 13:22 +0200
                Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:25 -0700

csiph-web