Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <chrono>
- #include <cmath>
- //using real = double;
- using real = float;
- int main() {
- const int numObj = 4096000;
- const real divisor = 2.35;
- std::chrono::time_point< std::chrono::high_resolution_clock > start, end;
- start = std::chrono::high_resolution_clock::now();
- for ( int i = 1; i <= numObj; ++i ) {
- real val = static_cast< real >( i );
- val *= val - val / divisor;
- val = sqrt( val ) * val + val / ( divisor * sqrt( val ) );
- }
- end = std::chrono::high_resolution_clock::now();
- std::chrono::duration< double > delta = end - start;
- std::cout << "Elapsed, s: " << delta.count() << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement