All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] printf
@ 2003-07-11 14:21 Rune Torgersen
  2003-07-11 14:31 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Rune Torgersen @ 2003-07-11 14:21 UTC (permalink / raw)
  To: u-boot

Hi

Does anybody know how to get printf (for 82xx CPU) to priont floting point
numbers?
I have tried %f %e and %g but all it prints on the console is f e and g...

I am using a workaround for now, by printing the number as two integers...

	float_num = some_float_operation;
	i = (int)float_num;
	r = ((int)float_num - i) * 100;

	printf("%d.%d", i, r);

But this is kind of bothersome for the long run.

I need this to print out the measured voltages in the system. (done by a
supervisor circuit).
And yes... The 8266 CPU (actually all the 82xx) has a working FPU unit.


Rune Torgersen
System Developer
Innovative Systems LLC
1000 Innovative Drive
Mitchell, SD 57301
Ph: 605-995-6120
www.innovsys.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot-Users] printf
  2003-07-11 14:21 [U-Boot-Users] printf Rune Torgersen
@ 2003-07-11 14:31 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2003-07-11 14:31 UTC (permalink / raw)
  To: u-boot

In message <9F5558593173D21190EA0008C7B176987313E4@innsys1> you wrote:
> 
> Does anybody know how to get printf (for 82xx CPU) to priont floting point
> numbers?

U-Boot does not support floating point.

> I am using a workaround for now, by printing the number as two integers...

Good idea ;-)

> I need this to print out the measured voltages in the system. (done by a
> supervisor circuit).

You do not need this. See the existing code (like post/sysmon.c).

> And yes... The 8266 CPU (actually all the 82xx) has a working FPU unit.

But U-Boot does not use the FPU.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Experience is what causes a person to make new  mistakes  instead  of
old ones.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-11 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-11 14:21 [U-Boot-Users] printf Rune Torgersen
2003-07-11 14:31 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.