Re: problem printing floating point values inside realtime tasks

Der Herr Hofrat <[email protected]> Sat, 19 Feb 2005 22:01:33 +0100 (CET)
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
> Hello to all,
> 
> I tried printing a simple floating point value inside a real-time thread using:
>   
>    rtl_printf("%lf \n",dd_value);
>
rtl_printf, just like printk, does not support floating point (this is not
libc...) - you will have to convert it to two integers and print them 
serperately as integers. Something uggly like:

	float x;
	int a1,a2;

	x=23.45;

	a1=(int)x;
	a2=(int)(x-(int)x)*1000;

	rtl_printf("A float in RTLinux: %d.%d\n",a1,a2);

hofrat
_______________________________________________
Rtl mailing list
[email protected]
http://www2.fsmlabs.com/mailman/listinfo/rtl