Go to Post What about "I h8 Autonomous Mode" (for the programmers who actually have to make the robots work)? - Tristan Lall [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 29-01-2005, 08:38
logicalhippo logicalhippo is offline
Registered User
AKA: Russell McClellan
#0213 (Dirty Birds)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Keene, NH
Posts: 11
logicalhippo is an unknown quantity at this point
Send a message via AIM to logicalhippo
Re: printf problem

printf does not support printing of floating points :'(. sorry, it just doesn't work. (see the comment in printf_lib.c)
What SHOULD work is using %d and then explicitly casting the float to an int.
IE: printf("%d\n", (int)fFloat);
Unfortunately, for me, this ALWAYS prints 0, no matter how large fFloat is.
I'm still having trouble with how to convert floats to ints. I wrote a quick function in c that I'm going to test today, and I found assembly routines from 1997 (see product note AN575 on microchip's page) that I will try.

Around here the consensus seems to be that floating points are more trouble than they are worth on this processor. In most cases where you would use floating point on the robot it's possible to do the math in the integer domain by multiplying first then dividing down.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Problem: Extremely Frustrating chantilly_team Programming 19 12-02-2005 23:00
printf problem cbolin Programming 4 09-11-2004 02:44
Anyone with a replacement Printf? Larry Barello Programming 5 19-03-2004 02:20
The problem with scouting... archiver 2001 10 23-06-2002 23:49
Major problem with chipphua motors aka Scott White Motors 18 19-03-2002 19:44


All times are GMT -5. The time now is 12:26.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi