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 6016613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:00:29+00:00 2026-05-23T03:00:29+00:00

I am trying to replicate the following formula from Excel in to a C#

  • 0

I am trying to replicate the following formula from Excel in to a C# app and the result is different.

The answer where x=5 should be y=55.249875 which I have just done using Windows calculator and matches to the Excel answer.. but not when I try it in C#.

For E I use Math.Exp and for x^y I use Math.Pow().

Any ideas?

Formula:

y = -1E-06x^6 + 0.0001x^5 - 0.0025x^4 + 0.0179x^3 + 0.0924x^2 - 0.6204x + 55.07
  • 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-23T03:00:29+00:00Added an answer on May 23, 2026 at 3:00 am

    This would be:

    static double Compute(double x)
    {
        return -1E-06 * Math.Pow(x, 6) 
            + 0.0001 * Math.Pow(x, 5) 
            - 0.0025 * Math.Pow(x, 4) 
            + 0.0179 * Math.Pow(x, 3) 
            + 0.0924 * Math.Pow(x, 2)
            - 0.6204 * x + 55.07;
    }
    

    Here is a fully working test program to demonstrate:

    using System;
    class Test
    {
        static double Compute(double x)
        {
            return -1E-06 * Math.Pow(x, 6) 
                + 0.0001 * Math.Pow(x, 5) 
                - 0.0025 * Math.Pow(x, 4) 
                + 0.0179 * Math.Pow(x, 3) 
                + 0.0924 * Math.Pow(x, 2)
                - 0.6204 * x + 55.07;
        }
    
        static void Main()
        {
            Console.WriteLine("Value for x {0} == {1}", 5, Compute(5));
            Console.ReadKey();
        }
    }
    

    I think the confusion was that you were assuming that -1E-06 required Math.Exp, but it does not. This is just a simple number in Scientific Notation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to replicate the following sql in Nhibernate ICriteria SELECT DISTINCT AP.ID FROM
I have been trying to replicate the buffer overflow example3 from this article aleph
I have a WCF service which I'm trying to call from a simple .NET
I am trying to replicate the following code using HTML Helper in CakePHP 2.1.
Im trying to replicate an effect as seen on http://www.fiat.co.uk/Showroom/#showroom/punto_evo/explore . I have made
Basically I'm trying to replicate YouTube's ability to begin video playback from any part
Trying to replicate the following query using Zend_Db_Select . Any pointers? SELECT compounds.id as
I'm trying to replicate the following Ninject syntax in Unity, but not having any
supposed to be I have 3 filenames file-00 file-01 file-02 I'm trying to replicate
I am trying to replicate the following social bar that is off to the

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.