'use strict';

// TODO: clean-up

var abs = require( '@stdlib/math/base/special/abs' );
var divide = require( 'compute-divide' );
var mean = require( 'compute-mean' );
var subtract = require( 'compute-subtract' );
var exp = require( './../lib' );

var data = require( './fixtures/julia/data.json' );

var x = data.x;
var yexpected = data.expected;
var ycustom = new Array( x.length );
var ynative = new Array( x.length );
for ( var i = 0; i < x.length; i++ ) {
	ycustom[ i ] = exp( x[ i ] );
	ynative[ i ] = Math.exp( x[ i ] );
}

var customErrs = abs( divide( subtract( ycustom, yexpected ), yexpected ) );
var nativeErrs = abs( divide( subtract( ynative, yexpected ), yexpected ) );

console.log( 'The mean relative error of Math.exp compared to Julia is %d', mean( nativeErrs ) );
console.log( 'The mean relative error of this module compared to Julia is %d', mean( customErrs ) );

@@ -27,16 +27,31 @@
 ean-up%0A%0A
+// MODULES //%0A%0A
 var abs 
@@ -252,24 +252,41 @@
 ../lib' );%0A%0A
+%0A// FIXTURES //%0A%0A
 var data = r
@@ -330,28 +330,121 @@
 );%0A%0A
-var x = data.x;%0Avar 
+%0A// MAIN //%0A%0Avar customErrs;%0Avar nativeErrs;%0Avar yexpected;%0Avar ycustom;%0Avar ynative;%0Avar x;%0Avar i;%0A%0Ax = data.x;%0A
 yexp
@@ -462,28 +462,24 @@
 a.expected;%0A
-var 
 ycustom = ne
@@ -499,20 +499,16 @@
 ngth );%0A
-var 
 ynative 
@@ -541,12 +541,8 @@
 or (
- var
  i =
@@ -637,20 +637,16 @@
 %5D );%0A%7D%0A%0A
-var 
 customEr
@@ -710,20 +710,16 @@
 ed ) );%0A
-var 
 nativeEr

Move variable declarations