From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] kw floating point emulation problem?
Date: Sun, 11 Apr 2010 21:35:40 -0400 [thread overview]
Message-ID: <6eb333ec1dcb144c3a37180e4e6613a4@kw.quanstro.net> (raw)
gs when compiled on arm for arm doesn't work.
gs when compiled on 386 for arm does work.
i boiled down the problem case to this wierd define
from /sys/src/cmd/gs/src/ztype.c
; cat p2.c
#include <u.h>
#include <libc.h>
#define ALT_MIN_LONG (-1L << (sizeof(long) * 8L - 1))
void
main(void)
{
print("%lx\n", ALT_MIN_LONG);
print("%lx\n", 0x80000000L);
print("%g\n", ALT_MIN_LONG*1.);
print("%g\n", 0x80000000UL*1.);
exits("");
}
; cpu -c '5c -FVTw p2.c && 5l p2.5' && 5.out # cpu is a 386
-80000000
-80000000
-2.147484e+09
2.147484e+09
; 5c -FVTw p2.c && 5l p2.5 && 5.out
-80000000
-80000000
6.442451e+09
-2.147484e+09
a little debugging in scon.c yields:
CAST [l->vconst 2147483648] -> n->fconst 6.442451e+09
for /sys/src/cmd/cc/scon.c:51,59
case OCAST:
if(et == TVOID)
return;
et = l->type->etype;
if(isf) {
if(typefd[et])
>> d = l->fconst;
else
d = l->vconst;
- erik
reply other threads:[~2010-04-12 1:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=6eb333ec1dcb144c3a37180e4e6613a4@kw.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/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 NNTP newsgroup(s).