dthompson16
08-28-2005, 08:47 PM
I am writing an app in which I'm trying to convert any # of seconds to minutes + seconds. When I tried to convert 55555.365 seconds, the result I got was 925 minutes and 55.3649999 seconds. The code I used is:
if Sec >= 60 then
NewNum = Sec / 60;
Min1 = Math.Floor(NewNum);
Expanded = Min1 * 60;
Sec1 = Sec - Expanded;
end
In 2 paragraph objects, I display Min1 and Sec1.
This works correctly if I enter 55.365, 555.365, or even 5555.365. However, entering 55555.365 gives the erroneous result. In the format XXXXX.365, I didn't encounter any problems until XXXXX got to be 32800 or higher, at which point the "9999" stuff started appearing. Ugh!
:huh
if Sec >= 60 then
NewNum = Sec / 60;
Min1 = Math.Floor(NewNum);
Expanded = Min1 * 60;
Sec1 = Sec - Expanded;
end
In 2 paragraph objects, I display Min1 and Sec1.
This works correctly if I enter 55.365, 555.365, or even 5555.365. However, entering 55555.365 gives the erroneous result. In the format XXXXX.365, I didn't encounter any problems until XXXXX got to be 32800 or higher, at which point the "9999" stuff started appearing. Ugh!
:huh