What is the Best Data Type For Accuracy?
Page 1 of 114 Replies - 1167 Views - Last Post: 17 June 2011 - 06:17 PM
#1
What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 03:42 PM
Also, I will be creating a ForceVector class that describes the movement of the bodies and contains operations for such mathematical computation. Is this appropriate for what I am doing and wanting to achieve?
Replies To: What is the Best Data Type For Accuracy?
#2
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 03:50 PM
Precision is the main difference.
[b][b][b]Float - 7 digits (32 bit)
Double -15-16 digits (64 bit)
Depends on your application really...
This post has been edited by foofo: 14 June 2011 - 04:00 PM
#3
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 03:51 PM
#4
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 03:53 PM
immeraufdemhund, on 14 June 2011 - 03:51 PM, said:
Well, I am going to be evaluating these points. I have yet to get to the visual graphics part of coding.
#5
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 03:58 PM
#7
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 04:37 PM
#8
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 04:39 PM
cfoley, on 14 June 2011 - 07:37 PM, said:
All Engineers will tell you that they perform their calculations with 10% accuracy.
After all Appolo 9 went to the moon with Slide Rule that have 2 to 3 digits or accuracy
#9
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 04:50 PM
#10
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 04:57 PM
cfoley, on 14 June 2011 - 07:50 PM, said:
int and long have 100% accuracy
if your data (even multiply by a long to take care of decimal digits) do not fit in a long you might have a design problem
#11
Re: What is the Best Data Type For Accuracy?
Posted 14 June 2011 - 04:57 PM
cfoley, on 14 June 2011 - 04:50 PM, said:
This is an excellent idea to use an integer type. Just as you have a data file to supply atomic coordinates, I could easily create a data file for my body locations.
This post has been edited by R41D3NN: 14 June 2011 - 04:59 PM
#12
Re: What is the Best Data Type For Accuracy?
Posted 15 June 2011 - 12:25 AM
public final int getX_mA(){.....}
public final int getY_mA(){.....}
public final int getZ_mA(){.....}
I also have these:
public final double getX_A(){.....}
public final double getY_A(){.....}
public final double getZ_A(){.....}
Since the latter are almost exclusively used for display, I have these too:
public final String getXstr_A(){.....}
public final String getYstr_A(){.....}
public final String getZstr_A(){.....}
You could see the code duplication here and decide to implement a Scalar class, but I decided that was overkill for my purposes.
#13
Re: What is the Best Data Type For Accuracy?
Posted 15 June 2011 - 07:54 AM
cfoley, on 15 June 2011 - 12:25 AM, said:
public final int getX_mA(){.....}
public final int getY_mA(){.....}
public final int getZ_mA(){.....}
I also have these:
public final double getX_A(){.....}
public final double getY_A(){.....}
public final double getZ_A(){.....}
Since the latter are almost exclusively used for display, I have these too:
public final String getXstr_A(){.....}
public final String getYstr_A(){.....}
public final String getZstr_A(){.....}
You could see the code duplication here and decide to implement a Scalar class, but I decided that was overkill for my purposes.
Fantastic idea of embedding the unit in the method name, I have been researching different ways of implementing units but have really only found that I need to convert everything to its base-unit and then if needed to use units for whatever convention I might be using. Also, a scalar class is not such a bad idea and for the gist of things, it would be overkill to show here.
Thanks
#14
Re: What is the Best Data Type For Accuracy?
Posted 15 June 2011 - 08:19 AM
#15
Re: What is the Best Data Type For Accuracy?
Posted 17 June 2011 - 06:17 PM
|
|

New Topic/Question
Reply





MultiQuote






|