For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > April 2004 > problems with doubles









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author problems with doubles
mikeg

2004-04-27, 7:08 pm

double A = floor((2447297.0 - 122.1)/365.25);
i get differing results. It varies between 6699 and 6700. The correct
answer is 6699.
The 6700 result really throws the entire group of calculations off.

I am using VC++ 6.0 on a P4 with XP Home Edition.

I did some more checking and the problem is in the substraction.

The same system returns varying results in different projects.
We use julian day numbers for calculating dates within a game. If I unit
test the class the floor function returns 6699. But when the class is in
game, the flooring function returns 6700.


Any suggestions welcome.
Thanks Mike

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com