cpu time calculation confusion

I am confuse here in simple multiplication and division ..
how come interval / clock_sec is not equal to cpu_time_used (check the code and compare with code - in the snap)

http://i.imgur.com/afva8.jpg
In the future port ur code in the forum. Most ppl here wont ever check links in questions.

What u'r asking is more a math question. Unless CLOCKS_PER_SEC = 1 they wont ever be the same...

case 1:
end - start = ?

case 2:
(end-start) / CLOCKS_PER_SEC = ?


example:
case 1:
10-4 = 6

case 2:
(10-4)/2 = 6/2 = 3
You lied in the format string,
@soranz
thanks
that's true but I wanted to show output i was getting along with the code..

please check the output..
these lines makes no sense:-but output is displayed like this

[
end-start=2166.00000
CLOCKS_PER_SEC=2166.00000
(end-start) / CLOCKS_PER_SEC=2.166000
]

@ne555
I didn't get that..
is there any mistake in data types and all?
type casting == bad
closed account (o3hC5Di1)
Hi there,

To just give you a further hint here, I believe they are trying to make clear to you that you have some inconsistent code in your printf() statements.
Check if the placeholders (%x) are representing what you are feeding them, or want them to be.
Alternatively, use standard c++ std::cout if possible.

Hope that helps.

All the best,
NwN
Topic archived. No new replies allowed.