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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:03:04+00:00 2026-06-11T06:03:04+00:00

Working on a program, and there’s one line of my code that is giving

  • 0

Working on a program, and there’s one line of my code that is giving me issues. I was wondering if anyone here may know how to fix this one line of code:

long long x;
srand(time(NULL));
x = rand() % 1000;
long long range = pow (2, 60*(pow(2,x)-1)) ;

Whenever I run this I get an error stating that there is an ambiguous call to overload.
I did some research and it seems to have to do with different types (concerning the long long). I was thinking there may be a way to cast this in a different way in order to go around this issue, however I’m unsure of how to do this.
Would anyone happen to have any suggestions on what to do in order to get the second line of code working?

EDIT: I get the following errors:

main1.cpp:149: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/usr/include/architecture/i386/math.h:343: note: candidate 1: double pow(double, double)
/usr/include/c++/4.2.1/cmath:357: note: candidate 2: float std::pow(float, float)
main1.cpp:149: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/usr/include/architecture/i386/math.h:343: note: candidate 1: double pow(double, double)
/usr/include/c++/4.2.1/cmath:357: note: candidate 2: float std::pow(float, float)

With the method that Luchian suggested the following error that appears is the following:

main1.cpp:149: error: call of overloaded 'pow(int, long long int&)' is ambiguous
/usr/include/architecture/i386/math.h:343: note: candidates are: double pow(double, double)
/usr/include/c++/4.2.1/cmath:357: note:                 float std::pow(float, float)
/usr/include/c++/4.2.1/cmath:361: note:                 long double std::pow(long double, long double)
/usr/include/c++/4.2.1/cmath:365: note:                 double std::pow(double, int)
/usr/include/c++/4.2.1/cmath:369: note:                 float std::pow(float, int)
/usr/include/c++/4.2.1/cmath:373: note:                 long double std::pow(long double, int)
  • 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-11T06:03:05+00:00Added an answer on June 11, 2026 at 6:03 am

    Use either:

    long long range = ::pow (2, 60*(::pow(2,x)-1)) ;
    

    or

    long long range = std::pow (2, 60*(std::pow(2,x)-1)) ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a program with DataGridViews . In one DatagridView there is a
I working on a program that manages documents. One of the things my app
is there any small working program for recieving from and sending data to client
I am currently working on a VB.Net program where there are two parallel multiline
I have a working program in C++ that generates data for a Mandelbrot Set.
I have an otherwise working iPhone program. A recent change means that it generates
I'm working with a program that accesses an MS-Access DB. The problem is that
I'm working a program where there's an Airline class. The Airline class contains a
I am working on a program that has a flow layout, inside are a
I am working on a program that receives search requests for a topic, makes

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.