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 / Demos of Maths function length > 100

Author
Message
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 14th Jun 2007 12:18
Sorry not code i'm still testing. It seems to work. within the attachment is three programs and one text file.

1. super calulator: Started with this to test the math function
2. Rsa: An program to find an factor. Runs about 1.7 seconds per calulation. I could change the code to calulated to number to 10 Decimal places to make it run faster. The program does it to 79 decimal places. If you check the txt file you will find 987654321/123456789 to 200 decimal places. also use some logic function.
3. m prime: find an factor of 2XyN-1 useing binary maths and binary logic.

Thes function are all dune with strings. There are no manual input in these demos.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 15th Jun 2007 14:58
Here is the code for super calulator. This should give you an idear on how i did the other programs.



There are other function that i'm working on root, 123xy321 change the function to handle -130349 and 12401491.3580238.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Jun 2007 23:25
That's quite interesting. I suppose because you are using strings, you are limited to 255 character positions - what would happen if your calculator exceeded that?

You could manage this with memblocks. Or you could manage it with an integer array dimensioned to the length of characters that you would want to store.

dim fake_string(1000)
read in character numbers
convert to int values
fake_string(n)=converted string values
perform calculations ...

Here's an off topic question: what ever happened to your heightmap matrix generator?

You seem to have some clever ideas, why don't you enter the DBC challenges?

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 21st Jun 2007 12:29
Latch ... The string are limeted to around 200 characters. If you exceeded that you will get an overflow error. I could handle larger number useing dim test(1000). But i have to work out how to store and seleted which number to use. Not much trouble but i'm working on an program to find factors of (2^N)-1 useing trial factoring. still an little bug with the code. I think the problem is with the mod function but it could be anywhere.

My heightmap matrix project is on the back burner. I was going to turn it into an GTA game but i found an little bug with camra position. to fix it i would have to rewrite all of the code. It is the one with the man walking around and the car.

I keep comeing it with new idears so i have to test them out. It is an bit of an pain at times. But it improves my skill at programming and that is it all about.

About the DBC challenges i will have an go.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 25th Jun 2007 11:43
I have finished the program that find factors of (2^N)-1. The bug was with the mod function it is fix now. An old version only check to see if (2^N)-1 devides by 2 to 10000. In this version it find them an lot faster by only check 1 number. But this number changes with every N value. I need to change it to hange more that 1 number. check the snippet for the number that i have found factors for.



Here is an link to an program that you can use to test them out.http://www.mersenne.org/

Login to post a reply

Server time is: 2026-07-06 08:57:36
Your offset time is: 2026-07-06 08:57:36