a Big Number module

BCS ao at pathlink.com
Sat Oct 13 08:31:36 PDT 2007


A few questions:


Why did you chouse to represent the number in base 1000? (BTW you can save 
space by using ushort to store the digits or by switching to base 1_000_000)

did you consider tying to implement it with ASM?

Would you like to put this in scrapple on DSource?

>From the links below It looks like someone has translated the D docs into 
Chinese(!) If this is more than a little bit done, I'm sure Walter would 
be vary interested in links.

The the spelling of the type (Bignumer vs. Bignumber) intentional?

Reply to yidabu,

> Examples:
> 
> auto a = new
> Bignumer("12345678901234567890123456789012345678901234567890");
> auto b = new
> Bignumer("12345678901234567890123456789012345678901234567890");
> auto c = a - b;
> Trace("a - b = ")( c.toUtf8() ).newline;
> c = a + b -b;
> Trace("a + b - b = ")( c.toUtf8() ).newline;
> c = a * b / b;      //lost data here!
> Trace("a * b / b = ")( c.toUtf8() ).newline;
> c = a / b * b;
> Trace("a / b * b = ")( c.toUtf8() ).newline;
> Bug: very low  efficiency of opDiv now.
> 
> CODE Begin:
> 
> /*********************************************************************
> **********
> 
> copyright:      Copyright (c) 2007  (yidabu  g m a i l at com)
> All rights reserved
> 
> license:        BSD style: $(LICENSE)
> 
> version:        Initial release: 2007
> 
> author:         modified by yidabu ( D China :
> http://bbs.yidabu.com/forum-10-1.html )
> original post:
> http://www.fenglin.info/gen_ex/53/Algorithm/323345.html
> **********************************************************************
> *********/
> 
> module dwin.lab.Bignumer;
> 
> import tango.text.convert.Integer;
> debug( UnitTest ) import tango.util.log.Trace;
> class Bignumer
> {





More information about the Digitalmars-d mailing list