Commit c0fd414c authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 68d1de0b
Pipeline #2868 passed with stage
in 2 seconds
<html>
<body>
<script>
//
// inlinepi.js
// Neil Gershenfeld 11/24/18
// pi calculation benchmark
// pi = 3.14159265358979323846
//
function pi() {
var points = 1e9
var a = 0.5
var b = 0.75
var c = 0.25
var pi = 0
var tstart = Date.now()/1000
for (var i = 1; i <= points; ++i)
pi += a/((i-b)*(i-c))
var tend = Date.now()/1000
var mflops = points*5.0*1e-6/(tend-tstart)
console.log('function:')
console.log('pi: '+pi)
console.log('time: '+(tend-tstart).toFixed(1)+'s')
console.log('estimated MFlops: '+mflops.toFixed(1))
}
pi()
var points = 1e8
var a = 0.5
var b = 0.75
var c = 0.25
var pi = 0
var tstart = Date.now()/1000
for (var i = 1; i <= points; ++i)
pi += a/((i-b)*(i-c))
var tend = Date.now()/1000
var mflops = points*5.0*1e-6/(tend-tstart)
console.log('inline:')
console.log('pi: '+pi)
console.log('time: '+(tend-tstart).toFixed(1)+'s')
console.log('estimated MFlops: '+mflops.toFixed(1))
</script>
</body>
</html>
<html>
<body>
<script>
//
// serialpi.js
// Neil Gershenfeld 11/24/18
// pi calculation benchmark
// pi = 3.14159265358979323846
//
function pi() {
var points = 1e10
var a = 0.5
var b = 0.75
var c = 0.25
var pi = 0
var tstart = Date.now()/1000
for (var i = 1; i <= points; ++i)
pi += a/((i-b)*(i-c))
var tend = Date.now()/1000
var mflops = points*5.0*1e-6/(tend-tstart)
console.log('pi: '+pi)
console.log('time: '+(tend-tstart).toFixed(1)+'s')
console.log('estimated MFlops: '+mflops.toFixed(1))
}
pi()
</script>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment