Alex Rivera | Logout

Datatypes for physics

Asked 2008-08-26T19:20:35.493
10

I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other)

What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#?

Also, what's the smallest ammount of time I can get between t and t+1? One tick?

EDIT: Clarifying: What is the smallest unit of time in C#? [TimeSpan].Tick?

Edit
Report

1 Answer

9

In .Net a decimal will be the most precise datatype that you could use for position. I would just write a class for the position:

public class Position
{
    decimal x;
    decimal y;
    decimal z;
}

As for time, your processor can't give you anything smaller than one tick.

Sounds like an fun project! Good luck!

answered 2008-08-26T19:27:49.203

Your Answer