Converting Big to long long

Hey everyone, really cool stuff you are doing here. I am sorry if this is a very 'noob' question and I'm sure I am doing something wrong but I am programming a simple C++ calculator and would like to be able to use the pow function, but it gives me an error because pow doesn't support ttmath, so I would like to convert it to long long so that pow can work with it. Many thanks, Lachlan

Code:
#include <iostream>
#include <cstdlib>
#include <math.h>
#include </Users/craigmacphee/Downloads/ttmath-0.9.3/ttmath/ttmath.h>
using namespace std;
ttmath::Big<1,2> firstNumber = 1;
ttmath::Big<1,2> secondNumber = 1;
int operation = 1;

int main()
{
cout << "Addition = 1" << endl;
cout << "Subtraction = 2" << endl;
cout << "Multiplication = 3" << endl;
cout << "Division = 4" << endl;
cout << "Squared = 5" << endl;
cout << "Square Root = 6" << endl;
cout << "Power = 7" << endl;
cout << "What operation would you like to use? "; cin >> operation;

if(operation == 1)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;
cout << "The answer is " << firstNumber + secondNumber << endl;
}

if(operation == 2)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;
cout << "The answer is " << firstNumber - secondNumber << endl;
}

if(operation == 3)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;
cout << "The answer is " << firstNumber * secondNumber << endl;
}

if(operation == 4)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;
cout << "The answer is " << firstNumber / secondNumber << endl;
}

if(operation == 5)
{
cout << "Input your number to be squared: "; cin >> firstNumber;
cout << "The answer is " << firstNumber * firstNumber << endl;
}

// ERROR LIES IN FOLLOWING TWO IF STATEMENTS
if(operation == 6)
{
cout << "Input your number to be square rooted: "; cin >> firstNumber;
Big::ToDouble(double & out)
double firstNumber;
ttresult.ToDouble(firstNumber)
cout << "The answer is " << pow(firstNumber, secondNumber) << endl;
}

if(operation == 7)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;
cout << "The answer is " << pow(firstNumber, secondNumber) << endl;
}
}

Added by: tomek, 2017 VI 18

if(operation == 6)
{
cout << "Input your number to be square rooted: "; cin >> firstNumber;
ttmath::ErrorCode err;
ttmath::Big<1,2> two = 2;
ttmath::Big<1,2> result = ttmath::Root(firstNumber, two, &err);

if( err == ttmath::err_ok )
    cout << "The answer is " << result << endl;
else
    cout << "incorrect argument or overflow" << endl;
}

if(operation == 7)
{
cout << "Input your first number: "; cin >> firstNumber;
cout << "Input your second number: "; cin >> secondNumber;

int carry = firstNumber.Pow(secondNumber);

if( carry == 0 )
    cout << "The answer is " << firstNumber << endl;
else
    cout << "incorrect argument or overflow" << endl;
}

Added by: ~Ee, 2023 VII 10

Ww

Added by: ~Nick, 2023 VII 10

Added by: ~Nick, 2023 VII 10

212