Changeset 39081

Show
Ignore:
Timestamp:
12/14/11 02:32:22 (18 months ago)
Author:
dankogai
Message:

fixed: .div bug found by @doraTex http://twitter.com/doraTeX/status/146624730642915330

Location:
lang/javascript/math-bigint/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/math-bigint/trunk/bigint.html

    r38460 r39081  
    2424p (fact(101).div(fact(100))); 
    2525 
     26p (bigint(0).div(2)); 
     27 
    2628</textarea><br><input type="submit" value="run"   onclick="rundom(this)" 
    2729><input type="submit" value="clear" onclick="clsdom(this)" 
  • lang/javascript/math-bigint/trunk/bigint.js

    r38461 r39081  
    11/* 
    2  * $Id: bigint.js,v 0.1 2010/09/11 17:07:30 dankogai Exp dankogai $ 
     2 * $Id: bigint.js,v 0.2 2011/12/13 17:29:51 dankogai Exp dankogai $ 
    33 */ 
    44 
     
    263263        return bigint_from_string(x1); 
    264264    } 
    265     return BigInt(1, 1); 
     265    return new BigInt(1, 1); 
    266266} 
    267267function bigint_neg(x) { 
     
    373373    if (nx < ny || nx === ny && x.digits[nx - 1] < y.digits[ny - 1]) { 
    374374        if (modulo) return bigint_norm(x); 
    375         return BigInt(1, 1); 
     375        return new BigInt(1, 1); 
    376376    } 
    377377    xds = x.digits; 
     
    521521 */ 
    522522 
    523 BigInt.prototype = { 
     523(function(proto){ 
     524    for (var name in proto) BigInt.prototype[name] = proto[name]; 
     525})({ 
    524526    toString: _BigInt_toString, 
    525527    toStringBase: _BigInt_toStringBase, 
     
    532534    cmp: function(y) { return bigint_cmp(this, y) }, 
    533535    neg: function(y) { return bigint_neg(this) } 
    534 }; 
     536}); 
    535537 
    536538Math.BigInt = BigInt;