Thread: Accuracy changes under different modes

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    79

    Accuracy changes under different OS modes

    Hello everyone. I had created a program to simulate the motion of a projectile. My problem is that when I run the program under Windows, I get less accurate results than when I run it under DOS. Why is it so?
    Last edited by sundeeptuteja; 07-08-2003 at 09:22 AM.

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    79
    Hello again. Actually my problem really appears to be independent of the source code. The fact is that the same executable when running under DOS gives different results from those that come when the program runs under Windows. I am unable to understand why this should happen. Perhaps I can just explain the logic of the program instead of writing new code.

    The program attempts to simulate the motion of a projectile fired close to a planet's surface(i.e. acceleration due to gravity can be approximated as a constant) neglecting air resistance, using the equation of a projectile, which happens to be a parabola. Now, the total time delay between the starting and ending of the simulation should be the same as the theoretically calculated value for time of flight(assuming a time compression factor of 1). Both results are shown in the program, along with the deviation from the theoretical result, after the simulation has ended.

    An example of input could be as follows...
    Initial speed : 60
    Angle of inclination : 45
    Acceleration due to gravity : 9.81 (for Earth)
    Initial height : 0
    Time Compression Factor : 1

    When run under Windows(Windows 98 in my case)...
    Theoretical time of flight : 8.64s
    Actual time of flight(i.e. computed by the program) : 7.49s

    When run under DOS(i.e. if the computer is started in the DOS command line mode)
    Theoretical time of flight : 8.64s
    Actual time of flight(i.e. computed by the same program) : 8.52s

    I am unable to understand why there should be a difference between the two values of actual time of flight. In other words, why should this time delay depend on the mode in which the program is executed.
    It might seem small here, but for other sets of input values, this difference turns out to be phenomenal.

    I hope this information is sufficient.
    Please help me out.
    Last edited by sundeeptuteja; 07-08-2003 at 07:08 AM.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    79
    Hello again. It seems we have been going around in circles, but I guess your last post has answered my question. Yes, the compiler is indeed an "old fossil", but it seems to be the only compiler I know of which supports DOS BGI graphics, and it happens to be the one we use at college. So no choice there. Any ideas about a newer compiler which has an IDE, and similar features?

  4. #4
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282
    get borland commandline tools 5.5

    and get a free IDE for it from download.com or search for one in google.

    actually, i use notepad myself as i dont like /find IDEs that useful,
    (they're very complicated for their purpose)
    at least, for the programs that i write.

    instead of notepad, i suggest win32pad ... very "light" like
    notepad but has some extra features like file history,
    icons, most importantly, line numbers.


    there're a couple of editors that have syntax highliting and stuff like that but ultimately, it is like a taste. and i am fine
    with/suggest notepad or win32pad.
    Last edited by moonwalker; 07-08-2003 at 11:05 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-02-2008, 10:00 PM
  2. mouse accuracy
    By joed in forum Windows Programming
    Replies: 3
    Last Post: 06-25-2005, 04:52 PM
  3. Speeding up the computation without losing accuracy
    By u05rdh in forum C++ Programming
    Replies: 1
    Last Post: 10-26-2003, 11:17 AM
  4. accuracy
    By major_small in forum C++ Programming
    Replies: 10
    Last Post: 10-15-2003, 05:55 AM
  5. changing accuracy of output from an input value
    By GCobbz in forum C Programming
    Replies: 1
    Last Post: 03-26-2003, 12:24 PM