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.

Newcomers DBPro Corner / calculator help (DBC)

Author
Message
Tim Ballisto
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 14th Feb 2004 00:33 Edited at: 14th Feb 2004 00:37
I am trying to make a calculator in DBC, but i can't seem to display anything above 1,000,000 correctly, although it calculates fine.
can somebody help me with this?

Edit: you will have to change the ink rgb to (255,255,255),0
i was using a bitmap background and removed it to be able to post the code.
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 14th Feb 2004 01:04
What do you mean? Does it show "1.0000e+6"? If so, then it's normal


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
Tim Ballisto
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 14th Feb 2004 19:27
is there a way i can make it display a number readable to someone?
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 14th Feb 2004 19:54 Edited at: 14th Feb 2004 19:58
I dont think its possible.


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Feb 2004 09:04
If you know what "1.0000e+6" means, then you can convert it into a readable string I suppose.

"eureka" - Archimedes
Ultimate
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location:
Posted: 15th Feb 2004 11:22
Dear me, making a calculator and you don't know what "1.0000e+6" means. This means 1*10^6 ie. 1 times 10 to the power 6. You could perhaps make a function to read it as a string, check for e, if present then read in from right until e is reached. Then you'll know how many 000 are needed.

In a world without leaders, who'd start all the wars?
Fluffy Paul
21
Years of Service
User Offline
Joined: 16th Dec 2002
Location: United Kingdom
Posted: 15th Feb 2004 13:56
He never said he didn't know what it means - he just said he didn't want it displayed in that format.

Ending a sentence with a French word is so passé
Tim Ballisto
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 15th Feb 2004 17:44
so... if it's 1,000,000 and it would displey 1.0000e+6 then i need to convert it to a string to find the power and then multiply it by ten that many times? would that also work with 1,000,001?
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Feb 2004 19:02
nope, DB`s math is designed for speed more than precision, plus this is more a problem with representing numbers accuratley on a system that uses base two and converts it to decimal with only 16 or 32 bits normaly allocated to hold the number, hence you get these limitations, you could write a parser to accept the numbers as strings and then do the math "longhand", recreating the basic math operations eg

string one is

123456789123456789

string two is

1234

then add them one digit at a time

9+4=13

thats 3 carry one...add that to the string answer$...so

8+3+1 (the one you carried) = 12

thats 2 carry one..answer$ is now 23

etc...

looks painfully long winded, but thats what computers are for, doing painfully long winded calculations on our behalf , you just need to write a loop that will repeat until all the digits have been calculated, addition and subtraction are not too bad, but multiplication and division may need some research to impliment, cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.

Login to post a reply

Server time is: 2024-11-26 05:31:18
Your offset time is: 2024-11-26 05:31:18