GithubHelp home page GithubHelp logo

alexflorides / javascript-calculator Goto Github PK

View Code? Open in Web Editor NEW
39.0 1.0 29.0 139 KB

A simple calculator built using HTML, CSS and JavaScript

Home Page: https://alexflorides.github.io/javascript-calculator/

License: MIT License

JavaScript 74.81% CSS 8.38% HTML 16.81%
calculator javascript-calculator javascript css html calculator-javascript calculator-js simple-calculator-js

javascript-calculator's Issues

Add x² and √ functions

The power of two (x²) and square root (√) are also part of most basic calculators and easy to implement. It would be good to have.

My Idea for improve and changes

I think it's width size we cn be increased for pc/desktop size and phone size is good and apply shadow for make a more interactive.

percent button (%) may be faulty

Behaviourally, the percent button doesn't work as it does on iOS. An issue seen when trying:

  • 100 (x) 35 (%) (=) is that the calculator shows 0.35 x 0.35 = 0.1225 whereas on iOS or MacOS the same sequence of buttons will return the value "35"
  • 100 (+) 35 (%) (=) will result in an output of 35 + 35 = 70 whereas on iOS or MacOS the same sequence of buttons will return the value "135"

History Display

The history of the operation displays outside the dashboard. For example, when I type 8 + 8, it displays outside the dashboard. Only the answer displays inside the dashboard

Praise

Hi Alexandros,

You have probably made this calculator to practice programming, but I can tell you that it's the best JavaScript based calculator out there. And I have checked more than 30 different ones...
It's great that the numerical keyboard is working as input, great styling, great exception handling of division by zero. Overall very nice.
I will make a few suggestions on how to improve it further if you are interested in improving it.

BRs
/Andras

Enhancement Feature: Simple Complex Number Handling

Noticed that, on this application, taking the square root of -1 resulted in NaN, as JavaScript would naturally evaluate it to.

Although most simple calculator applications do this, perhaps it would be a good idea to extend the calculator's abilities to operations with imaginary & complex numbers, or at least simple operations such as square root of negative numbers and arithmetic with complex numbers.

Of course, simple arithmetic with complex numbers would require an alternative functionality that differentiates them from real numbers, such as an "i" button.

This is effectively and efficiently possible using the math.js library.

issue3

Paste number into the display field

You can already copy the result number from the output field.
It would be great if you could paste in as well (not appending to the existing number but overwriting it).

With this you can skip the implementation of the memory functions, since the clipboard can be used in almost all cases instead.

Floating-point Precision errors

There were often some errors in the precision of even simple floating-point results.
For example, the application evaluated (0.2)^2 as 0.04000...01, when the application could instead simply keep it as 0.04 .

issue2

uni-code issue rendering on ipadOS

came across an issue where if server is not explicit about unicode the render will fail on an ipad - adding the below to the index.html head resolved the issue:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Screenshot of error:
IMG_E3970036501A-1

History function - Show last operation

In the Windows Calculator we have a very useful function to verify if our input was correct.
Whenever you activate an operator it puts the number and the operator above the display with smaller letters.

Even if the full history is not preserved like in Windows Calculator, just showing the last operation helps a lot to the user to see what he has calculated.

history

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.