#INF ..what is happening is rather bizarre

I am writing a piece of code that outputs a list of DOUBLE numbers on screen.
I basically have 2 quantities,

1) a time step
2) a time total

The time step is a very small randomly generated number.
The time total is 0.0 and then time step is added each time to the total.

THE PROBLEM is that the time step prints fine.. the time total doesn't and all it prints is 1.#INF ..or 5.#INF basically it just shows the first figure and then that.. why is it doing it? how to fix it?

Thanks a lot for the help, the code is too long to upload on here but I think that some of you guys might know exactly what's happening and might be able to point me in the right direction as to how to fix it..

Clodi
Make sure you're not dividing by zero.
-------------- time step--------------- total
step n.0 3.280260E-008 3.280260E-008
step n.1 8.243102E-008 1.152336E-007
step n.2 5.761681E-008 1.728504E-007
step n.3 5.761681E-008 2.304672E-007
step n.4 3.771836E-009 2.342391E-007
step n.5 1.#INF00E+000 1.#INF00E+000
step n.6 7.988391E-009 1.#INF00E+000
step n.7 5.761681E-008 1.#INF00E+000
step n.8 1.276873E-008 1.#INF00E+000
step n.9 7.988391E-009 1.#INF00E+000
step n.10 7.988391E-009 1.#INF00E+000
step n.11 3.280260E-008 1.#INF00E+000
step n.12 1.#INF00E+000 1.#INF00E+000

The funny thing is, even if I was dividing by zero, why does the total start tripping as soon as the time step does? The stuff above is an example of what I am talking about
Last edited on
why does the total start tripping as soon as the time step does?
Well, if you add infinity to any other number, you will get infinity, it is logical.

I think, problem is in your number generator. Show it.
Topic archived. No new replies allowed.