Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2015-10-31 12:35:24

Registered: 2005-01-21
Posts: 7,696

Scientific Calculator

Now have a JavaScript version of the Scientific Calculator

Please give it a thorough workout.

Also let me know any improvements (in function, format, color, etc) you can think of.

What would it take for this to be your go-to general calculator?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman


#2 2015-10-31 14:43:08

Registered: 2005-06-28
Posts: 30,276

Re: Scientific Calculator

Hi MathsIsFun,

I checked 10 + 10 * 10 ^ 10, it works perfectly.
Also checked e, tan 45 degrees, e, 2^30, 2^60.
The value is very close : The actual value is 1152921594606846976.
The calculator says : 1152921504606847000.
No qualms.
log values checked for a few numbers (base e). Satisfactory.
Factorial values need to be added in the results (importantly 2,3,4,5,6,7,8,19,10,100).
Square root of 2, 3, 10 gives perfect approximation.

Outstanding work, MathsIsFun!

It is no good to try to stop knowledge from going forward. Ignorance is never better than knowledge - Enrico Fermi. 

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.


#3 2015-11-01 02:28:25

From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Scientific Calculator


2^55 = 36028797018963968 the calculator returns 36028797018963970. You could switch over to the full precision calculator when more digits are needed. A message should say that or do it automatically.

Glad that this calculator does not require me to use flash!

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.


#4 2015-11-01 05:00:47

Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,647

Re: Scientific Calculator

Hi MathsIsFun;


1. I'm having some issues with keyboard entry:
    (a) Mouse entry for key presses 2+3=*4= correctly returns 20, but the same entry by keyboard (and also for keyboard's 2+3Enter*4=) incorrectly returns 14. All other calculators I've tried that sum on in this manner return 20 (keyboard or mouse).
    (b) Keyboard entries return results only in the cumulative result box, not the formula box above it (mouse entries return results in both).
    (c) After opening the calculator (and also after pressing 'C'), the formula box isn't live for keyboard entry...but it is for mouse entry. 

2. I'm used to pressing '=' to finalise a calculation, which can then be followed by another calculation without first having to clear the display. However, if I do that, 
    (a) mouse entries are appended to the displayed number in the formula box, and
    (b) keyboard entries have some strange effect in the formula box, the cumulative result box and the History box.

3. It is possible to position the cursor at various locations in an existing formula box entry, but trying to insert anything there with the mouse only appends the input. However, it works properly with the keyboard.

4. The 'NaN' error for the 'invalid entry' example given under 'Function Reference' works, but other invalid entries (eg, syntax, overflow, dividing by zero, consecutive operators) aren't reported.

5. Clearing the History box, deleting entries from it or editing it doesn't seem to be possible by accessing the box directly. However, refreshing/reloading the page deletes all history (and clears the formula box).

6. The backspace button (left-arrow) only deletes the last character in the formula box, irrespective of cursor location. However, the keyboard 'Backspace' key works as it would in a word processor, for example, by deleting the character immediately to the left of the cursor wherever the cursor is in the formula box.

7. Multiple-digit numbers (only if they're the first entry) entered into a new instance of the calculator (eg, at program's opening, or page reload/refresh) create a separate history line at each digit's entry, updating the display to the number's current value and showing that it equals itself. Pressing 'C' before commencing input avoids this quirk.

8. Changing (eg, deleting or editing) the contents of the formula box, either by mouse or keyboard, doesn't always reflect properly in the cumulative result box.

Suggestions for inclusion:

1. An INT key to select the integer part. Maybe also FRAC (though less useful) to select the decimal part (or code the calculator to enable selection of the decimal part by subtracting INT from the number). GF Cornwell's BCalc (my go-to software calculator) has this latter capability, while my HP 32SII allows 'IP' and 'FP' selection for 'integer part' and 'fraction part'.

2. Memories:
    (a) Multiple memory locations: store number via STO + alpha key, and recall it via RCL + alpha key; or
    (b) Cumulative single memory via M, M+ and MR; or
    (c) Both of the above.

3. Factorial symbol: 'x!'

4. 'Automatic constant' function (found on some scientific calculators) that gives cumulative results using a combination of the last-used number and operator.
    eg, to add 2 to each previous display (starting with 25 in this case):
        (a) Microsoft W10 and Canon F-73P: For each '=', 25+2===== yields 27,29,31,33,35.
        (b) CASIO fx-82AU PLUS II: For each '=', 25=+2===== yields 25,27,29,31,33,35. Similarly for the CASIO fx-5800P (which has 'EXE' instead of '=').

5. A 'factor' button (or function?) that returns a number's prime factors, ideally in a form that could be copied and pasted into other programs. Unfortunately it would be impossible to please all, as they have their own formats: eg, for 456, the output could be in a form such as 2^3×3×19; or 2^3*3*19; or 2³×3×19; or 2³*3*19...and of these, your calculator accepts all four options, Mathematica only the first two options, and Excel only the second.
GF Cornwell's BCalc's visual output is 2³ 3 19, which copies as "456 = 2^3 * 3 * 19". That form is accepted by all three of the above-mentioned programs, once stripped of the "456 = ".

Last edited by phrontister (2015-11-02 22:00:41)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson


#5 2015-11-02 21:48:16

Registered: 2005-01-21
Posts: 7,696

Re: Scientific Calculator

Great ideas, will work on them.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman


Board footer

Powered by FluxBB