Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > Math Resources > Calculator Discussion
Reply
 
Thread Tools Display Modes
  #1  
Old September 22nd, 2009, 09:10 AM
Newbie
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
smghost001 is on a distinguished road
Default SciCalculator.com

Hi all,

I know I'm new here and I guess it's kind of rude asking this on my first post .. but the title is just too tempting.

Basically, I'm the creator of www.scicalculator.com and would love to have some feedback about it. I've done extensive testing on it, however, I can't help feeling that there are a couple of errors running around.

Now to introduce myself (yeah the interesting part..): Well I'm from Malta, Europe (tiny island in the Mediterranean), love Maths, have an A level and O level etc etc and am currently studying Engineering at University

Guess that's enough for my first post

Cheers
Reply With Quote
Advertisement
 
  #2  
Old September 22nd, 2009, 02:40 PM
Member
 
Join Date: Sep 2009
Posts: 79
Thanks: 19
Thanked 4 Times in 3 Posts
Viral is on a distinguished road
Default

Welcome to the forum . If you don't mind me asking, what did you get in your A-Level Maths, and what parts did you find the hardest?

Now, on topic. Just skimming through the JavaScript I can see it's kind of messy. For example:

Code:
if (val == "sqrt" || val == "sin" || val == "sin-1" || val == "cos" || val == "cos-1" || val == "tan" || val == "tan-1" || val == "log" || val == "ln") {
			if ((type[count-1] == 0 && count  > 0) || (count == 0)) {
					
				if (val == "sqrt") {
					mode = 6;
				} else if (val == "sin") {
					mode = 7;
				} else if (val == "sin-1") {
					mode = 8;
				} else if (val == "cos") {
					mode = 9;
				} else if (val == "cos-1") {
					mode = 10;
				} else if (val == "tan") {
					mode = 11;
				} else if (val == "tan-1") {
					mode = 12;
				} else if (val == "log") {
					mode = 13;
				} else if (val == "ln") {
					mode = 14;
				}
				
			} else {
				err = 2;
			}		
		}
That can easily be achieved using the switch statement . Or of course, if you really want to be extravagant rewrite the whole inner if statement using ternary xD . It would be a lot shorter, but probably not as efficient.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 03:19 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.