On 06/24/2018 11:38 AM, Programmingkid wrote:
> void test_division_by_zero()
> {
>     Converter c;
>     uint64_t expected_answer = 0x0;
>     uint32_t actual_fpscr, expected_fpscr = 0xc4000010;
>     reset_fpscr();
>     set_fpscr_bit(ZE);
>     asm volatile("fdiv %0, %1, %2" : "=f"(c.d) : "f"(1.0), "f"(0.0));

Try

    uint64_t expected_answer = 0xffff0000deadbeef;
    ...
    c.i = expected_answer;
    asm volatile("fdiv %0, %1, %2" : "+f"(c.d) : "f"(1.0), "f"(0.0));

to avoid depending on uninitialized data.  (This expected value is
an SNaN with a deadbeef marker Just to be Sure.)


r~

Reply via email to