https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289232

--- Comment #13 from Konstantin Belousov <[email protected]> ---
Sorry, the pasted code has the bug, I divided larger number by smaller.
It should be reverse.  Now you could expect an underflow, but CPUs, both
Intel and AMD, report only inexact result.

I also checked it under Linux.

/* $Id$ */

#include <stdint.h>
#include <stdio.h>

static const double small_num = 1.0E-300;
static const double large_num = 1.0E+300;

int
main(void)
{
        uint16_t sw;

        __asm __volatile(
                "\tfldl large_num\n"
                "\tfldl small_num\n"
                "\tfdivp\n"
                "\tfstsw %%ax\n"
                : "=a"(sw)
                : "m"(small_num), "m"(large_num)
                : "flags"
                );
        printf("x87 FPU Status Word (FSW): 0x%04x\n", sw);
        if (sw & 0x01)
                printf("  INVALID OP\n");
        if (sw & 0x02)
                printf("  DENORMAL OPERAND\n");
        if (sw & 0x04)
                printf("  ZERO DIVIDE\n");
        if (sw & 0x08)
                printf("  OVERFLOW\n");
        if (sw & 0x10)
                printf("  UNDERFLOW\n");
        if (sw & 0x20)
                printf("  INEXACT\n");
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to