Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Maths 2 to the power of N

Author
Message
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 6th Oct 2006 13:02
Last night i was work on an little program to cal 2 to the power of N. I found out that DBC does not like numbers larger than 1,000,000 in an verible. so I work out an way Around it. Check the download txt file for 2 to the power of 100,000. I did have power of 500,000 and 1,000,000 but i deleted it. I will have to workout it again.

Is there any programs to check the number?
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 6th Oct 2006 19:43
No...

Or at least, not as integers. You see, DBC is limited to it maximum and minimum. If you want to calculate with values bigger or smaller than those boundries, you need to find some algorithm to use text and divide it in segments. (Wich is ofcourse very hard)

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 7th Oct 2006 12:22
Here is the program to download. Still a bit slow with large numbers. Very fast with small ones. e.g. less than 10,000. I did not use an algorithm to work out the number. Just 5 for next loops. Also i did not use an string just an veribles Dim number(N,1) where N is (Max_Number / 3) + 1 . I use this Fomula to make the program faster also to save memory.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 8th Oct 2006 04:58 Edited at: 8th Oct 2006 07:34
I'm writing this from a linux box so I can't test this in DBC, but if you create an exponent function that returns a float, won't it's max value be over 2,000,000?



Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 9th Oct 2006 13:24
Latch... In DBC the max value can not be over 1,000,000. IF the number is over 1,000,000 then it uses 1.00000000E100 . I want the hole number.

New version of the program. An lot faster. Now the maths is handle with two for next loop. Also with the zip file is some txt files.

Here is the code for the program i hope you like it.
Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 10th Oct 2006 00:57
Quote: "I want the hole number."


Excellent! Lovely spelling!

"Fight the good fight of faith,
Lay hold on eternal life"
-1 Timothy 6:12
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Oct 2006 03:05
@Alien

That's really cool!

Now, can you make it so that it is a usable number? Also, do you think you could modify it for floats... use the same principle to create a float with 100 decimal points for example.

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 10th Oct 2006 12:35
Latch... What do you mean by usable number? You mean the file that it makes? Or do you want it to be like an calulator that doea + * / and - . What is an float? is it an number like 10 / 3 = 3.33333 .

I have made two new version of the program that uses an trick to speed up cal the larger numbers. Last night i cal 2 to the power of 1,000 to 280,000. There are 280 files with an size larger than 10 megs in total. going to work on the menu.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 11th Oct 2006 15:07
Here is the two new version and the current power of 438,000 that has been work out. The version 12 is an manual input but the version 15 is automatic.

Login to post a reply

Server time is: 2026-07-07 11:21:16
Your offset time is: 2026-07-07 11:21:16