I think this works too:
typecast to int to get the integer part, then multiply the rest with,
say, 1000, to get the three digits after the point, can do this repeatedly
to get higher precision.
Dingrong
On Wed, 7 Mar 2001 [EMAIL PROTECTED] wrote:
> When I know the approximate magnitude of my numbers,
> I just typecast to int to get floating point with kernel
> printf versions...
>
> rtl_printf("My number is %de-6",(int)(foo_float * 1e6));
>
> -Chuck
>
>
> On Wed, 7 Mar 2001, Dresner, Norman A. wrote:
>
> > I believe you can't. Even though you can specify that a real-time
> > module/task/thread can use the math coprocessor (I'm assuming your in an x86
> > architecture), the kernel versions of printf don't support floating point
> > conversions.
> >
> > I think that the best you can do is to send the data to a user-task via a
> > real-time FIFO (or dump the data into shared memory) for printing.
> >
> > Norman Dresner
> > Fellow Systems Engineer
> > Radar Systems Engineering Department
> > Electronic Systems and Sensors Segment
> > Northrop Grumman Corporation
> > Baltimore-Washington International Airport
> > 7323 Aviation Boulevard
> > Baltimore Maryland 21240
> >
> > Voice: (410) 993 - 2096 Mornings; all-day voice-mail
> > (410) 969 - 8068 Afternoons with answering machine
> > FAX: (410) 993 - 8084 On-site
> > (410) 969 - 8068 Afternoons; call first to arrange
> > E-Mail: Mornings: [EMAIL PROTECTED]
> > Afternoons: [EMAIL PROTECTED]
> >
> > > -----Original Message-----
> > > From: joseph canou [SMTP:[EMAIL PROTECTED]]
> > > Sent: Wednesday, March 07, 2001 7:54 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [rtl] rtl_printf an floating point
> > >
> > > hello
> > > i am using floating point in rt module and i would like to see some
> > > results (for debugging) by using rtl_printf
> > > but if i write rtl_printf("%f", var) with var declared as double i just
> > > see %f in /var/log/messages
> > > how can i do to see this var value?
> > > i use rtl3.0 pre9
> > > thank you for your help
> > >
> > > -- [rtl] ---
> > > To unsubscribe:
> > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > --
> > > For more information on Real-Time Linux see:
> > > http://www.rtlinux.org/rtlinux/
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/rtlinux/
> >
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/
>
>
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/