From: Jim Reekes <reekes@kerbango.com>
To: linuxppc-embedded@lists.linuxppc.org
Cc: nick@kerbango.com
Subject: does soft-float work?
Date: Thu, 11 Nov 1999 13:48:56 -0800 [thread overview]
Message-ID: <382B39C8.EF61D039@kerbango.com> (raw)
I've copied a few lines of code that work as I would expect, expect with
I add the -soft-float option or -mcpu=823. I'm building with a YellowDog
release on a G3 PowerMac, where I removed EGCS and installed GCC
2.95.1-1e. I also have glibc 2.1.1-6h. But, I've also built this with a
clean install of YellowDog on a different PowerMac which included
egcs-2.91.66. There I get incorrect but different results. I've also put
the executable onto our 823 board, and it also gives different yet
incorrect results.
So I'm stumped. Does this float emulation package work? Here's what I do
know.
* printf with a float always fails.
* gdb shows that "i" and "f" are always correct.
* the assignment of "d" from "i" is correct
* the result of pow() returns 9.1981921218154364e-232
* here's the console output
float number (should be 4.000000): -0.000000
int cast of float (should be 4): 4
float number (should be 16.000000): 0.000000
int cast of double (should be 16): 0
gcc -g -lm -msoft-float mathtest.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <math.h>
main(int ac, char **av)
{
float f;
double d;
int i;
i = 2;
f = (float)i;
f *= f;
printf("float number (should be 4.000000): %f\n", f);
printf("int cast of float (should be 4): %d\n", (int)f);
d = (double)i;
d = pow(d, f);
printf("float number (should be 16.000000): %f\n", d);
printf("int cast of double (should be 16): %d\n", (int)d);
}
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next reply other threads:[~1999-11-11 21:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-11 21:48 Jim Reekes [this message]
1999-11-11 22:44 ` does soft-float work? Dan Malek
1999-11-19 17:06 ` Marcus Sundberg
-- strict thread matches above, loose matches on Subject: below --
1999-11-12 0:18 Stuart Adams
1999-11-19 17:10 ` Marcus Sundberg
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=382B39C8.EF61D039@kerbango.com \
--to=reekes@kerbango.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
--cc=nick@kerbango.com \
/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).