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

    assertEquals(0, MathLib::isinf(NAN));
    assertEquals(0, MathLib::isinf(10));
    assertEquals(1, MathLib::isinf(INFINITY));
    assertEquals(1, MathLib::isinf(-INFINITY));
    assertTrue(MathLib::finite(33) != 0);
    assertEquals(0, MathLib::finite(NAN));

    // x 2^n = scalbn(x,n)
    assertEquals(MathLib::pow(2,4), MathLib::scalbn(2,3));
    assertEquals(80.0, MathLib::scalbn(10,3));

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

    assertEquals(MathLib::fmod(4587, 123), MathLib::drem(4587, 123));
    assertEquals(MathLib::fmod(45824, 1231), MathLib::drem(45824, 1231));
    assertEquals(MathLib::fmod(10, 1), MathLib::drem(10, 1));

    //x copies the sign of y
    assertEquals(33.0, MathLib::copysign(33, 44));
    assertEquals(-33.0, MathLib::copysign(33, -44));
    assertEquals(33.0, MathLib::copysign(-33, 44));
    assertEquals(-33.0, MathLib::copysign(-33, -44));

    assertTrue(MathLib::isnan(NAN) != 0);
    assertTrue(MathLib::isnan(1) == 0);
    assertTrue(MathLib::isnan(INFINITY_POSITIVE) == 0);

    assertEquals(MathLib::ceil(MathLib::logb(MathLib::fabs(75485))), (double)MathLib::ilogb(75485));
    assertEquals(12.0, MathLib::rint(12.2));
    assertEquals(12.0, MathLib::rint(12.49));
    assertEquals(12.0, MathLib::rint(12.5));
    assertEquals(13.0, MathLib::rint(12.51));
    assertEquals(13.0, MathLib::rint(13.0));

    assertEquals(12.21, MathLib::nextafter(12.21, 13.0));
    assertEquals(12.21, MathLib::nextafter(12.21, -13.0));

    assertEquals(MathLib::fmod(4587, 123), MathLib::remainder(4587, 123));
    assertEquals(MathLib::fmod(45824, 1231), MathLib::remainder(45824, 1231));
    assertEquals(MathLib::fmod(10, 1), MathLib::remainder(10, 1));

    assertEquals(12.0, MathLib::round(12.2));
    assertEquals(12.0, MathLib::round(12.49));
    assertEquals(13.0, MathLib::round(12.5));
    assertEquals(13.0, MathLib::round(12.51));
    assertEquals(13.0, MathLib::round(13.0));

    assertEquals(12.0, MathLib::trunc(12.2));
    assertEquals(12.0, MathLib::trunc(12.49));
    assertEquals(12.0, MathLib::trunc(12.5));
    assertEquals(12.0, MathLib::trunc(12.51));
    assertEquals(13.0, MathLib::trunc(13.0));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x3550
movq -0x48(%rbp), %rdx
leaq 0xa06f(%rip), %rsi      # 0x3dd3e
leaq -0x28(%rbp), %rdi
callq 0x5b40
jmp 0x33cda
movq -0x50(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35710
jmp 0x33ce9
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
movsd 0x445d(%rip), %xmm0     # 0x38160
callq 0x79b0
movq -0x50(%rbp), %rdi
movl %eax, %edx
xorl %esi, %esi
callq 0x361e0
movsd 0x57f3(%rip), %xmm0     # 0x39510
callq 0x79b0
movq -0x50(%rbp), %rdi
movl %eax, %edx
xorl %esi, %esi
callq 0x361e0
movsd 0x9e99(%rip), %xmm0     # 0x3dbd0
callq 0x79b0
movq -0x50(%rbp), %rdi
movl %eax, %edx
movl $0x1, %esi
callq 0x361e0
movsd 0x9e74(%rip), %xmm0     # 0x3dbc8
callq 0x79b0
movq -0x50(%rbp), %rdi
movl %eax, %edx
movl $0x1, %esi
callq 0x361e0
movsd 0x9d67(%rip), %xmm0     # 0x3dad8
callq 0x79e0
movq -0x50(%rbp), %rdi
cmpl $0x0, %eax
setne %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
movsd 0x43cd(%rip), %xmm0     # 0x38160
callq 0x79e0
movq -0x50(%rbp), %rdi
movl %eax, %edx
xorl %esi, %esi
callq 0x361e0
movsd 0x4293(%rip), %xmm0     # 0x38040
movsd 0x9c8b(%rip), %xmm1     # 0x3da40
callq 0x7870
movsd %xmm0, -0x98(%rbp)
movsd 0x4276(%rip), %xmm0     # 0x38040
movl $0x3, %edi
callq 0x7a20
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
callq 0x35d20
movsd 0x5720(%rip), %xmm0     # 0x39510
movl $0x3, %edi
callq 0x7a20
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9ca7(%rip), %xmm0     # 0x3dab0
callq 0x35d20
movsd 0x422a(%rip), %xmm0     # 0x38040
movsd 0x9c22(%rip), %xmm1     # 0x3da40
callq 0x7870
movsd %xmm0, -0x90(%rbp)
movsd 0x420d(%rip), %xmm0     # 0x38040
movsd 0x9bfd(%rip), %xmm1     # 0x3da38
callq 0x7b90
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x90(%rbp), %xmm0
callq 0x35d20
movsd 0x56b4(%rip), %xmm0     # 0x39510
movsd 0x9bd4(%rip), %xmm1     # 0x3da38
callq 0x7b90
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9c38(%rip), %xmm0     # 0x3dab0
callq 0x35d20
movsd 0x9cdb(%rip), %xmm0     # 0x3db60
movsd 0x9c83(%rip), %xmm1     # 0x3db10
callq 0x7980
movsd %xmm0, -0x88(%rbp)
movsd 0x9cbe(%rip), %xmm0     # 0x3db60
movsd 0x9c66(%rip), %xmm1     # 0x3db10
callq 0x7a50
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
callq 0x35d20
movsd 0x9ccd(%rip), %xmm0     # 0x3db98
movsd 0x9ccd(%rip), %xmm1     # 0x3dba0
callq 0x7980
movsd %xmm0, -0x80(%rbp)
movsd 0x9cb3(%rip), %xmm0     # 0x3db98
movsd 0x9cb3(%rip), %xmm1     # 0x3dba0
callq 0x7a50
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
callq 0x35d20
movsd 0x5605(%rip), %xmm0     # 0x39510
movsd 0x40fd(%rip), %xmm1     # 0x38010
callq 0x7980
movsd %xmm0, -0x78(%rbp)
movsd 0x55eb(%rip), %xmm0     # 0x39510
movsd 0x40e3(%rip), %xmm1     # 0x38010
callq 0x7a50
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
callq 0x35d20
movsd 0x9b8d(%rip), %xmm0     # 0x3dad8
movsd 0x9b7d(%rip), %xmm1     # 0x3dad0
callq 0x7a80
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9b71(%rip), %xmm0     # 0x3dad8
callq 0x35d20
movsd 0x9b64(%rip), %xmm0     # 0x3dad8
movsd 0x9c44(%rip), %xmm1     # 0x3dbc0
callq 0x7a80
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9c28(%rip), %xmm0     # 0x3dbb8
callq 0x35d20
movsd 0x9c1b(%rip), %xmm0     # 0x3dbb8
movsd 0x9b2b(%rip), %xmm1     # 0x3dad0
callq 0x7a80
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9b1f(%rip), %xmm0     # 0x3dad8
callq 0x35d20
movsd 0x9bf2(%rip), %xmm0     # 0x3dbb8
movsd 0x9bf2(%rip), %xmm1     # 0x3dbc0
callq 0x7a80
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9bd6(%rip), %xmm0     # 0x3dbb8
callq 0x35d20
movsd 0x4171(%rip), %xmm0     # 0x38160
callq 0x7ac0
movq -0x50(%rbp), %rdi
cmpl $0x0, %eax
setne %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
movsd 0x3fff(%rip), %xmm0     # 0x38010
callq 0x7ac0
movq -0x50(%rbp), %rdi
cmpl $0x0, %eax
sete %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
movsd 0x9a1d(%rip), %xmm0     # 0x3da50
callq 0x7ac0
movq -0x50(%rbp), %rdi
cmpl $0x0, %eax
sete %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
movsd 0x9b5b(%rip), %xmm0     # 0x3dbb0
callq 0x7940
callq 0x7830
callq 0x7920
movsd %xmm0, -0x70(%rbp)
movsd 0x9b3f(%rip), %xmm0     # 0x3dbb0
callq 0x7af0
movsd -0x70(%rbp), %xmm0
movq -0x50(%rbp), %rdi
cvtsi2sd %eax, %xmm1
callq 0x35d20
movsd 0x9b00(%rip), %xmm0     # 0x3db90
callq 0x7b10
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5524(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9ad7(%rip), %xmm0     # 0x3db88
callq 0x7b10
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5503(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9aae(%rip), %xmm0     # 0x3db80
callq 0x7b10
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x54e2(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9a85(%rip), %xmm0     # 0x3db78
callq 0x7b10
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9a69(%rip), %xmm0     # 0x3db70
callq 0x35d20
movsd 0x9a5c(%rip), %xmm0     # 0x3db70
callq 0x7b10
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9a48(%rip), %xmm0     # 0x3db70
callq 0x35d20
movsd 0x9a73(%rip), %xmm0     # 0x3dba8
movsd 0x9a33(%rip), %xmm1     # 0x3db70
callq 0x7b30
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9a57(%rip), %xmm0     # 0x3dba8
callq 0x35d20
movsd 0x9a4a(%rip), %xmm0     # 0x3dba8
movsd 0x52ea(%rip), %xmm1     # 0x39450
callq 0x7b30
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9a2e(%rip), %xmm0     # 0x3dba8
callq 0x35d20
movsd 0x99d9(%rip), %xmm0     # 0x3db60
movsd 0x9981(%rip), %xmm1     # 0x3db10
callq 0x7980
movsd %xmm0, -0x68(%rbp)
movsd 0x99bf(%rip), %xmm0     # 0x3db60
movsd 0x9967(%rip), %xmm1     # 0x3db10
callq 0x7b60
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
callq 0x35d20
movsd 0x99d1(%rip), %xmm0     # 0x3db98
movsd 0x99d1(%rip), %xmm1     # 0x3dba0
callq 0x7980
movsd %xmm0, -0x60(%rbp)
movsd 0x99b7(%rip), %xmm0     # 0x3db98
movsd 0x99b7(%rip), %xmm1     # 0x3dba0
callq 0x7b60
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
callq 0x35d20
movsd 0x5309(%rip), %xmm0     # 0x39510
movsd 0x3e01(%rip), %xmm1     # 0x38010
callq 0x7980
movsd %xmm0, -0x58(%rbp)
movsd 0x52ef(%rip), %xmm0     # 0x39510
movsd 0x3de7(%rip), %xmm1     # 0x38010
callq 0x7b60
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
callq 0x35d20
movsd 0x9949(%rip), %xmm0     # 0x3db90
callq 0x7bc0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x536d(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9920(%rip), %xmm0     # 0x3db88
callq 0x7bc0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x534c(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x98f7(%rip), %xmm0     # 0x3db80
callq 0x7bc0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x98d3(%rip), %xmm0     # 0x3db70
callq 0x35d20
movsd 0x98ce(%rip), %xmm0     # 0x3db78
callq 0x7bc0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x98b2(%rip), %xmm0     # 0x3db70
callq 0x35d20
movsd 0x98a5(%rip), %xmm0     # 0x3db70
callq 0x7bc0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x9891(%rip), %xmm0     # 0x3db70
callq 0x35d20
movsd 0x98a4(%rip), %xmm0     # 0x3db90
callq 0x7be0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x52c8(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x987b(%rip), %xmm0     # 0x3db88
callq 0x7be0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x52a7(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9852(%rip), %xmm0     # 0x3db80
callq 0x7be0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5286(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9829(%rip), %xmm0     # 0x3db78
callq 0x7be0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x5265(%rip), %xmm0     # 0x395c8
callq 0x35d20
movsd 0x9800(%rip), %xmm0     # 0x3db70
callq 0x7be0
movq -0x50(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x97ec(%rip), %xmm0     # 0x3db70
callq 0x35d20
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x343b5
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 (%rax,%rax)