Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#12174 closed defect (fixed)

dojox.math.BigInteger not usable with base 10

Reported by: rdunklau Owned by: Eugene Lazutkin
Priority: high Milestone: 1.8
Component: Dojox Version: 1.6.0b1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

I tried to use dojox.math.BigInteger to perform client-side checksum calculation, and I stumbled upon several bugs.

Steps to reproduce: Executes the attached code. Note that it succeeds at instantiating bigints in base 16, but not in base 10.

Solutions: It seems that some functions are not properly exported from BigInteger to BigInteger-ext. For example, the fromRadix method is accessed as if it were public in BigInteger, although it is only defined in BigInteger-ext and as a protected method (named _fromRadix). Same goes for the intAt function, defined in BigInteger, and not exported in the namespace to be used by BigInteger-ext.

I'm willing to submit a patch and a CLA for these.

Attachments (1)

testcase.js (158 bytes) - added by rdunklau 8 years ago.

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by rdunklau

Attachment: testcase.js added

comment:1 Changed 8 years ago by bill

Component: GeneralDojox
Description: modified (diff)
Owner: changed from anonymous to Eugene Lazutkin

Looks like Eugene owns this file?

comment:2 in reply to:  1 Changed 8 years ago by Eugene Lazutkin

Status: newassigned

I'm willing to submit a patch and a CLA for these.

Please do both.

comment:3 Changed 8 years ago by Eugene Lazutkin

Milestone: tbdfuture

comment:4 Changed 8 years ago by hreusser

Hi rdunklau,

is it possible to provide the patch? We are struggling with the same issue. Many thanks in advance.

For general curiosity: Why is the big int library splitted up into two modules?

-thx Halm

comment:5 Changed 7 years ago by cyan

The following was failing for me (on dojo-release-1.8.0b1):

], function(BigInteger) {
    var i = new BigInteger("1234", 10);

with the message "Object 0 has no method 'fromRadix'".

I fixed the issue by fixing the call to fromRadix in function bnpFromString of BigInteger? (it was missing a leading _):

else { this._fromRadix(s,b); return; }

It looks like the same issue as on this ticket.

I signed a CLA years ago if it helps (don't think a 1 character bugfix can really have copyright issues anyway).

comment:6 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [29447]:

fix apparent typo, this should have tests though, fixes #12174 !strict, thanks cyan

comment:7 Changed 7 years ago by bill

Milestone: future1.8
Note: See TracTickets for help on using tickets.