Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7981779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:28:51+00:00 2026-06-04T10:28:51+00:00

one of the required work is to implement the sin button on the calculator

  • 0

one of the required work is to implement the “sin” button on the calculator
Add the following 4 operation buttons:
• sin : calculates the sine of the top operand on the stack.

here is my code

- (double)performOperation:(NSString *)operation
{
  double result = 0;

   if ([operation isEqualToString:@"+"]) {

    result = [self popOperand] + [self popOperand];

   }else if ([@"*" isEqualToString:operation]) {

    result = [self popOperand] * [self popOperand];

   }else if ([operation isEqualToString:@"-"]) {

    double subtrahend = [self popOperand];
    result = [self popOperand] - subtrahend;

   }else if ([operation isEqualToString:@"/"]) {

    double divisor = [self popOperand];
    if(divisor) result = [self popOperand] / divisor;

    }else if([operation isEqualToString:@"sin"]){

    double operd = [self popOperand];
    NSLog(@"operd=%g",operd);
    if(operd) result = sin(operd);

   }

[self pushOperand:result];

     return result;
}

I try to input sin(60) and the result=-0.304811

but actually I use calculator in windows and the result is 0.8860254

I don’t know what’s wrong with my code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:28:53+00:00Added an answer on June 4, 2026 at 10:28 am

    Windows calculator interprets 60 as degrees; your calculator interprets 60 as radians. Both answers are correct. If you want the number interpreted as degrees instead, multiply by M_PI and divide by 180.

    result = sin(M_PI*operd/180)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one application which is build using VB.NET now i required to add
I get the following error: One or more types required to compile a dynamic
Liferay migration from one server to another help required. Can anyone share there steps
I have one text box on that text box i am using required field
I am developing one app , which is required to integrate Google checkout.I am
In one of my models, I want a foreign key object to be required
I have some boiler-plate script required for a Telerik RadGrid on one of my
At work one of our target platforms is a resource constrained mini-server running Linux
I've gotten the go-ahead at work to implement LINQ to SQL for a new
I am trying to implement custom attribute validation, similar to one demonstrated here in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.