-2

If I have the following code:

#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision


int main()
{
    int128_t a = Func_a()
    int128_t b = Func_b()

    std::cout << std::max(a, b) << std::endl;
    return 0;
}

And if I compile using g++ on Ubuntu, I get the following error:

error: cannot convert ‘const boost::multiprecision::number >’ to ‘int64 {aka long long int}’ in assignment

What is the proper way to compare two int128_t numbers to see which one is greater?

EDIT: I am using std::max.

  • Where are you using `max` from? Is that some function, or is it meant to be `std::max`? – Tas Oct 23 '17 at 02:21
  • It is meant to be std::max. It is now updated. –  Oct 23 '17 at 02:28
  • 1
    The code sample is still too broken to even consider. And the question is ill-formed: http://coliru.stacked-crooked.com/a/c3675c01da00e0aa – sehe Oct 23 '17 at 11:42

1 Answers1

1

Your code (except for missing semicolons) compiles and runs without error.

However, according to your compiler message, I'm suspecting that in

int128_t a = Func_a(); // are you really sure it is int128_t?

the left-hand side is not a boost::multiprecision::int128_t, since the compiler says it is a int64.

scinart
  • 457
  • 2
  • 9