Alfonsus Hartanto

Greenhorn

Posts: 20

posted 8 years ago

hello guys, i just curious. how could i calculate a number that have more than 64 bit, let say 128 bit. Because as we know, the biggest primitive variable is long, which is 64 bit.

and if I calculate something, can i know how much time computers need/spend to calculate it?

thanks,, sorry for my english, im not english speaker anyway...

and if I calculate something, can i know how much time computers need/spend to calculate it?

thanks,, sorry for my english, im not english speaker anyway...

posted 8 years ago

check out the BigInteger class.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Alfonsus Hartanto

Greenhorn

Posts: 20

posted 8 years ago

This will be taught in your algorithms class.

And if you took algorithms already and don't recall. Remember that whole study on how an algorithm scales (big O notation)? Basically, once you figure out how something scales, you can take a few large samplings (but still tolerable in time) and from that, extrapolate how long it will take for an even larger calculation to take.

Henry

oh ya, another question, how could I know how much time computer spend to calculate certain operation...

This will be taught in your algorithms class.

And if you took algorithms already and don't recall. Remember that whole study on how an algorithm scales (big O notation)? Basically, once you figure out how something scales, you can take a few large samplings (but still tolerable in time) and from that, extrapolate how long it will take for an even larger calculation to take.

Henry

posted 8 years ago

To calculate time....

get the time in milliseconds before the calculation (say t1)

get the time in milliseconds after the calculation (say t2)

To know the time spent in milliseconds, calculate difference (say t2-t1)

get the time in milliseconds before the calculation (say t1)

get the time in milliseconds after the calculation (say t2)

To know the time spent in milliseconds, calculate difference (say t2-t1)

I agree. Here's the better link: Salvin.in