NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/47692: FMOD on m68k FPE seems to be wrong

>Number:         47692
>Category:       kern
>Synopsis:       FMOD on m68k FPE seems to be wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 25 13:20:00 +0000 2013
>Originator:     Tetsuya Isaki
>Release:        NetBSD/x68k-6.1_RC1
NetBSD xxxxxx 6.1_RC1 NetBSD 6.1_RC1 (GENERIC) x68k
FMOD emulation on m68k FPE seems to be wrong with some value.

FMOD(100, 10) = 0, ok
FMOD(101, 10) = 29, NG!!
FMOD(10, M_PI) = 0.575222, ok
FMOD(100, M_PI) = 2.61063, ok
FMOD(1000, M_PI) = 605.3538, NG!!
Try this on m68k without FPU (such as XM6i :-).

% dmesg | grep CPU
X68030 (m68030 CPU/MMU, emulator FPU, 29MHz clock)

% cat main.c
extern double my_fmod(double, double);
int main() {
        double x = 101;
        double y = 10;
        printf("FMOD(%g, %g) = %g\n", x, y, my_fmod(x, y));

% cat fmod_s.s
        .globl  my_fmod
        .type   my_fmod,@function
        fmoved  %sp@(4),%fp0
        fmodd   %sp@(12),%fp0

% gcc -o fmod main.c fmod_s.s
% ./fmod

Home | Main Index | Thread Index | Old Index