[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [rtl] rtl_printf an floating point




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 bionic@vassalboro.bu.edu 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:	Norman_A_Dresner@mail.Northgrum.com
> > 	Afternoons:	ndrez@att.net
> > 
> > > -----Original Message-----
> > > From:	joseph canou [SMTP:Joseph.Canou@bourges.univ-orleans.fr]
> > > Sent:	Wednesday, March 07, 2001 7:54 AM
> > > To:	rtl@rtlinux.org
> > > 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 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/
> > -- [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/
> > 
> 
> -- [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/
> 
>