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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:18:04+00:00 2026-06-01T02:18:04+00:00

private double f(double x, double zn = 1) { double X = – zn;

  • 0
private double f(double x, double zn = 1)
    {
        double X = - zn;
        X *= x * x * (x + 1);
        X *= Math.Pow((x - 2), 0.333);
        return funct ? x : X;
    }

I have this code. When I try to find Math.Pow((x-2), 0.333) – i have NaN.
How to solve it? Why NaN?

Rewritten…

private double f(double x, double zn = 1)
    {
        double answer = - zn;
        answer *= x * x * (x + 1);
        answer *= Math.Pow((x - 2), 0.333);
        return answer;
    }
  • 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-01T02:18:06+00:00Added an answer on June 1, 2026 at 2:18 am

    My guess is that you’re taking the cube root of a negative number. That seems the most likely cause, but your code is really hard to read due to having both x and X as local variables…

    After closer examination, as you’re not actually modifying x at any point, it really depends on the incoming value of x. If it’s a finite value greater than or equal to 2, it should be fine. But if x is smaller than 2, it will fail (well, return NaN) for reasons of simple maths…

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

Sidebar

Related Questions

I have a function as under private double RoundOff(object value) { return Math.Round((double)value, 2);
Here's the c# code that I have: private double get806Fees (Loan loan) { Loan.Fee.Items
i have a method that looks like this: private double GetX() { if (Servings.Count
i wrote this code: class A { public: A(){d=2.2;cout<<d;} A(double d):d(d){cout<<d;} double getD(){return d;}
Suppose I have a JAXB element like this: @XmlElement private double value; this will
I have the following code... public class Point { private double x; private double
I just wrote this code: private double PerformOperation(OperationEnum operation, double aggregateValue, double sourceValue) {
I found myself staring at code that looks similar to this: private double? _foo;
I have this class class Point2D { public: bool isValid(); // ... private: double
Suppose I have a class like this: public class Car { private double distanceDriven;

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.