Jump to page: 1 26  
Page
Thread overview
Big Integers Online
May 29, 2004
Arcane Jill
May 29, 2004
J Anderson
May 29, 2004
Arcane Jill
May 29, 2004
J Anderson
May 29, 2004
J Anderson
May 30, 2004
Antti Sykäri
May 30, 2004
J Anderson
Re: Big Integers Online::Bug
May 31, 2004
hellcatv
May 31, 2004
Arcane Jill
May 31, 2004
Arcane Jill
Re: Big Integers Online::Another Bug
May 31, 2004
hellcatv
Jun 01, 2004
Arcane Jill
Jun 01, 2004
Arcane Jill
Jun 02, 2004
Walter
Jun 02, 2004
Arcane Jill
Jun 02, 2004
Walter
The gc and destructors (was Big Integers...)
Jun 03, 2004
Arcane Jill
Jun 03, 2004
Norbert Nemec
May 29, 2004
Arcane Jill
May 29, 2004
Ivan Senji
May 30, 2004
Arcane Jill
May 30, 2004
DemmeGod
Makefile help (was Re: Big Integers...)
May 30, 2004
Arcane Jill
May 30, 2004
Andy Friesen
May 30, 2004
DemmeGod
May 30, 2004
Ivan Senji
Re: Makefile help (answered with A-A-P) (was Re: Big Integers...)
May 30, 2004
Lars Ivar Igesund
(way OT) Scons vs A-A-P
May 30, 2004
Andy Friesen
May 30, 2004
Stephan Wienczny
May 30, 2004
Andy Friesen
May 31, 2004
Lars Ivar Igesund
May 31, 2004
Paolo Invernizzi
May 31, 2004
Paolo Invernizzi
Jun 02, 2004
Walter
May 30, 2004
Ivan Senji
May 30, 2004
Arcane Jill
Jun 02, 2004
Walter
Jun 02, 2004
Arcane Jill
May 29, 2004
hellcatv
Jun 01, 2004
Stewart Gordon
Jun 01, 2004
Arcane Jill
Jun 03, 2004
Derek Parnell
Jun 03, 2004
Arcane Jill
Jun 03, 2004
Derek Parnell
Jun 03, 2004
Arcane Jill
Jun 03, 2004
Ivan Senji
Jun 03, 2004
Arcane Jill
Jun 03, 2004
Ivan Senji
Jun 04, 2004
Derek Parnell
Jun 04, 2004
Kevin Bealer
Jun 04, 2004
Derek Parnell
May 29, 2004
I have placed source code for "etc.bigint", a module and package for manipulated unlimited precision integers, online at:

http://www.fast-forward.info/ramonsky/stuff/d/bigint.html

(PS. I found it mildly inconvenient that I had to put supporting files in directory "etc/bigint_files/" instead of "etc/bigint/", because D wouldn't let me have a module and a directory with the same path).

There is no binary - it's "build-it-yourself". But there /is/ documentation.

Over the next few days I'll try to get this also copied onto dsource (maybe even with a binary this time, who knows?)

By the way - how does one persuade the dmd linker to produce a library? Probably a dumb question I know, but I always just linked everything against main to get an executable.

Arcane Jill


May 29, 2004
Arcane Jill wrote:

>I have placed source code for "etc.bigint", a module and package for manipulated
>unlimited precision integers, online at:
>
>http://www.fast-forward.info/ramonsky/stuff/d/bigint.html
>
>(PS. I found it mildly inconvenient that I had to put supporting files in
>directory "etc/bigint_files/" instead of "etc/bigint/", because D wouldn't let
>me have a module and a directory with the same path).
>
>There is no binary - it's "build-it-yourself". But there /is/ documentation.
>
>Over the next few days I'll try to get this also copied onto dsource (maybe even
>with a binary this time, who knows?)
>
>By the way - how does one persuade the dmd linker to produce a library? Probably
>a dumb question I know, but I always just linked everything against main to get
>an executable.
>
>Arcane Jill
>  
>
Why was big int made a class? Why not a struct?  Do you intend to extend it?

-- 
-Anderson: http://badmama.com.au/~anderson/
May 29, 2004
In article <c99nfj$1nrf$1@digitaldaemon.com>, J Anderson says...

>Why was big int made a class? Why not a struct?

1. Ease of initialization. a = new Int(5); is better than Int a; a.init(5);

2. Most importantly (to me). Only classes can have a destructor. In a
version(Secure) build, the destructor wipes the memory which held the Int's
value. This is important in cryptography, since big integers may hold
cryptographic keys, etc., and you don't want those values lying around in memory
indefinitely. (In a non version(Secure), there is no destructor, of course).

Believe me, I thought long an hard about this, but it does make sense. Regardless of whether I had used a struct or a class, there's a dynamic array inside there, and that would always have been passed by reference, even in a struct, so there really wouldn't have been much gain. Constructors and destructors were the deciding factors for me.

Jill



May 29, 2004
In article <c99nfj$1nrf$1@digitaldaemon.com>, J Anderson says...

>  Do you intend to extend it?

I don't think so. I hadn't planned to. Maybe we could add "final" to make that clear. But you never know - someone might want to.

Jill


May 29, 2004
Arcane Jill wrote:

>In article <c99nfj$1nrf$1@digitaldaemon.com>, J Anderson says...
>
>  
>
>>Why was big int made a class? Why not a struct?
>>    
>>
>
>1. Ease of initialization. a = new Int(5); is better than Int a; a.init(5);
>
>2. Most importantly (to me). Only classes can have a destructor. In a
>version(Secure) build, the destructor wipes the memory which held the Int's
>value. This is important in cryptography, since big integers may hold
>cryptographic keys, etc., and you don't want those values lying around in memory
>indefinitely. (In a non version(Secure), there is no destructor, of course).
>
>Believe me, I thought long an hard about this, but it does make sense.
>Regardless of whether I had used a struct or a class, there's a dynamic array
>inside there, and that would always have been passed by reference, even in a
>struct, so there really wouldn't have been much gain. Constructors and
>destructors were the deciding factors for me.
>
>Jill
>
>  
>
That's fine I was just asking.


-- 
-Anderson: http://badmama.com.au/~anderson/
May 29, 2004
Arcane Jill wrote:

>In article <c99nfj$1nrf$1@digitaldaemon.com>, J Anderson says...
>
>  
>
>>Why was big int made a class? Why not a struct?
>>    
>>
>
>1. Ease of initialization. a = new Int(5); is better than Int a; a.init(5);
>  
>
You do know you can go:

Int a = a();

with opCall.


-- 
-Anderson: http://badmama.com.au/~anderson/
May 29, 2004
Now for some stupid questions:
How do i use it?
I got it working by including al of the files in bigint_files
in my project (i am using DIDE), is it the right way?

I also got an error message about exceptions being
in two packages or something like that, and there were two
deprecated C-style casts.

When i finally got it to work i tried:

import std.c.stdio;
import etc.bigint;

int main(char[][] args)
{
    Int n= new Int("123456");

    printf("n = %.*s",n.toString);
}

and it prints:
n = 23456

i tried it with acouple of numbers and i never get the first digit.

"Arcane Jill" <Arcane_member@pathlink.com> wrote in message news:c99mrv$1mv6$1@digitaldaemon.com...
> I have placed source code for "etc.bigint", a module and package for
manipulated
> unlimited precision integers, online at:
>
> http://www.fast-forward.info/ramonsky/stuff/d/bigint.html
>
> (PS. I found it mildly inconvenient that I had to put supporting files in directory "etc/bigint_files/" instead of "etc/bigint/", because D wouldn't
let
> me have a module and a directory with the same path).
>
> There is no binary - it's "build-it-yourself". But there /is/
documentation.
>
> Over the next few days I'll try to get this also copied onto dsource
(maybe even
> with a binary this time, who knows?)
>
> By the way - how does one persuade the dmd linker to produce a library?
Probably
> a dumb question I know, but I always just linked everything against main
to get
> an executable.
>
> Arcane Jill
>
>


May 29, 2004
You rock, Arcane Jill

In article <c99mrv$1mv6$1@digitaldaemon.com>, Arcane Jill says...
>
>I have placed source code for "etc.bigint", a module and package for manipulated unlimited precision integers, online at:
>
>http://www.fast-forward.info/ramonsky/stuff/d/bigint.html
>
>(PS. I found it mildly inconvenient that I had to put supporting files in directory "etc/bigint_files/" instead of "etc/bigint/", because D wouldn't let me have a module and a directory with the same path).
>
>There is no binary - it's "build-it-yourself". But there /is/ documentation.
>
>Over the next few days I'll try to get this also copied onto dsource (maybe even with a binary this time, who knows?)
>
>By the way - how does one persuade the dmd linker to produce a library? Probably a dumb question I know, but I always just linked everything against main to get an executable.
>
>Arcane Jill
>
>


May 30, 2004
In article <c9a37n$282p$1@digitaldaemon.com>, Ivan Senji says...
>
>Now for some stupid questions:
>How do i use it?

Well, I only included source files. Guess I should have included a lib you can link against, but it's early days.


>I got it working by including al of the files in bigint_files in my project (i am using DIDE), is it the right way?

No. It *should* be as simple as "import etc.bigint;". That works for me. The supporting modules are supposed to be "behind the scenes" (though actually still individually importable if you really want to).

The way I build it is as follows:

(1) Separately compile each source file, using the -I compiler switch so that the compiler knows where to start looking for the etc tree.

(2) Compile your own source file(s), again with -I to tell it where to find the
bigint files.

(3) Link all of those files together.

I agree that this is messy. I think I should probably get some pre-built libs together after the project is moved to dsource.


>I also got an error message about exceptions being
>in two packages or something like that.

I think it's possible that without the -I switch, the compiler may not be able to find some things. I can only guess that that's the problem.

If you want, I could always post the complete set of command lines emitted by my build process. You might not necessarily want to copy that (as I keep debug objs separately from release objs) but it might help us figure out what the problem is.

>and there were two
>deprecated C-style casts.

Feel free to ditch them. After dsource, you'll be able to fix that for everyone, but for now, if you give the file and line numbers, I can fix it in my mastercopy.



>When i finally got it to work i tried:
>
>import std.c.stdio;
>import etc.bigint;
>
>int main(char[][] args)
>{
>    Int n= new Int("123456");
>
>    printf("n = %.*s",n.toString);
>}
>
>and it prints:
>n = 23456

You are correct. It's a bug. I just reproduced it. I will fix it and add that one to the unit tests. Will let you know when it's done.



>i tried it with acouple of numbers and i never get the first digit.

My apologies. It worked once upon a time. I must assume I subsequently broke it. Most things are unit tested to prevent that from happening. I can't imagine how I was so stupid as to let that one slip by.

Will get back to you when it's fixed.

Arcane Jill.



May 30, 2004
Why not write a makefile, or better yet a Scons SConstruct file?

John

> The way I build it is as follows:
> 
> (1) Separately compile each source file, using the -I compiler switch so that the compiler knows where to start looking for the etc tree.
> 
> (2) Compile your own source file(s), again with -I to tell it where to
> find the bigint files.
> 
> (3) Link all of those files together.
> 
> I agree that this is messy. I think I should probably get some pre-built libs together after the project is moved to dsource.
> 

« First   ‹ Prev
1 2 3 4 5 6