Go to Post We may not build the best robots but we're building better students in the long run and means much much more. - Koko Ed [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2007, 20:08
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Floating Points and rounding

Quote:
Originally Posted by JBotAlan View Post
Hmm, I use (for example):
Code:
double PAN_DEGREE = whatever
I didn't even know "float" was a data type! C is obviously not my native language; VB6 is. Which has more resolution? Forget it, I'll Google it.

I didn't know about the "f" after the numbers after, but I'd seen that at some point...can't remember where.

Thanks, I'll use some of that in my code!

JBot
ill save you the trouble- double has more resolution. but considering that a double is a 64-bit data type, i wouldn't use it all that much.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #2   Spotlight this post!  
Unread 15-01-2007, 20:29
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Floating Points and rounding

If you are only going up to 180 i don't see why a float is really necessary??? why not just multiply by 100? it'll still get you two digit accuracy

i.e: 180.00 = 18000

as for rounding a floating point number down to four decimals... it is not too hard to do, but why would you need to do it? it's not like reducing the number of decimal points will reduce the processing time more than the cost it takes to round the number.

I think the easiest way to round to four decimals would probably be to mask off the bits of the less significant digits using "&" and a masking variable
(look up bitwise operators)


this may also be of use to u:
http://en.wikipedia.org/wiki/IEEE_754
__________________
Team 701
  #3   Spotlight this post!  
Unread 16-01-2007, 11:22
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Floating Points and rounding

Quote:
Originally Posted by Uberbots View Post
ill save you the trouble- double has more resolution. but considering that a double is a 64-bit data type, i wouldn't use it all that much.
floats and doubles are both 32bit variables in this compiler!
Closed Thread


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
Rounding numbers teh_pwnerer795 Programming 13 17-12-2006 12:16
pic: Team 228 and the floating tetra artdutra04 Extra Discussion 8 02-05-2005 19:58
pic: YMTC: 150 points or 100 points? CD47-Bot Extra Discussion 4 25-03-2004 01:53
5 points I make..(and a little excess) archiver 1999 7 23-06-2002 22:18
Awards and points... Ian W. Rules/Strategy 4 24-03-2002 13:30


All times are GMT -5. The time now is 01: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