[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Norm Dresner" <ndrez@att.net>] (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Norm Dresner" <ndrez@att.net>] (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Thu, 10 May 2001 06:49:43 +0200 (CEST)
>From owner-rtl Wed May 9 14:31:45 2001
Received: from mtiwmhc24.worldnet.att.net (mtiwmhc24.worldnet.att.net [204.127.131.49])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f49KViJ25405
for <rtl@fsmlabs.com>; Wed, 9 May 2001 14:31:44 -0600
Received: from thedm ([12.79.107.4]) by mtiwmhc24.worldnet.att.net
(InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP
id <20010509202735.OJEH1579.mtiwmhc24.worldnet.att.net@thedm>;
Wed, 9 May 2001 20:27:35 +0000
Message-ID: <014601c0d8c6$02b64dc0$0600a8c0@compumagic>
From: "Norm Dresner" <ndrez@att.net>
To: "RTLinux Mailing list" <rtl@fsmlabs.com>
Cc: <jonas.persson@comsys.se>
References: <GBEBJEDLOFFHLCHJLHDLEEIJCDAA.jonas.persson@comsys.se>
Subject: Re: [rtl] Floating point question
Date: Wed, 9 May 2001 16:24:08 -0400
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Exactly where did you get that result printed out? Certainly not from the
kernel via printk() since printk() doesn't do floating point (nor long long,
but that's a different issue).
Here's what I get whenI run the "program" in user-space:
Result is 9.427070
But as an int it's -311863868
But as a long it's -311863868
============ here's the program ========
#include <libc.h>
int main()
{
double m0,
ramp = 1,
chi_off = 0.299,
ang_lim = 198,
my_2_pi = 6.28;
m0 = ramp*chi_off*ang_lim/ my_2_pi;
printf( " Result is %f\n" , m0 );
printf( " But as an int it's %d\n" , m0 );
printf( " But as a long it's %ld\n" , m0 );
return( 0 );
}
----- Original Message -----
From: Jonas Persson <jonas.persson@comsys.se>
To: RTLinux Mailing list <rtl@fsmlabs.com>
Sent: Wednesday, May 09, 2001 12:33 PM
Subject: [rtl] Floating point question
> Hi all!
>
> So, now I have gotten to the dreaded floating point issue. However, I
think my problem is a little rare... the problem is that the FPU simply does
not give correct answers. Consider the following code excerpt:
>
> m0 = ramp*chi_off*ang_lim/ my_2_pi;
>
> Given the following parameters,
> ramp = 1,
> chi_off = 0.299,
> ang_lim = 198,
> my_2_pi = 6.28,
>
> the statement above returns
>
> m0 = -2147483648 !!!
>
> Interesting, isn't it? m0 is an int, the rest are floats. If I run the
program without debugging and trace data through an RT-fifo, I get lots of
results like the above example. However if I debug the program, and wait for
a few seconds, sometimes different results are returned.
>
> Can anyone guess at possible causes for this happening? Have anyone else
experienced the same behaviour?
>
> Apart from this, my system is working fine, I have no crashes, hangups or
other bad behaviour.
>
> My configuration is:
> Pentium III 866 processor, tyan SMP motherboard, kernel 2.2.18-rtl. Base
distribution is SuSE 7.0, and exchanged the stock installed debugger for gdb
5.0. I am using the stock gcc 2.95.2 19991024 that comes with SuSE.
>
> BTW, I solved my previous problem by NOT doing rtf_flush() from a
rt-thread... :-)
>
> Yours very confusedly,
> Jonas Persson
>
> ______________________________________________________________________
> Jonas Persson E-mail: jonas.persson@comsys.se
> Project Manager, M.Sc C.Sc&E http://www.comsys.se/
> Comsys AB Phone: +46-(0)46-286 3500
> Forskningsbyn IDEON Fax: +46-(0)46-286 3505
> S-223 70 Lund, Sweden
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
>