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

    assertEquals(1.0, MathLib::cos(0));
    assertEquals(0.0, MathLib::sin(0));

    assertEquals(MathLib::sqrt(2)/2, MathLib::cos(pi/4));
    assertEquals(MathLib::sqrt(2)/2, MathLib::sin(pi/4));

    assertEquals(0.0, MathLib::cos(pi/2));
    assertEquals(1.0, MathLib::sin(pi/2));

    assertEquals(-1.0, MathLib::cos(pi));
    assertEquals(0.0, MathLib::sin(pi));

    assertEquals(0.0, MathLib::cos(3*pi/2));
    assertEquals(-1.0, MathLib::sin(3*pi/2));

    assertEquals(1.0, MathLib::cos(2*pi));
    assertEquals(0.0, MathLib::sin(2*pi));

    //tan
    assertEquals(0.0, MathLib::tan(0));
    assertEquals(1.0, MathLib::tan(pi/4));
    assertGreater(INFINITY_POSITIVE, MathLib::tan(pi/2));
    assertLess(INFINITY_NEGATIVE, MathLib::tan(-pi/2));

    //acos
    assertEquals(0.0, MathLib::acos(1));
    assertEquals(pi/2, MathLib::acos(0));
    assertEquals(pi, MathLib::acos(-1));
    assertEquals(pi/4, MathLib::acos(MathLib::sqrt(2)/2));

    //asin
    assertEquals(0.0, MathLib::asin(0));
    assertEquals(pi/2, MathLib::asin(1));
    assertEquals(-pi/2, MathLib::asin(-1));
    assertEquals(pi/4, MathLib::asin(MathLib::sqrt(2)/2));

    //atan
    assertEquals(0.0, MathLib::atan(0.0));
    assertEquals(pi/4, MathLib::atan(1.0));
    assertEquals(pi/2, MathLib::atan(INFINITY_POSITIVE));
    assertEquals(-pi/2, MathLib::atan(INFINITY_NEGATIVE));

    double atan_X = MathLib::atan(0.2);
    double atan_Y = MathLib::atan(0.3);
    double atan_XY = MathLib::atan((0.2+0.3)/(1-0.2*0.3));
    assertEquals(atan_X+atan_Y, atan_XY);

    assertEquals(MathLib::atan(0.0), MathLib::atan2(0.0, 1.0));
    assertEquals(MathLib::atan(1.0), MathLib::atan2(1.0, 1.0));
    assertEquals(MathLib::atan(INFINITY_POSITIVE), MathLib::atan2(1.0, 0.0));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x3550
movq -0x60(%rbp), %rdx
leaq 0xafa5(%rip), %rsi      # 0x3dc84
leaq -0x28(%rbp), %rdi
callq 0x5b40
jmp 0x32cea
movq -0x68(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35710
jmp 0x32cf9
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
xorps %xmm0, %xmm0
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x52ee(%rip), %xmm0     # 0x38010
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0x52fa(%rip), %xmm0     # 0x38040
callq 0x78a0
movsd 0x52ed(%rip), %xmm1     # 0x38040
divsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movsd 0xad21(%rip), %xmm0     # 0x3da88
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x90(%rbp), %xmm0
callq 0x35d20
movsd 0x52b8(%rip), %xmm0     # 0x38040
callq 0x78a0
movsd 0x52ab(%rip), %xmm1     # 0x38040
divsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0xacdf(%rip), %xmm0     # 0x3da88
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
callq 0x35d20
movsd 0xacb6(%rip), %xmm0     # 0x3da80
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xac9a(%rip), %xmm0     # 0x3da80
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5216(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0x5219(%rip), %xmm0     # 0x38020
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x520d(%rip), %xmm0     # 0x38028
callq 0x35d20
movsd 0x51f8(%rip), %xmm0     # 0x38020
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xac4c(%rip), %xmm0     # 0x3da90
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xac30(%rip), %xmm0     # 0x3da90
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x51b4(%rip), %xmm0     # 0x38028
callq 0x35d20
movsd 0x5187(%rip), %xmm0     # 0x38008
callq 0x75e0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x517b(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0x5166(%rip), %xmm0     # 0x38008
callq 0x7600
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7620
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0xabb3(%rip), %xmm0     # 0x3da88
callq 0x7620
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5127(%rip), %xmm0     # 0x38010
callq 0x35d20
movsd 0xab8a(%rip), %xmm0     # 0x3da80
callq 0x7620
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xab46(%rip), %xmm0     # 0x3da50
callq 0x363d0
movsd 0xab59(%rip), %xmm0     # 0x3da70
callq 0x7620
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xab4d(%rip), %xmm0     # 0x3da78
callq 0x367c0
movsd 0x50d8(%rip), %xmm0     # 0x38010
callq 0x7550
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7550
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xab1d(%rip), %xmm0     # 0x3da80
callq 0x35d20
movsd 0x50b8(%rip), %xmm0     # 0x38028
callq 0x7550
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x509c(%rip), %xmm0     # 0x38020
callq 0x35d20
movsd 0x50af(%rip), %xmm0     # 0x38040
callq 0x78a0
movsd 0x50a2(%rip), %xmm1     # 0x38040
divsd %xmm1, %xmm0
callq 0x7550
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xaad2(%rip), %xmm0     # 0x3da88
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7570
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0x5036(%rip), %xmm0     # 0x38010
callq 0x7570
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xaa92(%rip), %xmm0     # 0x3da80
callq 0x35d20
movsd 0x502d(%rip), %xmm0     # 0x38028
callq 0x7570
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xaa61(%rip), %xmm0     # 0x3da70
callq 0x35d20
movsd 0x5024(%rip), %xmm0     # 0x38040
callq 0x78a0
movsd 0x5017(%rip), %xmm1     # 0x38040
divsd %xmm1, %xmm0
callq 0x7570
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xaa47(%rip), %xmm0     # 0x3da88
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7590
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x35d20
movsd 0x4fab(%rip), %xmm0     # 0x38010
callq 0x7590
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xaa0f(%rip), %xmm0     # 0x3da88
callq 0x35d20
movsd 0xa9ca(%rip), %xmm0     # 0x3da50
callq 0x7590
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa9e6(%rip), %xmm0     # 0x3da80
callq 0x35d20
movsd 0xa9d1(%rip), %xmm0     # 0x3da78
callq 0x7590
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0xa9b5(%rip), %xmm0     # 0x3da70
callq 0x35d20
movsd 0xa9a0(%rip), %xmm0     # 0x3da68
callq 0x7590
movsd %xmm0, -0x48(%rbp)
movsd 0xa986(%rip), %xmm0     # 0x3da60
callq 0x7590
movsd %xmm0, -0x50(%rbp)
movsd 0xa96c(%rip), %xmm0     # 0x3da58
callq 0x7590
movq -0x68(%rbp), %rdi
movsd %xmm0, -0x58(%rbp)
movsd -0x48(%rbp), %xmm0
addsd -0x50(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
callq 0x35d20
xorps %xmm0, %xmm0
callq 0x7590
movsd %xmm0, -0x80(%rbp)
xorps %xmm0, %xmm0
movsd 0x4eea(%rip), %xmm1     # 0x38010
callq 0x75b0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
callq 0x35d20
movsd 0x4ecc(%rip), %xmm0     # 0x38010
callq 0x7590
movsd %xmm0, -0x78(%rbp)
movsd 0x4eba(%rip), %xmm1     # 0x38010
movaps %xmm1, %xmm0
callq 0x75b0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
callq 0x35d20
movsd 0xa8d9(%rip), %xmm0     # 0x3da50
callq 0x7590
movsd %xmm0, -0x70(%rbp)
movsd 0x4e87(%rip), %xmm0     # 0x38010
xorps %xmm1, %xmm1
callq 0x75b0
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
callq 0x35d20
addq $0x90, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x331ce
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