// File: philipperemy[P]digital-setting-circles/Test.cpp
// Function: Test::test_MathLib_exponential_logarithmic()
void Test::test_MathLib_exponential_logarithmic()
{
    setUpErrorMessage("test_MathLib_exponential_logarithmic() - failed");

    assertEquals(0.0, MathLib::exp(INFINITY_NEGATIVE));
    assertEquals(1.0, MathLib::exp(0));
    assertEquals(2.71828, MathLib::exp(1));
    assertEquals(22026.46579, MathLib::exp(10));
    assertEquals(33.0, MathLib::exp(MathLib::log(33)));
    assertEquals(44.0, MathLib::log(MathLib::exp(44)));

    assertEquals(1.0, MathLib::log(2.71828));
    assertEquals(0.0, MathLib::log(1.0));
    assertLess(INFINITY_POSITIVE, MathLib::log(INFINITY_POSITIVE));
    assertLess(INFINITY_NEGATIVE, MathLib::log(0));

    assertEquals(22026.46579-1, MathLib::expm1(10));
    assertEquals(0.0, MathLib::log1p(0));
    assertEquals(1.0, MathLib::log1p(2.71828-1));

    assertEquals(MathLib::log(10) / MathLib::log(2), MathLib::log2(10));
    assertEquals(3.0, MathLib::log2(MathLib::pow(2,3)));

    assertEquals(MathLib::log(12) / MathLib::log(10), MathLib::log10(12));
    assertEquals(3.0, MathLib::log10(MathLib::pow(10,3)));

    // x * pow(2,exponent)
    assertEquals(MathLib::pow(2,4), MathLib::ldexp(2,3));
    assertEquals(80.0, MathLib::ldexp(10,3));

    assertEquals(MathLib::pow(2,4), MathLib::ldexp(2,3));
    assertEquals(80.0, MathLib::ldexp(10,3));

    // x = significand * 2 ^ exponent
    // 80 = 0.625 * 2 ^ 7
    int exp = 0;
    assertEquals(0.625, MathLib::frexp(80.0, &exp));
    assertEquals(7, exp);

    //modf(12.23, &a) = 0.23 and a = 12.0
    double intPart = 0;
    assertEquals(0.23, MathLib::modf(12.23, &intPart));
    assertEquals(12.0, intPart);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x3550
movq -0x50(%rbp), %rdx
leaq 0xaa9b(%rip), %rsi      # 0x3dcaa
leaq -0x28(%rbp), %rdi
callq 0x5b40
jmp 0x3321a
movq -0x58(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35710
jmp 0x33229
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
movsd 0xa835(%rip), %xmm0     # 0x3da78
callq 0x7700
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7700
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x4da2(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0x4d95(%rip), %xmm0     # 0x38010
callq 0x7700
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa839(%rip), %xmm0     # 0x3dac8
callq 0x35d20
movsd 0x6274(%rip), %xmm0     # 0x39510
callq 0x7700
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa830(%rip), %xmm0     # 0x3dae0
callq 0x35d20
movsd 0xa81b(%rip), %xmm0     # 0x3dad8
callq 0x7780
callq 0x7700
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa802(%rip), %xmm0     # 0x3dad8
callq 0x35d20
movsd 0xa7ed(%rip), %xmm0     # 0x3dad0
callq 0x7700
callq 0x7780
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa7d4(%rip), %xmm0     # 0x3dad0
callq 0x35d20
movsd 0xa7bf(%rip), %xmm0     # 0x3dac8
callq 0x7780
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x4cf3(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0x4ce6(%rip), %xmm0     # 0x38010
callq 0x7780
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xa70a(%rip), %xmm0     # 0x3da50
callq 0x7780
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa6f6(%rip), %xmm0     # 0x3da50
callq 0x367c0
xorps %xmm0, %xmm0
callq 0x7780
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa702(%rip), %xmm0     # 0x3da78
callq 0x367c0
movsd 0x618d(%rip), %xmm0     # 0x39510
callq 0x77f0
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa729(%rip), %xmm0     # 0x3dac0
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7810
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xa6fd(%rip), %xmm0     # 0x3dab8
callq 0x7810
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x4c41(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0x6134(%rip), %xmm0     # 0x39510
callq 0x7780
movsd %xmm0, -0x88(%rbp)
movsd 0x4c4f(%rip), %xmm0     # 0x38040
callq 0x7780
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x60fe(%rip), %xmm0     # 0x39510
callq 0x7850
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
callq 0x35d20
movsd 0x4c10(%rip), %xmm0     # 0x38040
movsd 0xa600(%rip), %xmm1     # 0x3da38
callq 0x7870
callq 0x7850
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa5e7(%rip), %xmm0     # 0x3da38
callq 0x35d20
movsd 0x616a(%rip), %xmm0     # 0x395c8
callq 0x7780
movsd %xmm0, -0x78(%rbp)
movsd 0x60a0(%rip), %xmm0     # 0x39510
callq 0x7780
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movsd 0x613a(%rip), %xmm0     # 0x395c8
callq 0x77a0
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
callq 0x35d20
movsd 0x6064(%rip), %xmm0     # 0x39510
movsd 0xa584(%rip), %xmm1     # 0x3da38
callq 0x7870
callq 0x77a0
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa56b(%rip), %xmm0     # 0x3da38
callq 0x35d20
movsd 0x4b66(%rip), %xmm0     # 0x38040
movsd 0xa55e(%rip), %xmm1     # 0x3da40
callq 0x7870
movsd %xmm0, -0x68(%rbp)
movsd 0x4b4c(%rip), %xmm0     # 0x38040
movl $0x3, %edi
callq 0x7750
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
callq 0x35d20
movsd 0x5ff9(%rip), %xmm0     # 0x39510
movl $0x3, %edi
callq 0x7750
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa580(%rip), %xmm0     # 0x3dab0
callq 0x35d20
movsd 0x4b03(%rip), %xmm0     # 0x38040
movsd 0xa4fb(%rip), %xmm1     # 0x3da40
callq 0x7870
movsd %xmm0, -0x60(%rbp)
movsd 0x4ae9(%rip), %xmm0     # 0x38040
movl $0x3, %edi
callq 0x7750
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
callq 0x35d20
movsd 0x5f96(%rip), %xmm0     # 0x39510
movl $0x3, %edi
callq 0x7750
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa51d(%rip), %xmm0     # 0x3dab0
callq 0x35d20
movl $0x0, -0x40(%rbp)
movsd 0xa509(%rip), %xmm0     # 0x3dab0
leaq -0x40(%rbp), %rdi
callq 0x7720
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa4e9(%rip), %xmm0     # 0x3daa8
callq 0x35d20
movq -0x58(%rbp), %rdi
movl -0x40(%rbp), %edx
movl $0x7, %esi
callq 0x361e0
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0xa4bb(%rip), %xmm0     # 0x3daa0
leaq -0x48(%rbp), %rdi
callq 0x77c0
movq -0x58(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa49b(%rip), %xmm0     # 0x3da98
callq 0x35d20
movq -0x58(%rbp), %rdi
movsd -0x48(%rbp), %xmm1
movsd 0x5fb5(%rip), %xmm0     # 0x395c8
callq 0x35d20
addq $0x90, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x33644
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
movq -0x38(%rbp), %rdi
callq 0x3540
nopw %cs:(%rax,%rax)