Qbasicnews.com
November 14, 2019, 11:35:35 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4
  Print  
Author Topic: Better Looking Calculator. (File Updated 04/26/05)  (Read 29387 times)
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #15 on: April 16, 2005, 01:46:36 PM »

Thanks, first attemt at a calculator,. you should of seen the mess it was when I began.. :lol:

Right, I'll see about those modifications.. :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #16 on: April 16, 2005, 03:08:42 PM »

Update:

Fixed=Display errors.. :wink:

Added=Better Display buffer, flicker removed..

Not Added (yet)=Key inputs..

Removed=DOS Box.. (Thanks to Mistik(Helped me fix my screwwed up IDE when I did so. :lol: ))

Here is the new 1, or should be if I zipped it right (cept having to redo it)... :wink:
http://members.aol.com/rattrapmax6/fbfiles/calc2.zip

Enjoy! Cheesy
Logged

Kevin (x.t.r.GRAPHICS)

KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #17 on: April 16, 2005, 03:11:47 PM »

you should add:

Code:
IF INKEY$ = CHR$(255)+ "X" THEN END
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #18 on: April 16, 2005, 03:22:58 PM »

:Huh: I have:

Code:
IF press$ = CHR$(27) THEN END


Why, whats wrong on your end?
Logged

Kevin (x.t.r.GRAPHICS)

Neo
Na_th_an
*****
Posts: 2150



« Reply #19 on: April 16, 2005, 03:29:26 PM »

dark_prevail's code also ends the program when you click the window cross in windows.

Since you haven't implemented that, the program won't quit when you press X on the window =)
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #20 on: April 16, 2005, 03:41:00 PM »

Found some weird things already though.

First of all, your calculator states the following:
Code:
Sqr(-a) = b / 0   { with a >= 0, b >= 0 }

note that Sqr(-1) is definetly not equal to Sqr(-2) or 4 / 0 Wink
(the answers to these are btw: i, sqr(2) * i, and infinity respectively).

Secondly, when I press the +/- sign first, then type a number, the zero stays attached on front, so I could type numbers like 0482.

^_^
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #21 on: April 16, 2005, 04:08:37 PM »

@Neo (Post 1)
Right, I had tried it thinking that it activate the X, must have not done it right, got it to work tho... :wink:

@Neo (Post 2, Error found 1)
Not exacly following you on that error. But what it seems,. when I divide something by 0, I get "1.#INF".. And when I square root a negetive, I get the same thing... You do know standard calcs, or any as far as I know, can't SQR a negative right? :Huh:

(.. Error found 2)
Oh, heh, I'll try and figure that out,. :roll:  :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Neo
Na_th_an
*****
Posts: 2150



« Reply #22 on: April 16, 2005, 04:27:58 PM »

The square root of a negative number is defined as the square root of the absolute value of that number, times i, the complex constant.

So:

Sqr(-a) = Sqr(a) * i          { for a >= 0 }

Most simple calculators don't have this implemented though (which actually makes them faulty, but ok). =)
^_^

I'm glad you fixed the errors =)
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #23 on: April 16, 2005, 04:43:25 PM »

Smiley Oh, so you ment you wanted me to add support for squaring negatives..

IF num <= 0 THEN 'Check for negative
-(num) 'Change to positive
SQR(num) 'Square
dspl$ = STR$(num) + " * i" 'Display

Output (number * i)

Is this what you mean?

Yeah, I fixed the:

0444, & exit on pressing X,. :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Neo
Na_th_an
*****
Posts: 2150



« Reply #24 on: April 16, 2005, 05:07:22 PM »

Good good =)

About i...
Note that there's more on i than just that Smiley
First of all:
Quote
i^0=1
i^1=i
i^2=-1
i^3=-i
i^4=1
and so on

Simply because i = sqr(-1) so i^2 = -1

Also it has been proven that
e^(i * y) = cos(y) + i * sin(y)   { with y being any real number  }
(e is the mathematical constant of differential equality... or something, it's 2.7182818284590452353602875... (infinite numbers like PI).

If you want more about complex numbers... =) http://www.clarku.edu/~djoyce/complex/ or any other googled link Wink

Hehe, just details Wink Would be fun if it were implemented though.
But first make sure it works very good ^_^
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #25 on: April 16, 2005, 05:14:56 PM »

:rotfl:

Isn't that a bit much for a simple calc? So if I add that i support like I did above, I need all that other stuff to render too? :Huh: Or just the trailling "i" good enough for my calc?

 :lol: Funny, Algebra never bothered to mention all that on "i",. oh well.. :wink: .. Thats a higher math isn't it tho? Smiley
Logged

Kevin (x.t.r.GRAPHICS)

KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #26 on: April 16, 2005, 05:16:41 PM »

Neo, I think he just wanted to make a simple calculator. Imaginary numbers aint exactly simple  Smiley
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #27 on: April 16, 2005, 05:30:51 PM »

Hehe I was just saying it existed Cheesy
And yes, there is a lot about complex (I don't like calling them imaginary) numbers, and it's not easy no =)

And yeah... it's relatively higher math. In what I study (Aerospace Engineering) the complex numbers are essential, as with many other university studies.

Smiley Fun to see you like it though Wink
Logged
shiftLynx
Wandering Guru
***
Posts: 340



WWW
« Reply #28 on: April 16, 2005, 07:59:14 PM »

Rather than just supporting real or imaginary numbers, it would be better to support complex numbers (which have both a real and imaginary part).

If you did this, you could also add stuff like a complex conjugate button, etc.

When you first made this post, I wasn't going to say anything, but you haven't noticed yet so I suppose I should: you've mis-spelt 'calculator' on your main window. Smiley

I agree with Neo: it would be cool to have e.

These buttons would be good additions (no pun intended Wink):

* pi
* e
* ln
* log
* x^y
* 10^x (normally this button is labelled 'EXP' on calculators)
Logged

img]http://www.cdsoft.co.uk/misc/shiftlynx.png[/img]
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #29 on: April 16, 2005, 09:57:55 PM »

Quote from: "Neo"
And yeah... it's relatively higher math. In what I study (Aerospace Engineering) the complex numbers are essential, as with many other university studies.

 Smiley Fun to see you like it though  :wink:  


lol,. I'm going for Automotive Designer, but I read I need to know Engineering also,.  :lol: ,. so a engineer doesn't have to redesign what I've done... :wink:

And high in math intrests me, yes.. Smiley  :wink:

@Shift.. Really,. *goes looks*.... AH! darn,.. oh well, can fix that quick,. lol. :wink:

Hmm,. thinks I'll do a scientific calc later on with those opps..  :wink: I'd have to redesign everthing for such modifictions..
Logged

Kevin (x.t.r.GRAPHICS)

Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!