/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: Soonho Kong
*/
#include "util/test.h"
#include "util/trace.h"
#include "util/numerics/mpfp.h"
#include "util/interval/interval.h"
#include "tests/util/interval/check.h"

using namespace lean;

using std::cout;
using std::endl;

typedef interval<mpfp> fi;

static void mpfp_interval_arith() {
    fi i1(1.0, 2.0);
    fi i2(3.0, 4.0);
    fi i3(-10.0, -5.0);
    fi i4(-3.0, +4.0);
    fi i5(5.0, 8.0);

    mpfp c1(0.6);
    mpfp c2(3.0);
    mpfp c3(0.0);
    mpfp c4(-4.5);
    mpfp c5(-0.3);

    cout << "=====================" << endl;
    print_result(i1, "+", c1, i1 + c1);
    print_result(i2, "+", c2, i2 + c2);
    print_result(i3, "+", c3, i3 + c3);
    print_result(i4, "+", c4, i4 + c4);
    print_result(i5, "+", c5, i5 + c5);
    print_result(i5, "+", c1, i5 + c1);
    print_result(i4, "+", c2, i4 + c2);
    print_result(i2, "+", c4, i2 + c4);
    print_result(i1, "+", c5, i1 + c5);

    cout << "=====================" << endl;
    print_result(c1, "+", i1, c1 + i1);
    print_result(c2, "+", i2, c2 + i2);
    print_result(c3, "+", i3, c3 + i3);
    print_result(c4, "+", i4, c4 + i4);
    print_result(c5, "+", i5, c5 + i5);
    print_result(c5, "+", i1, c5 + i1);
    print_result(c4, "+", i2, c4 + i2);
    print_result(c2, "+", i4, c2 + i4);
    print_result(c1, "+", i5, c1 + i5);

    cout << "=====================" << endl;
    print_result(i1, "-", c1, i1 - c1);
    print_result(i2, "-", c2, i2 - c2);
    print_result(i3, "-", c3, i3 - c3);
    print_result(i4, "-", c4, i4 - c4);
    print_result(i5, "-", c5, i5 - c5);
    print_result(i5, "-", c1, i5 - c1);
    print_result(i4, "-", c2, i4 - c2);
    print_result(i2, "-", c4, i2 - c4);
    print_result(i1, "-", c5, i1 - c5);

    cout << "=====================" << endl;
    print_result(c1, "-", i1, c1 - i1);
    print_result(c2, "-", i2, c2 - i2);
    print_result(c3, "-", i3, c3 - i3);
    print_result(c4, "-", i4, c4 - i4);
    print_result(c5, "-", i5, c5 - i5);
    print_result(c5, "-", i1, c5 - i1);
    print_result(c4, "-", i2, c4 - i2);
    print_result(c2, "-", i4, c2 - i4);
    print_result(c1, "-", i5, c1 - i5);

    cout << "=====================" << endl;
    print_result(i1, "*", c1, i1 * c1);
    print_result(i2, "*", c2, i2 * c2);
    print_result(i3, "*", c3, i3 * c3);
    print_result(i4, "*", c4, i4 * c4);
    print_result(i5, "*", c5, i5 * c5);
    print_result(i5, "*", c1, i5 * c1);
    print_result(i4, "*", c2, i4 * c2);
    print_result(i2, "*", c4, i2 * c4);
    print_result(i1, "*", c5, i1 * c5);

    cout << "=====================" << endl;
    print_result(c1, "*", i1, c1 * i1);
    print_result(c2, "*", i2, c2 * i2);
    print_result(c3, "*", i3, c3 * i3);
    print_result(c4, "*", i4, c4 * i4);
    print_result(c5, "*", i5, c5 * i5);
    print_result(c5, "*", i1, c5 * i1);
    print_result(c4, "*", i2, c4 * i2);
    print_result(c2, "*", i4, c2 * i4);
    print_result(c1, "*", i5, c1 * i5);

    cout << "=====================" << endl;
    print_result(i1, "/", c1, i1 / c1);
    print_result(i2, "/", c2, i2 / c2);
    print_result(i3, "/", c3, i3 / c3);
    print_result(i4, "/", c4, i4 / c4);
    print_result(i5, "/", c5, i5 / c5);
    print_result(i5, "/", c1, i5 / c1);
    print_result(i4, "/", c2, i4 / c2);
    print_result(i2, "/", c4, i2 / c4);
    print_result(i1, "/", c5, i1 / c5);

    cout << "=====================" << endl;
    print_result(c1, "/", i1, c1 / i1);
    print_result(c2, "/", i2, c2 / i2);
    print_result(c3, "/", i3, c3 / i3);
    print_result(c5, "/", i5, c5 / i5);
    print_result(c5, "/", i1, c5 / i1);
    print_result(c4, "/", i2, c4 / i2);
    print_result(c1, "/", i5, c1 / i5);
}

static void mpfp_interval_inf1() {
    fi i1(1.0, 2.0);
    fi inf;
    fi ozero_pinf;
    fi ozero_ninf;
    ozero_pinf.set_is_lower_inf(false);
    ozero_ninf.set_is_upper_inf(false);
    fi czero_pinf;
    fi czero_ninf;
    czero_pinf.set_is_lower_inf(false);
    czero_pinf.set_is_lower_open(false);
    czero_ninf.set_is_upper_inf(false);
    czero_ninf.set_is_upper_open(false);

    cout << i1 << " * " << ozero_ninf << " = " << i1 * ozero_ninf << endl;
    cout << i1 << " * " << ozero_pinf << " = " << i1 * ozero_pinf << endl;
    cout << i1 << " * " << czero_ninf << " = " << i1 * czero_ninf << endl;
    cout << i1 << " * " << czero_pinf << " = " << i1 * czero_pinf << endl;
    lean_assert(i1 * ozero_ninf == ozero_ninf); lean_assert(ozero_ninf * i1 == ozero_ninf);
    lean_assert(i1 * ozero_pinf == ozero_pinf); lean_assert(ozero_pinf * i1 == ozero_pinf);
    lean_assert(i1 * czero_ninf == czero_ninf); lean_assert(czero_ninf * i1 == czero_ninf);
    lean_assert(i1 * czero_pinf == czero_pinf); lean_assert(czero_pinf * i1 == czero_pinf);

    cout << "=== Addition between [0, +oo), (-oo, 0], (0, +oo), (-oo, 0) ===" << endl;
    cout << ozero_ninf << " + " << ozero_ninf << " = " << ozero_ninf + ozero_ninf << endl;
    cout << ozero_ninf << " + " << ozero_pinf << " = " << ozero_ninf + ozero_pinf << endl;
    cout << ozero_ninf << " + " << czero_ninf << " = " << ozero_ninf + czero_ninf << endl;
    cout << ozero_ninf << " + " << czero_pinf << " = " << ozero_ninf + czero_pinf << endl;
    cout << ozero_pinf << " + " << ozero_ninf << " = " << ozero_pinf + ozero_ninf << endl;
    cout << ozero_pinf << " + " << ozero_pinf << " = " << ozero_pinf + ozero_pinf << endl;
    cout << ozero_pinf << " + " << czero_ninf << " = " << ozero_pinf + czero_ninf << endl;
    cout << ozero_pinf << " + " << czero_pinf << " = " << ozero_pinf + czero_pinf << endl;
    cout << czero_ninf << " + " << ozero_ninf << " = " << czero_ninf + ozero_ninf << endl;
    cout << czero_ninf << " + " << ozero_pinf << " = " << czero_ninf + ozero_pinf << endl;
    cout << czero_ninf << " + " << czero_ninf << " = " << czero_ninf + czero_ninf << endl;
    cout << czero_ninf << " + " << czero_pinf << " = " << czero_ninf + czero_pinf << endl;
    cout << czero_pinf << " + " << ozero_ninf << " = " << czero_pinf + ozero_ninf << endl;
    cout << czero_pinf << " + " << ozero_pinf << " = " << czero_pinf + ozero_pinf << endl;
    cout << czero_pinf << " + " << czero_ninf << " = " << czero_pinf + czero_ninf << endl;
    cout << czero_pinf << " + " << czero_pinf << " = " << czero_pinf + czero_pinf << endl;

    lean_assert(ozero_ninf + ozero_ninf == ozero_ninf);
    lean_assert(ozero_ninf + ozero_pinf == inf);
    lean_assert(ozero_ninf + czero_ninf == ozero_ninf);
    lean_assert(ozero_ninf + czero_pinf == inf);
    lean_assert(ozero_pinf + ozero_ninf == inf);
    lean_assert(ozero_pinf + ozero_pinf == ozero_pinf);
    lean_assert(ozero_pinf + czero_ninf == inf);
    lean_assert(ozero_pinf + czero_pinf == ozero_pinf);
    lean_assert(czero_ninf + ozero_ninf == ozero_ninf);
    lean_assert(czero_ninf + ozero_pinf == inf);
    lean_assert(czero_ninf + czero_ninf == czero_ninf);
    lean_assert(czero_ninf + czero_pinf == inf);
    lean_assert(czero_pinf + ozero_ninf == inf);
    lean_assert(czero_pinf + ozero_pinf == ozero_pinf);
    lean_assert(czero_pinf + czero_ninf == inf);
    lean_assert(czero_pinf + czero_pinf == czero_pinf);

    cout << "=== Subtraction between [0, +oo), (-oo, 0], (0, +oo), (-oo, 0) ===" << endl;
    cout << ozero_ninf << " - " << ozero_ninf << " = " << ozero_ninf - ozero_ninf << endl;
    cout << ozero_ninf << " - " << ozero_pinf << " = " << ozero_ninf - ozero_pinf << endl;
    cout << ozero_ninf << " - " << czero_ninf << " = " << ozero_ninf - czero_ninf << endl;
    cout << ozero_ninf << " - " << czero_pinf << " = " << ozero_ninf - czero_pinf << endl;
    cout << ozero_pinf << " - " << ozero_ninf << " = " << ozero_pinf - ozero_ninf << endl;
    cout << ozero_pinf << " - " << ozero_pinf << " = " << ozero_pinf - ozero_pinf << endl;
    cout << ozero_pinf << " - " << czero_ninf << " = " << ozero_pinf - czero_ninf << endl;
    cout << ozero_pinf << " - " << czero_pinf << " = " << ozero_pinf - czero_pinf << endl;
    cout << czero_ninf << " - " << ozero_ninf << " = " << czero_ninf - ozero_ninf << endl;
    cout << czero_ninf << " - " << ozero_pinf << " = " << czero_ninf - ozero_pinf << endl;
    cout << czero_ninf << " - " << czero_ninf << " = " << czero_ninf - czero_ninf << endl;
    cout << czero_ninf << " - " << czero_pinf << " = " << czero_ninf - czero_pinf << endl;
    cout << czero_pinf << " - " << ozero_ninf << " = " << czero_pinf - ozero_ninf << endl;
    cout << czero_pinf << " - " << ozero_pinf << " = " << czero_pinf - ozero_pinf << endl;
    cout << czero_pinf << " - " << czero_ninf << " = " << czero_pinf - czero_ninf << endl;
    cout << czero_pinf << " - " << czero_pinf << " = " << czero_pinf - czero_pinf << endl;

    lean_assert(ozero_ninf - ozero_ninf == inf);
    lean_assert(ozero_ninf - ozero_pinf == ozero_ninf);
    lean_assert(ozero_ninf - czero_ninf == inf);
    lean_assert(ozero_ninf - czero_pinf == ozero_ninf);
    lean_assert(ozero_pinf - ozero_ninf == ozero_pinf);
    lean_assert(ozero_pinf - ozero_pinf == inf);
    lean_assert(ozero_pinf - czero_ninf == ozero_pinf);
    lean_assert(ozero_pinf - czero_pinf == inf);
    lean_assert(czero_ninf - ozero_ninf == inf);
    lean_assert(czero_ninf - ozero_pinf == ozero_ninf);
    lean_assert(czero_ninf - czero_ninf == inf);
    lean_assert(czero_ninf - czero_pinf == czero_ninf);
    lean_assert(czero_pinf - ozero_ninf == ozero_pinf);
    lean_assert(czero_pinf - ozero_pinf == inf);
    lean_assert(czero_pinf - czero_ninf == czero_pinf);
    lean_assert(czero_pinf - czero_pinf == inf);

    cout << "=== Multiplication between [0, +oo), (-oo, 0], (0, +oo), (-oo, 0) ===" << endl;
    cout << ozero_ninf << " * " << ozero_ninf << " = " << ozero_ninf * ozero_ninf << endl;
    cout << ozero_ninf << " * " << ozero_pinf << " = " << ozero_ninf * ozero_pinf << endl;
    cout << ozero_ninf << " * " << czero_ninf << " = " << ozero_ninf * czero_ninf << endl;
    cout << ozero_ninf << " * " << czero_pinf << " = " << ozero_ninf * czero_pinf << endl;
    cout << ozero_pinf << " * " << ozero_ninf << " = " << ozero_pinf * ozero_ninf << endl;
    cout << ozero_pinf << " * " << ozero_pinf << " = " << ozero_pinf * ozero_pinf << endl;
    cout << ozero_pinf << " * " << czero_ninf << " = " << ozero_pinf * czero_ninf << endl;
    cout << ozero_pinf << " * " << czero_pinf << " = " << ozero_pinf * czero_pinf << endl;
    cout << czero_ninf << " * " << ozero_ninf << " = " << czero_ninf * ozero_ninf << endl;
    cout << czero_ninf << " * " << ozero_pinf << " = " << czero_ninf * ozero_pinf << endl;
    cout << czero_ninf << " * " << czero_ninf << " = " << czero_ninf * czero_ninf << endl;
    cout << czero_ninf << " * " << czero_pinf << " = " << czero_ninf * czero_pinf << endl;
    cout << czero_pinf << " * " << ozero_ninf << " = " << czero_pinf * ozero_ninf << endl;
    cout << czero_pinf << " * " << ozero_pinf << " = " << czero_pinf * ozero_pinf << endl;
    cout << czero_pinf << " * " << czero_ninf << " = " << czero_pinf * czero_ninf << endl;
    cout << czero_pinf << " * " << czero_pinf << " = " << czero_pinf * czero_pinf << endl;

    lean_assert(ozero_ninf * ozero_ninf == ozero_pinf);
    lean_assert(ozero_ninf * ozero_pinf == ozero_ninf);
    lean_assert(ozero_ninf * czero_ninf == czero_pinf);
    lean_assert(ozero_ninf * czero_pinf == czero_ninf);
    lean_assert(ozero_pinf * ozero_ninf == ozero_ninf);
    lean_assert(ozero_pinf * ozero_pinf == ozero_pinf);
    lean_assert(ozero_pinf * czero_ninf == czero_ninf);
    lean_assert(ozero_pinf * czero_pinf == czero_pinf);
    lean_assert(czero_ninf * ozero_ninf == czero_pinf);
    lean_assert(czero_ninf * ozero_pinf == czero_ninf);
    lean_assert(czero_ninf * czero_ninf == czero_pinf);
    lean_assert(czero_ninf * czero_pinf == czero_ninf);
    lean_assert(czero_pinf * ozero_ninf == czero_ninf);
    lean_assert(czero_pinf * ozero_pinf == czero_pinf);
    lean_assert(czero_pinf * czero_ninf == czero_ninf);
    lean_assert(czero_pinf * czero_pinf == czero_pinf);

    cout << "=== Division between [0, +oo), (-oo, 0], (0, +oo), (-oo, 0) ===" << endl;
    cout << ozero_ninf << " / " << ozero_ninf << " = " << ozero_ninf / ozero_ninf << endl;
    cout << ozero_ninf << " / " << ozero_pinf << " = " << ozero_ninf / ozero_pinf << endl;
    cout << ozero_pinf << " / " << ozero_ninf << " = " << ozero_pinf / ozero_ninf << endl;
    cout << ozero_pinf << " / " << ozero_pinf << " = " << ozero_pinf / ozero_pinf << endl;
    cout << czero_ninf << " / " << ozero_ninf << " = " << czero_ninf / ozero_ninf << endl;
    cout << czero_ninf << " / " << ozero_pinf << " = " << czero_ninf / ozero_pinf << endl;
    cout << czero_pinf << " / " << ozero_ninf << " = " << czero_pinf / ozero_ninf << endl;
    cout << czero_pinf << " / " << ozero_pinf << " = " << czero_pinf / ozero_pinf << endl;

    lean_assert(ozero_ninf / ozero_ninf == ozero_pinf);
    lean_assert(ozero_ninf / ozero_pinf == ozero_ninf);
    lean_assert(ozero_pinf / ozero_ninf == ozero_ninf);
    lean_assert(ozero_pinf / ozero_pinf == ozero_pinf);
    lean_assert(czero_ninf / ozero_ninf == czero_pinf);
    lean_assert(czero_ninf / ozero_pinf == czero_ninf);
    lean_assert(czero_pinf / ozero_ninf == czero_ninf);
    lean_assert(czero_pinf / ozero_pinf == czero_pinf);
}

static void mpfp_interval_inf2() {
    fi i1(1.0, 2.0);
    fi i2(3.0, 4.0);
    fi i3(-10.0, -5.0);
    fi i4(-3.0, +4.0);
    fi i5(5.0, 8.0);
    fi inf;

    mpfp c1(0.6);
    mpfp c2(3.0);
    mpfp c3(-0.3);
    mpfp c4(-4.5);
    mpfp zero(0.0);

    lean_assert(i1 + inf == inf);   lean_assert(inf + i1 == inf);
    lean_assert(i2 + inf == inf);   lean_assert(inf + i2 == inf);
    lean_assert(i3 + inf == inf);   lean_assert(inf + i3 == inf);
    lean_assert(i4 + inf == inf);   lean_assert(inf + i4 == inf);
    lean_assert(i5 + inf == inf);   lean_assert(inf + i5 == inf);
    lean_assert(c1 + inf == inf);   lean_assert(inf + c1 == inf);
    lean_assert(c2 + inf == inf);   lean_assert(inf + c2 == inf);
    lean_assert(c3 + inf == inf);   lean_assert(inf + c3 == inf);
    lean_assert(c4 + inf == inf);   lean_assert(inf + c4 == inf);
    lean_assert(zero + inf == inf); lean_assert(inf + zero == inf);

    lean_assert(i1 - inf == inf);   lean_assert(inf - i1 == inf);
    lean_assert(i2 - inf == inf);   lean_assert(inf - i2 == inf);
    lean_assert(i3 - inf == inf);   lean_assert(inf - i3 == inf);
    lean_assert(i4 - inf == inf);   lean_assert(inf - i4 == inf);
    lean_assert(i5 - inf == inf);   lean_assert(inf - i5 == inf);
    lean_assert(c1 - inf == inf);   lean_assert(inf - c1 == inf);
    lean_assert(c2 - inf == inf);   lean_assert(inf - c2 == inf);
    lean_assert(c3 - inf == inf);   lean_assert(inf - c3 == inf);
    lean_assert(c4 - inf == inf);   lean_assert(inf - c4 == inf);
    lean_assert(zero - inf == inf); lean_assert(inf - zero == inf);

    lean_assert(i1 * inf == inf);    lean_assert(inf * i1 == inf);
    lean_assert(i2 * inf == inf);    lean_assert(inf * i2 == inf);
    lean_assert(i3 * inf == inf);    lean_assert(inf * i3 == inf);
    lean_assert(i4 * inf == inf);    lean_assert(inf * i4 == inf);
    lean_assert(i5 * inf == inf);    lean_assert(inf * i5 == inf);
    lean_assert(c1 * inf == inf);    lean_assert(inf * c1 == inf);
    lean_assert(c2 * inf == inf);    lean_assert(inf * c2 == inf);
    lean_assert(c3 * inf == inf);    lean_assert(inf * c3 == inf);
    lean_assert(c4 * inf == inf);    lean_assert(inf * c4 == inf);
    lean_assert(zero * inf == zero); lean_assert(inf * zero == zero);
}

static void mpfp_interval_trans() {
    fi i1(1.0, 2.0);
    fi i2(3.0, 4.0);
    fi i3(-10.0, -5.0);
    fi i4(-3.0, +4.0);
    fi i5(5.0, 8.0);
    fi i6(0.3, 1.67);
    fi i7(1.8, 3.5);
    fi i8(3.5, 4.9);
    fi i9(-3.15, -2.0);
    fi i10(-0.99, 0.5);
    fi i11(-0.8, -0.5);
    fi i12(-0.3, 0.2);
    fi i13(0.5, 0.9);
    fi i14(-0.1, 0.8);
    fi i15(-0.4, -0.3);

    fi oi1(1.0, 2.0);
    fi oi2(3.0, 4.0);
    fi oi3(-10.0, -5.0);
    fi oi4(-3.0, +4.0);
    fi oi5(5.0, 8.0);
    fi oi6(0.3, 1.67);
    fi oi7(1.8, 3.5);
    fi oi8(3.5, 4.9);
    fi oi9(-3.15, -2.0);
    fi oi10(-3.19, -1.0);
    fi oi11(-0.8, -0.5);
    fi oi12(-0.3, 0.2);
    fi oi13(0.5, 0.9);
    fi oi14(-0.1, 0.8);
    fi oi15(-0.4, -0.3);

    oi1.set_is_lower_open(true);  oi1.set_is_upper_open(true);
    oi2.set_is_lower_open(true);  oi2.set_is_upper_open(true);
    oi3.set_is_lower_open(true);  oi3.set_is_upper_open(true);
    oi4.set_is_lower_open(true);  oi4.set_is_upper_open(true);
    oi5.set_is_lower_open(true);  oi5.set_is_upper_open(true);
    oi6.set_is_lower_open(true);  oi6.set_is_upper_open(true);
    oi7.set_is_lower_open(true);  oi7.set_is_upper_open(true);
    oi8.set_is_lower_open(true);  oi8.set_is_upper_open(true);
    oi9.set_is_lower_open(true);  oi9.set_is_upper_open(true);
    oi10.set_is_lower_open(true); oi10.set_is_upper_open(true);
    oi11.set_is_lower_open(true); oi11.set_is_upper_open(true);
    oi12.set_is_lower_open(true); oi12.set_is_upper_open(true);
    oi13.set_is_lower_open(true); oi13.set_is_upper_open(true);
    oi14.set_is_lower_open(true); oi14.set_is_upper_open(true);
    oi15.set_is_lower_open(true); oi15.set_is_upper_open(true);

    fi inf;
    fi ozero_pinf;
    fi ozero_ninf;
    ozero_pinf.set_is_lower_inf(false);
    ozero_ninf.set_is_upper_inf(false);
    fi czero_pinf;
    fi czero_ninf;
    czero_pinf.set_is_lower_inf(false);
    czero_pinf.set_is_lower_open(false);
    czero_ninf.set_is_upper_inf(false);
    czero_ninf.set_is_upper_open(false);

    mpfp c1(0.6);
    mpfp c2(3.0);
    mpfp c3(0.0);
    mpfp c4(-4.5);
    mpfp c5(-0.3);

    cout << "=====================" << endl;
    check_bop(mpfp, power, i1, 3lu);
    check_bop(mpfp, power, i2, 3lu);
    check_bop(mpfp, power, i3, 3lu);
    check_bop(mpfp, power, i4, 3lu);
    check_bop(mpfp, power, i5, 3lu);
    check_bop(mpfp, power, i6, 3lu);
    check_bop(mpfp, power, i7, 3lu);
    check_bop(mpfp, power, i8, 3lu);
    check_bop(mpfp, power, i9, 3lu);
    check_bop(mpfp, power, i10, 3lu);
    check_bop(mpfp, power, i11, 3lu);
    check_bop(mpfp, power, i12, 3lu);
    check_bop(mpfp, power, i13, 3lu);
    check_bop(mpfp, power, i14, 3lu);
    check_bop(mpfp, power, i15, 3lu);
    check_bop(mpfp, power, oi1, 3lu);
    check_bop(mpfp, power, oi2, 3lu);
    check_bop(mpfp, power, oi3, 3lu);
    check_bop(mpfp, power, oi4, 3lu);
    check_bop(mpfp, power, oi5, 3lu);
    check_bop(mpfp, power, oi6, 3lu);
    check_bop(mpfp, power, oi7, 3lu);
    check_bop(mpfp, power, oi8, 3lu);
    check_bop(mpfp, power, oi9, 3lu);
    check_bop(mpfp, power, oi10, 3lu);
    check_bop(mpfp, power, oi11, 3lu);
    check_bop(mpfp, power, oi12, 3lu);
    check_bop(mpfp, power, oi13, 3lu);
    check_bop(mpfp, power, oi14, 3lu);
    check_bop(mpfp, power, oi15, 3lu);
    check_bop(mpfp, power, inf, 3lu);
    check_bop(mpfp, power, ozero_ninf, 3lu);
    check_bop(mpfp, power, ozero_pinf, 3lu);
    check_bop(mpfp, power, czero_ninf, 3lu);
    check_bop(mpfp, power, czero_pinf, 3lu);

    cout << "=====================" << endl;
    check_uop(mpfp, exp, i1);
    check_uop(mpfp, exp, i2);
    check_uop(mpfp, exp, i3);
    check_uop(mpfp, exp, i4);
    check_uop(mpfp, exp, i5);
    check_uop(mpfp, exp, i6);
    check_uop(mpfp, exp, i7);
    check_uop(mpfp, exp, i8);
    check_uop(mpfp, exp, i9);
    check_uop(mpfp, exp, i10);
    check_uop(mpfp, exp, i11);
    check_uop(mpfp, exp, i12);
    check_uop(mpfp, exp, i13);
    check_uop(mpfp, exp, i14);
    check_uop(mpfp, exp, i15);
    check_uop(mpfp, exp, oi1);
    check_uop(mpfp, exp, oi2);
    check_uop(mpfp, exp, oi3);
    check_uop(mpfp, exp, oi4);
    check_uop(mpfp, exp, oi5);
    check_uop(mpfp, exp, oi6);
    check_uop(mpfp, exp, oi7);
    check_uop(mpfp, exp, oi8);
    check_uop(mpfp, exp, oi9);
    check_uop(mpfp, exp, oi10);
    check_uop(mpfp, exp, oi11);
    check_uop(mpfp, exp, oi12);
    check_uop(mpfp, exp, oi13);
    check_uop(mpfp, exp, oi14);
    check_uop(mpfp, exp, oi15);
    check_uop(mpfp, exp, inf);
    check_uop(mpfp, exp, ozero_pinf);
    check_uop(mpfp, exp, ozero_ninf);
    check_uop(mpfp, exp, czero_pinf);
    check_uop(mpfp, exp, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, exp2, i1);
    check_uop(mpfp, exp2, i2);
    check_uop(mpfp, exp2, i3);
    check_uop(mpfp, exp2, i4);
    check_uop(mpfp, exp2, i5);
    check_uop(mpfp, exp2, i6);
    check_uop(mpfp, exp2, i7);
    check_uop(mpfp, exp2, i8);
    check_uop(mpfp, exp2, i9);
    check_uop(mpfp, exp2, i10);
    check_uop(mpfp, exp2, i11);
    check_uop(mpfp, exp2, i12);
    check_uop(mpfp, exp2, i13);
    check_uop(mpfp, exp2, i14);
    check_uop(mpfp, exp2, i15);
    check_uop(mpfp, exp2, oi1);
    check_uop(mpfp, exp2, oi2);
    check_uop(mpfp, exp2, oi3);
    check_uop(mpfp, exp2, oi4);
    check_uop(mpfp, exp2, oi5);
    check_uop(mpfp, exp2, oi6);
    check_uop(mpfp, exp2, oi7);
    check_uop(mpfp, exp2, oi8);
    check_uop(mpfp, exp2, oi9);
    check_uop(mpfp, exp2, oi10);
    check_uop(mpfp, exp2, oi11);
    check_uop(mpfp, exp2, oi12);
    check_uop(mpfp, exp2, oi13);
    check_uop(mpfp, exp2, oi14);
    check_uop(mpfp, exp2, oi15);
    check_uop(mpfp, exp2, inf);
    check_uop(mpfp, exp2, ozero_pinf);
    check_uop(mpfp, exp2, ozero_ninf);
    check_uop(mpfp, exp2, czero_pinf);
    check_uop(mpfp, exp2, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, exp10, i1);
    check_uop(mpfp, exp10, i2);
    check_uop(mpfp, exp10, i3);
    check_uop(mpfp, exp10, i4);
    check_uop(mpfp, exp10, i5);
    check_uop(mpfp, exp10, i6);
    check_uop(mpfp, exp10, i7);
    check_uop(mpfp, exp10, i8);
    check_uop(mpfp, exp10, i9);
    check_uop(mpfp, exp10, i10);
    check_uop(mpfp, exp10, i11);
    check_uop(mpfp, exp10, i12);
    check_uop(mpfp, exp10, i13);
    check_uop(mpfp, exp10, i14);
    check_uop(mpfp, exp10, i15);
    check_uop(mpfp, exp10, oi1);
    check_uop(mpfp, exp10, oi2);
    check_uop(mpfp, exp10, oi3);
    check_uop(mpfp, exp10, oi4);
    check_uop(mpfp, exp10, oi5);
    check_uop(mpfp, exp10, oi6);
    check_uop(mpfp, exp10, oi7);
    check_uop(mpfp, exp10, oi8);
    check_uop(mpfp, exp10, oi9);
    check_uop(mpfp, exp10, oi10);
    check_uop(mpfp, exp10, oi11);
    check_uop(mpfp, exp10, oi12);
    check_uop(mpfp, exp10, oi13);
    check_uop(mpfp, exp10, oi14);
    check_uop(mpfp, exp10, oi15);
    check_uop(mpfp, exp10, inf);
    check_uop(mpfp, exp10, ozero_pinf);
    check_uop(mpfp, exp10, ozero_ninf);
    check_uop(mpfp, exp10, czero_pinf);
    check_uop(mpfp, exp10, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, log, i1);
    check_uop(mpfp, log, i2);
    check_uop(mpfp, log, i5);
    check_uop(mpfp, log, i6);
    check_uop(mpfp, log, i7);
    check_uop(mpfp, log, i8);
    check_uop(mpfp, log, oi1);
    check_uop(mpfp, log, oi2);
    check_uop(mpfp, log, oi5);
    check_uop(mpfp, log, oi6);
    check_uop(mpfp, log, oi7);
    check_uop(mpfp, log, oi8);
    check_uop(mpfp, log, ozero_pinf);

    cout << "=====================" << endl;
    check_uop(mpfp, log2, i1);
    check_uop(mpfp, log2, i2);
    check_uop(mpfp, log2, i5);
    check_uop(mpfp, log2, i6);
    check_uop(mpfp, log2, i7);
    check_uop(mpfp, log2, i8);
    check_uop(mpfp, log2, oi1);
    check_uop(mpfp, log2, oi2);
    check_uop(mpfp, log2, oi5);
    check_uop(mpfp, log2, oi6);
    check_uop(mpfp, log2, oi7);
    check_uop(mpfp, log2, oi8);
    check_uop(mpfp, log2, ozero_pinf);

    cout << "=====================" << endl;
    check_uop(mpfp, log10, i1);
    check_uop(mpfp, log10, i2);
    check_uop(mpfp, log10, i5);
    check_uop(mpfp, log10, i6);
    check_uop(mpfp, log10, i7);
    check_uop(mpfp, log10, i8);
    check_uop(mpfp, log10, oi1);
    check_uop(mpfp, log10, oi2);
    check_uop(mpfp, log10, oi5);
    check_uop(mpfp, log10, oi6);
    check_uop(mpfp, log10, oi7);
    check_uop(mpfp, log10, oi8);
    check_uop(mpfp, log10, ozero_pinf);

    cout << "=====================" << endl;
    check_uop(mpfp, sin, i1);
    check_uop(mpfp, sin, i2);
    check_uop(mpfp, sin, i3);
    check_uop(mpfp, sin, i4);
    check_uop(mpfp, sin, i5);
    check_uop(mpfp, sin, i6);
    check_uop(mpfp, sin, i7);
    check_uop(mpfp, sin, i8);
    check_uop(mpfp, sin, i9);
    check_uop(mpfp, sin, i10);
    check_uop(mpfp, sin, i11);
    check_uop(mpfp, sin, i12);
    check_uop(mpfp, sin, i13);
    check_uop(mpfp, sin, i14);
    check_uop(mpfp, sin, i15);
    check_uop(mpfp, sin, oi1);
    check_uop(mpfp, sin, oi2);
    check_uop(mpfp, sin, oi3);
    check_uop(mpfp, sin, oi4);
    check_uop(mpfp, sin, oi5);
    check_uop(mpfp, sin, oi6);
    check_uop(mpfp, sin, oi7);
    check_uop(mpfp, sin, oi8);
    check_uop(mpfp, sin, oi9);
    check_uop(mpfp, sin, oi10);
    check_uop(mpfp, sin, oi11);
    check_uop(mpfp, sin, oi12);
    check_uop(mpfp, sin, oi13);
    check_uop(mpfp, sin, oi14);
    check_uop(mpfp, sin, oi15);
    check_uop(mpfp, sin, inf);
    check_uop(mpfp, sin, ozero_pinf);
    check_uop(mpfp, sin, ozero_ninf);
    check_uop(mpfp, sin, czero_pinf);
    check_uop(mpfp, sin, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, cos, i1);
    check_uop(mpfp, cos, i2);
    check_uop(mpfp, cos, i3);
    check_uop(mpfp, cos, i4);
    check_uop(mpfp, cos, i5);
    check_uop(mpfp, cos, i6);
    check_uop(mpfp, cos, i7);
    check_uop(mpfp, cos, i8);
    check_uop(mpfp, cos, i9);
    check_uop(mpfp, cos, i10);
    check_uop(mpfp, cos, i11);
    check_uop(mpfp, cos, i12);
    check_uop(mpfp, cos, i13);
    check_uop(mpfp, cos, i14);
    check_uop(mpfp, cos, i15);
    check_uop(mpfp, cos, oi1);
    check_uop(mpfp, cos, oi2);
    check_uop(mpfp, cos, oi3);
    check_uop(mpfp, cos, oi4);
    check_uop(mpfp, cos, oi5);
    check_uop(mpfp, cos, oi6);
    check_uop(mpfp, cos, oi7);
    check_uop(mpfp, cos, oi8);
    check_uop(mpfp, cos, oi9);
    check_uop(mpfp, cos, oi10);
    check_uop(mpfp, cos, oi11);
    check_uop(mpfp, cos, oi12);
    check_uop(mpfp, cos, oi13);
    check_uop(mpfp, cos, oi14);
    check_uop(mpfp, cos, oi15);
    check_uop(mpfp, cos, inf);
    check_uop(mpfp, cos, ozero_pinf);
    check_uop(mpfp, cos, ozero_ninf);
    check_uop(mpfp, cos, czero_pinf);
    check_uop(mpfp, cos, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, tan, i1);
    check_uop(mpfp, tan, i2);
    check_uop(mpfp, tan, i3);
    check_uop(mpfp, tan, i4);
    check_uop(mpfp, tan, i5);
    check_uop(mpfp, tan, i6);
    check_uop(mpfp, tan, i7);
    check_uop(mpfp, tan, i8);
    check_uop(mpfp, tan, i9);
    check_uop(mpfp, tan, i10);
    check_uop(mpfp, tan, i11);
    check_uop(mpfp, tan, i12);
    check_uop(mpfp, tan, i13);
    check_uop(mpfp, tan, i14);
    check_uop(mpfp, tan, i15);
    check_uop(mpfp, tan, oi1);
    check_uop(mpfp, tan, oi2);
    check_uop(mpfp, tan, oi3);
    check_uop(mpfp, tan, oi4);
    check_uop(mpfp, tan, oi5);
    check_uop(mpfp, tan, oi6);
    check_uop(mpfp, tan, oi7);
    check_uop(mpfp, tan, oi8);
    check_uop(mpfp, tan, oi9);
    check_uop(mpfp, tan, oi10);
    check_uop(mpfp, tan, oi11);
    check_uop(mpfp, tan, oi12);
    check_uop(mpfp, tan, oi13);
    check_uop(mpfp, tan, oi14);
    check_uop(mpfp, tan, oi15);
    check_uop(mpfp, tan, inf);
    check_uop(mpfp, tan, ozero_pinf);
    check_uop(mpfp, tan, ozero_ninf);
    check_uop(mpfp, tan, czero_pinf);
    check_uop(mpfp, tan, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, asin, i11);
    check_uop(mpfp, asin, i12);
    check_uop(mpfp, asin, i13);
    check_uop(mpfp, asin, i14);
    check_uop(mpfp, asin, i15);
    check_uop(mpfp, asin, oi11);
    check_uop(mpfp, asin, oi12);
    check_uop(mpfp, asin, oi13);
    check_uop(mpfp, asin, oi14);
    check_uop(mpfp, asin, oi15);

    cout << "=====================" << endl;
    check_uop(mpfp, acos, i11);
    check_uop(mpfp, acos, i12);
    check_uop(mpfp, acos, i13);
    check_uop(mpfp, acos, i14);
    check_uop(mpfp, acos, i15);
    check_uop(mpfp, acos, oi11);
    check_uop(mpfp, acos, oi12);
    check_uop(mpfp, acos, oi13);
    check_uop(mpfp, acos, oi14);
    check_uop(mpfp, acos, oi15);

    cout << "=====================" << endl;
    check_uop(mpfp, atan, i1);
    check_uop(mpfp, atan, i2);
    check_uop(mpfp, atan, i3);
    check_uop(mpfp, atan, i4);
    check_uop(mpfp, atan, i5);
    check_uop(mpfp, atan, i6);
    check_uop(mpfp, atan, i7);
    check_uop(mpfp, atan, i8);
    check_uop(mpfp, atan, i9);
    check_uop(mpfp, atan, i10);
    check_uop(mpfp, atan, i11);
    check_uop(mpfp, atan, i12);
    check_uop(mpfp, atan, i13);
    check_uop(mpfp, atan, i14);
    check_uop(mpfp, atan, i15);
    check_uop(mpfp, atan, oi1);
    check_uop(mpfp, atan, oi2);
    check_uop(mpfp, atan, oi3);
    check_uop(mpfp, atan, oi4);
    check_uop(mpfp, atan, oi5);
    check_uop(mpfp, atan, oi6);
    check_uop(mpfp, atan, oi7);
    check_uop(mpfp, atan, oi8);
    check_uop(mpfp, atan, oi9);
    check_uop(mpfp, atan, oi10);
    check_uop(mpfp, atan, oi11);
    check_uop(mpfp, atan, oi12);
    check_uop(mpfp, atan, oi13);
    check_uop(mpfp, atan, oi14);
    check_uop(mpfp, atan, oi15);
    check_uop(mpfp, atan, inf);
    check_uop(mpfp, atan, ozero_pinf);
    check_uop(mpfp, atan, ozero_ninf);
    check_uop(mpfp, atan, czero_pinf);
    check_uop(mpfp, atan, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, sinh, i1);
    check_uop(mpfp, sinh, i2);
    check_uop(mpfp, sinh, i3);
    check_uop(mpfp, sinh, i4);
    check_uop(mpfp, sinh, i5);
    check_uop(mpfp, sinh, i6);
    check_uop(mpfp, sinh, i7);
    check_uop(mpfp, sinh, i8);
    check_uop(mpfp, sinh, i9);
    check_uop(mpfp, sinh, i10);
    check_uop(mpfp, sinh, i11);
    check_uop(mpfp, sinh, i12);
    check_uop(mpfp, sinh, i13);
    check_uop(mpfp, sinh, i14);
    check_uop(mpfp, sinh, i15);
    check_uop(mpfp, sinh, oi1);
    check_uop(mpfp, sinh, oi2);
    check_uop(mpfp, sinh, oi3);
    check_uop(mpfp, sinh, oi4);
    check_uop(mpfp, sinh, oi5);
    check_uop(mpfp, sinh, oi6);
    check_uop(mpfp, sinh, oi7);
    check_uop(mpfp, sinh, oi8);
    check_uop(mpfp, sinh, oi9);
    check_uop(mpfp, sinh, oi10);
    check_uop(mpfp, sinh, oi11);
    check_uop(mpfp, sinh, oi12);
    check_uop(mpfp, sinh, oi13);
    check_uop(mpfp, sinh, oi14);
    check_uop(mpfp, sinh, oi15);
    check_uop(mpfp, sinh, inf);
    check_uop(mpfp, sinh, ozero_pinf);
    check_uop(mpfp, sinh, ozero_ninf);
    check_uop(mpfp, sinh, czero_pinf);
    check_uop(mpfp, sinh, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, cosh, i1);
    check_uop(mpfp, cosh, i2);
    check_uop(mpfp, cosh, i3);
    check_uop(mpfp, cosh, i4);
    check_uop(mpfp, cosh, i5);
    check_uop(mpfp, cosh, i6);
    check_uop(mpfp, cosh, i7);
    check_uop(mpfp, cosh, i8);
    check_uop(mpfp, cosh, i9);
    check_uop(mpfp, cosh, i10);
    check_uop(mpfp, cosh, i11);
    check_uop(mpfp, cosh, i12);
    check_uop(mpfp, cosh, i13);
    check_uop(mpfp, cosh, i14);
    check_uop(mpfp, cosh, i15);
    check_uop(mpfp, cosh, oi1);
    check_uop(mpfp, cosh, oi2);
    check_uop(mpfp, cosh, oi3);
    check_uop(mpfp, cosh, oi4);
    check_uop(mpfp, cosh, oi5);
    check_uop(mpfp, cosh, oi6);
    check_uop(mpfp, cosh, oi7);
    check_uop(mpfp, cosh, oi8);
    check_uop(mpfp, cosh, oi9);
    check_uop(mpfp, cosh, oi10);
    check_uop(mpfp, cosh, oi11);
    check_uop(mpfp, cosh, oi12);
    check_uop(mpfp, cosh, oi13);
    check_uop(mpfp, cosh, oi14);
    check_uop(mpfp, cosh, oi15);
    check_uop(mpfp, cosh, inf);
    check_uop(mpfp, cosh, ozero_pinf);
    check_uop(mpfp, cosh, ozero_ninf);
    check_uop(mpfp, cosh, czero_pinf);
    check_uop(mpfp, cosh, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, tanh, i1);
    check_uop(mpfp, tanh, i2);
    check_uop(mpfp, tanh, i3);
    check_uop(mpfp, tanh, i4);
    check_uop(mpfp, tanh, i5);
    check_uop(mpfp, tanh, i6);
    check_uop(mpfp, tanh, i7);
    check_uop(mpfp, tanh, i8);
    check_uop(mpfp, tanh, i9);
    check_uop(mpfp, tanh, i10);
    check_uop(mpfp, tanh, i11);
    check_uop(mpfp, tanh, i12);
    check_uop(mpfp, tanh, i13);
    check_uop(mpfp, tanh, i14);
    check_uop(mpfp, tanh, i15);
    check_uop(mpfp, tanh, oi1);
    check_uop(mpfp, tanh, oi2);
    check_uop(mpfp, tanh, oi3);
    check_uop(mpfp, tanh, oi4);
    check_uop(mpfp, tanh, oi5);
    check_uop(mpfp, tanh, oi6);
    check_uop(mpfp, tanh, oi7);
    check_uop(mpfp, tanh, oi8);
    check_uop(mpfp, tanh, oi9);
    check_uop(mpfp, tanh, oi10);
    check_uop(mpfp, tanh, oi11);
    check_uop(mpfp, tanh, oi12);
    check_uop(mpfp, tanh, oi13);
    check_uop(mpfp, tanh, oi14);
    check_uop(mpfp, tanh, oi15);
    check_uop(mpfp, tanh, inf);
    check_uop(mpfp, tanh, ozero_pinf);
    check_uop(mpfp, tanh, ozero_ninf);
    check_uop(mpfp, tanh, czero_pinf);
    check_uop(mpfp, tanh, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, csc, i1);
    check_uop(mpfp, csc, i2);
    check_uop(mpfp, csc, i3);
    check_uop(mpfp, csc, i4);
    check_uop(mpfp, csc, i5);
    check_uop(mpfp, csc, i6);
    check_uop(mpfp, csc, i7);
    check_uop(mpfp, csc, i8);
    check_uop(mpfp, csc, i9);
    check_uop(mpfp, csc, i10);
    check_uop(mpfp, csc, i11);
    check_uop(mpfp, csc, i12);
    check_uop(mpfp, csc, i13);
    check_uop(mpfp, csc, i14);
    check_uop(mpfp, csc, i15);
    check_uop(mpfp, csc, oi1);
    check_uop(mpfp, csc, oi2);
    check_uop(mpfp, csc, oi3);
    check_uop(mpfp, csc, oi4);
    check_uop(mpfp, csc, oi5);
    check_uop(mpfp, csc, oi6);
    check_uop(mpfp, csc, oi7);
    check_uop(mpfp, csc, oi8);
    check_uop(mpfp, csc, oi9);
    check_uop(mpfp, csc, oi10);
    check_uop(mpfp, csc, oi11);
    check_uop(mpfp, csc, oi12);
    check_uop(mpfp, csc, oi13);
    check_uop(mpfp, csc, oi14);
    check_uop(mpfp, csc, oi15);
    check_uop(mpfp, csc, inf);
    check_uop(mpfp, csc, ozero_pinf);
    check_uop(mpfp, csc, ozero_ninf);
    check_uop(mpfp, csc, czero_pinf);
    check_uop(mpfp, csc, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, sec, i1);
    check_uop(mpfp, sec, i2);
    check_uop(mpfp, sec, i3);
    check_uop(mpfp, sec, i4);
    check_uop(mpfp, sec, i5);
    check_uop(mpfp, sec, i6);
    check_uop(mpfp, sec, i7);
    check_uop(mpfp, sec, i8);
    check_uop(mpfp, sec, i9);
    check_uop(mpfp, sec, i10);
    check_uop(mpfp, sec, i11);
    check_uop(mpfp, sec, i12);
    check_uop(mpfp, sec, i13);
    check_uop(mpfp, sec, i14);
    check_uop(mpfp, sec, i15);
    check_uop(mpfp, sec, oi1);
    check_uop(mpfp, sec, oi2);
    check_uop(mpfp, sec, oi3);
    check_uop(mpfp, sec, oi4);
    check_uop(mpfp, sec, oi5);
    check_uop(mpfp, sec, oi6);
    check_uop(mpfp, sec, oi7);
    check_uop(mpfp, sec, oi8);
    check_uop(mpfp, sec, oi9);
    check_uop(mpfp, sec, oi10);
    check_uop(mpfp, sec, oi11);
    check_uop(mpfp, sec, oi12);
    check_uop(mpfp, sec, oi13);
    check_uop(mpfp, sec, oi14);
    check_uop(mpfp, sec, oi15);
    check_uop(mpfp, sec, inf);
    check_uop(mpfp, sec, ozero_pinf);
    check_uop(mpfp, sec, ozero_ninf);
    check_uop(mpfp, sec, czero_pinf);
    check_uop(mpfp, sec, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, cot, i1);
    check_uop(mpfp, cot, i2);
    check_uop(mpfp, cot, i3);
    check_uop(mpfp, cot, i4);
    check_uop(mpfp, cot, i5);
    check_uop(mpfp, cot, i6);
    check_uop(mpfp, cot, i7);
    check_uop(mpfp, cot, i8);
    check_uop(mpfp, cot, i9);
    check_uop(mpfp, cot, i10);
    check_uop(mpfp, cot, i11);
    check_uop(mpfp, cot, i12);
    check_uop(mpfp, cot, i13);
    check_uop(mpfp, cot, i14);
    check_uop(mpfp, cot, i15);
    check_uop(mpfp, cot, oi1);
    check_uop(mpfp, cot, oi2);
    check_uop(mpfp, cot, oi3);
    check_uop(mpfp, cot, oi4);
    check_uop(mpfp, cot, oi5);
    check_uop(mpfp, cot, oi6);
    check_uop(mpfp, cot, oi7);
    check_uop(mpfp, cot, oi8);
    check_uop(mpfp, cot, oi9);
    check_uop(mpfp, cot, oi10);
    check_uop(mpfp, cot, oi11);
    check_uop(mpfp, cot, oi12);
    check_uop(mpfp, cot, oi13);
    check_uop(mpfp, cot, oi14);
    check_uop(mpfp, cot, oi15);
    check_uop(mpfp, cot, inf);
    check_uop(mpfp, cot, ozero_pinf);
    check_uop(mpfp, cot, ozero_ninf);
    check_uop(mpfp, cot, czero_pinf);
    check_uop(mpfp, cot, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, asinh, i1);
    check_uop(mpfp, asinh, i2);
    check_uop(mpfp, asinh, i3);
    check_uop(mpfp, asinh, i4);
    check_uop(mpfp, asinh, i5);
    check_uop(mpfp, asinh, i6);
    check_uop(mpfp, asinh, i7);
    check_uop(mpfp, asinh, i8);
    check_uop(mpfp, asinh, i9);
    check_uop(mpfp, asinh, i10);
    check_uop(mpfp, asinh, i11);
    check_uop(mpfp, asinh, i12);
    check_uop(mpfp, asinh, i13);
    check_uop(mpfp, asinh, i14);
    check_uop(mpfp, asinh, i15);
    check_uop(mpfp, asinh, oi1);
    check_uop(mpfp, asinh, oi2);
    check_uop(mpfp, asinh, oi3);
    check_uop(mpfp, asinh, oi4);
    check_uop(mpfp, asinh, oi5);
    check_uop(mpfp, asinh, oi6);
    check_uop(mpfp, asinh, oi7);
    check_uop(mpfp, asinh, oi8);
    check_uop(mpfp, asinh, oi9);
    check_uop(mpfp, asinh, oi10);
    check_uop(mpfp, asinh, oi11);
    check_uop(mpfp, asinh, oi12);
    check_uop(mpfp, asinh, oi13);
    check_uop(mpfp, asinh, oi14);
    check_uop(mpfp, asinh, oi15);
    check_uop(mpfp, asinh, inf);
    check_uop(mpfp, asinh, ozero_pinf);
    check_uop(mpfp, asinh, ozero_ninf);
    check_uop(mpfp, asinh, czero_pinf);
    check_uop(mpfp, asinh, czero_ninf);

    cout << "=====================" << endl;
    check_uop(mpfp, acosh, i1);
    check_uop(mpfp, acosh, i2);
    check_uop(mpfp, acosh, i5);
    check_uop(mpfp, acosh, i7);
    check_uop(mpfp, acosh, i8);
    check_uop(mpfp, acosh, oi1);
    check_uop(mpfp, acosh, oi2);
    check_uop(mpfp, acosh, oi5);
    check_uop(mpfp, acosh, oi7);
    check_uop(mpfp, acosh, oi8);

    cout << "=====================" << endl;
    check_uop(mpfp, atanh, i10);
    check_uop(mpfp, atanh, i11);
    check_uop(mpfp, atanh, i12);
    check_uop(mpfp, atanh, i13);
    check_uop(mpfp, atanh, i14);
    check_uop(mpfp, atanh, i15);
    check_uop(mpfp, atanh, oi11);
    check_uop(mpfp, atanh, oi12);
    check_uop(mpfp, atanh, oi13);
    check_uop(mpfp, atanh, oi14);
    check_uop(mpfp, atanh, oi15);
}

int main() {
    enable_trace("numerics");
    mpfp_interval_arith();
    mpfp_interval_inf1();
    mpfp_interval_inf2();
    mpfp_interval_trans();
    return has_violations() ? 1 : 0;
}
