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

  • Home
  • SEARCH
  • 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 7602349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:23:22+00:00 2026-05-30T23:23:22+00:00

Im trying to convert radians to degrees, but im not getting the same results

  • 0

Im trying to convert radians to degrees, but im not getting the same results as google

calculator and the Pi i defined dosent output all number.

If you type in google search: (1 * 180) / 3.14159265 then you get 57.2957796, but my program is

outputting: 57.2958 and if you type in google search Pi you get: 3.14159265, but mine

dosent output the rest, it output: 3.14159

My code is:

#include <iostream>
#define SHOW(X) cout << # X " = " << (X) << endl

using namespace std;

double Pi_test = 3.14159265;

float radian_to_degree(double  ENTER) {
  double Pi = 3.14159265;
  float degrees = (ENTER * 180) / Pi;
  return degrees;
}

int main (int argc, char * const argv[]) {
    SHOW( radian_to_degree(1) ); // 57.2958 not 57.2957795 like google, why?
    SHOW( Pi_test ); // output 3.14159' not 3.14159265, why? 
    return 0;
}

Please help me fix this, what wrong? any example?

  • 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-05-30T23:23:23+00:00Added an answer on May 30, 2026 at 11:23 pm

    As stated here, it may be that cout in C++ is rounding your number before displaying it. Try this:

    #define SHOW(X) cout << setprecision(some_number) << # X " = " << (X) << endl
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to convert unixtime to date but the results im getting are wrong
I'm trying convert some decimals to varchar , but they are getting rounded .
Trying to convert date to specific format but getting error: <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
I'm trying convert all special chars into HTML safe entities on their way into
Trying to convert output from a rest_client GET to the characters that are represented
Trying to convert the following but am having difficulty. Can anyone see where I'm
Trying to convert a string to NSURL and this is not happening. barcodeTextLabel.text =
trying to convert all my old mysql_* operations into new and, from what i've
I'm trying convert a bunch of pictures and videos, but when I convert it
I'm trying to convert some code that worked great in VB, but I can't

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.