From: Ludovic Henry <ludovic@rivosinc.com>
To: libc-alpha@sourceware.org
Subject: Behaviour differences on x86 and RISC-V on cos/sin functions
Date: Thu, 8 Dec 2022 15:23:37 -0300 [thread overview]
Message-ID: <CADT88DuDrQzubQOq-A4uCkM+nVgvNwvWVKr7rpH=h7tgwpaSNA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]
Hello,
As part of some OpenJDK work on RISC-V, I've stumbled upon a behavior
difference in cos/sin functions between x86 and RISC-V. It's not clear to
me whether the difference in behavior is acceptable, and whether it should
be handled in the OpenJDK (or other relevant libraries).
The simple test case I have which runs successfully on x86 but not RISC-V
is the following:
```
#include <stdint.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
void main(int argc, char* argv[]) {
int64_t bitsNaN = 0x7fff800000000000L;
double valNaN = *((double*)&bitsNaN);
double resD = acos(valNaN);
int64_t res = *((int64_t*)&resD);
if (!(res == bitsNaN)) {
printf("expected 0x%lx but got 0x%lx\n", bitsNaN, res);
exit(1);
}
}
```
I can see that there are some NaN related tests in glibc already at
glibc/math/libm-test-acos.inc#L25-26 and that some are failing at
https://sourceware.org/glibc/wiki/Release/2.35#RISC-V_.28rv64imafdc.2Flp64d.29
and
https://sourceware.org/glibc/wiki/Release/2.36#RISC-V_.28rv64imafdc.2Flp64d.29.
I'm not sure exactly which test is failing though.
What do you think?
Thank you,
Ludovic
next reply other threads:[~2022-12-08 18:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 18:23 Ludovic Henry [this message]
2022-12-08 18:49 ` Joseph Myers
2022-12-08 19:24 ` Ludovic Henry
2022-12-08 19:58 ` Palmer Dabbelt
2022-12-08 20:06 ` Joseph Myers
2022-12-08 20:07 ` Palmer Dabbelt
2022-12-08 19:59 ` Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADT88DuDrQzubQOq-A4uCkM+nVgvNwvWVKr7rpH=h7tgwpaSNA@mail.gmail.com' \
--to=ludovic@rivosinc.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).