# Calculator

• Student
• Posts: 95
• Loc: UK, Middlands

3+ Months Ago

Can someone please look at this

eddielee . me / calc.html

Press 5 then . then 6

or enter any other decimal number... why does it display the first number at the end?

Please can some one help, this is driving me insane!!

Thanks
• Posts: 124
• Loc: Bangalore

3+ Months Ago

dudeking wrote:
Can someone please look at this

eddielee . me / calc.html

Press 5 then . then 6

or enter any other decimal number... why does it display the first number at the end?

Your previous problem is Looking like Solved. But i find a new problem There.

Num [*,/,+,-] Num Show a unwanted 0 after pressing any of [*,/,+,-]

• Student
• Posts: 95
• Loc: UK, Middlands

3+ Months Ago

Yeah I solved the first problem thanks, it was incrementing incorrectly after a decimal was display as decimals do not occupy a segment. Humm I see what you mean, but that is overwritten once any number is entered. Which is the same functionally provided by the calculator im basing this on. And just so your aware the - are just while im debugging it.
• Posts: 124
• Loc: Bangalore

3+ Months Ago

I just take a look at bookShop.js.

Code: [ Select ]
function _calOpp(opp)
{
if(screenVal != 0)
{
calVal1 = screenVal;
screenVal = 0;
calOpp = opp;
}
output();
}
1. function _calOpp(opp)
2. {
3.     if(screenVal != 0)
4.     {
5.         calVal1 = screenVal;
6.         screenVal = 0;
7.         calOpp = opp;
8.     }
9.     output();
10. }

What if you remove line
Code: [ Select ]
screenVal = 0;
. I think this will solve the problem
• Student
• Posts: 95
• Loc: UK, Middlands

3+ Months Ago

If I didnt reset screenVal to 0 the output would still be the same as what was previously on the screen. And if I set it to screenVal = "" it would say error because the output() function requires a value from screenVal to work.
• Student
• Posts: 95
• Loc: UK, Middlands

3+ Months Ago

I could implement a blank screen, after an operator is pressed, but my calculator im using now works how mine does. E.g. when I press 456 then + the screen says 0 and when I press any number the 0 is replaced with that number.
• Posts: 124
• Loc: Bangalore

3+ Months Ago

hmm... But a real calculator is not make it 0. It shows previous result and when new number is entered it start accepting new number. For this U can use another global var to store previous number stage.

and yeahhhh, apart from these error your calc rocks dude
• Student
• Posts: 95
• Loc: UK, Middlands

3+ Months Ago

Okay okay :p
I guess your right, I'll change it later on if im bored lol.
Thanks man

## Post Information

• Total Posts in this topic: 8 posts
• Users browsing this forum: No registered users and 59 guests
• You cannot post new topics in this forum
• You cannot reply to topics in this forum
• You cannot edit your posts in this forum
• You cannot delete your posts in this forum
• You cannot post attachments in this forum