a Big Number module and D China
yidabu
yidabu.nospam at gmail.com
Sat Oct 13 16:42:48 PDT 2007
> 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)
1. now use base 1_000_000.
> did you consider tying to implement it with ASM?
>
2. I'm new to ASM. I'm happy if someone can will do that.
> Would you like to put this in scrapple on DSource?
>
3. scrapple is a good project on DSource. I'm greatly appreciate if I have the right.
> 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.
>
4. D China ( http://bbs.yidabu.com/forum-10-1.html ) has D docs above DMD 1.012, and many articles about D in Chinese.
> The the spelling of the type (Bignumer vs. Bignumber) intentional?
>
5. thx. fixed now.
> 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
> > {
>
>
--
yidabu <yidabu.nospam at gmail.com>
D China:
http://bbs.yidabu.com/forum-10-1.html
More information about the Digitalmars-d
mailing list