Hey!

I've got a little question, why do we use long, instead of float or double, when we are using System.nanoTime();?

Thanks!

Printable View

- 12-27-2009, 10:46 PMrootpiSystem.nanoTime();
Hey!

I've got a little question, why do we use long, instead of float or double, when we are using System.nanoTime();?

Thanks! - 12-27-2009, 11:45 PMFubarable
Which is more accurate, long or double?

- 12-27-2009, 11:57 PMrootpi
- 12-28-2009, 09:21 AMtim
Hi Math.sqrt(Math.PI)! ;)

I'd just like to warn you about nanosecond accuracy measurements when analyzing algorithms, if you intend to do that. If you use millisecond accuracy to measure the runtime of an algorithm over one iteration, you may typically get 0 ms. So, then one would be tempted to use nanosecond accuracy. However, your machine will typically perform system and other processes within this period and interfere. And to isolate this, would be very difficult. Instead, the analyst should run a set of iterations and average the run time in millisecond accuracy. Repeated sets of measurements should be made.

Just something to keep in mind. ;)

Tim - 12-29-2009, 12:08 AMquad64bitQuote:

Repeated sets of measurements should be made

- 01-28-2011, 03:26 AMJunky
Fargin spambots!

- 01-28-2011, 03:38 AMFubarable
deleted. poster banned. thread locked.