'use strict';

// MODULES //

var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
var setReadOnly = require( '@stdlib/utils/define-read-only-property' );


// MAIN //

/**
* 128-bit complex number constructor.
*
* @constructor
* @param {number} real - real component
* @param {number} imag - imaginary component
* @throws {TypeError} must invoke using the `new` keyword
* @throws {TypeError} real component must be a number primitive
* @throws {TypeError} imaginary component must be a number primitive
* @returns {Complex128} 128-bit complex number
*
* @example
* var z = new Complex128( 5.0, 3.0 );
* // returns <Complex128>
*/
function Complex128( real, imag ) {
	if ( !( this instanceof Complex128 ) ) {
		throw new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );
	}
	if ( !isNumber( real ) ) {
		throw new TypeError( 'invalid input argument. Real component must be a number primitive. Value: `'+real+'`.' );
	}
	if ( !isNumber( imag ) ) {
		throw new TypeError( 'invalid input argument. Imaginary component must be a number primitive. Value: `'+imag+'`.' );
	}
	Object.defineProperty( this, 're', {
		'configurable': false,
		'enumerable': true,
		'writable': false,
		'value': real
	});

	Object.defineProperty( this, 'im', {
		'configurable': false,
		'enumerable': true,
		'writable': false,
		'value': imag
	});

	// Note: we do not use a backing store coupled with getters, as numbers in JavaScript are double-precision by default.

	return this;
} // end FUNCTION Complex128()

/**
* Size (in bytes) of each component.
*
* @memberof Complex128
* @name BYTES_PER_ELEMENT
* @type {number}
* @returns {number} size of each component
*
* @example
* var nbytes = Complex128.BYTES_PER_ELEMENT;
* // returns 8
*/
setReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );

/**
* Size (in bytes) of each component.
*
* @memberof Complex128.prototype
* @name BYTES_PER_ELEMENT
* @type {number}
* @returns {number} size of each component
*
* @example
* var z = new Complex128( 5.0, 3.0 );
*
* var nbytes = z.BYTES_PER_ELEMENT;
* // returns 8
*/
setReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );

/**
* Length (in bytes) of a complex number.
*
* @memberof Complex128.prototype
* @name byteLength
* @type {number}
* @returns {number} byte length
*
* @example
* var z = new Complex128( 5.0, 3.0 );
*
* var nbytes = z.byteLength;
* // returns 16
*/
setReadOnly( Complex128.prototype, 'byteLength', 16 );

/**
* Serializes a complex number as a string.
*
* @memberof Complex128.prototype
* @name toString
* @type {Function}
* @returns {string} serialized complex number
*
* @example
* var z = new Complex128( 5.0, 3.0 );
*
* var str = z.toString();
* // returns '5 + 3i'
*/
setReadOnly( Complex128.prototype, 'toString', require( './tostring.js' ) );

/**
* Serializes a complex number as a JSON object.
*
* ## Notes
*
* * `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.
*
*
* @memberof Complex128.prototype
* @name toJSON
* @type {Function}
* @returns {Object} serialized complex number
*
* @example
* var z = new Complex128( 5.0, 3.0 );
*
* var obj = z.toJSON();
* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }
*/
setReadOnly( Complex128.prototype, 'toJSON', require( './tojson.js' ) );


// EXPORTS //

module.exports = Complex128;

@@ -2866,17 +2866,19 @@
 tes%0A*%0A* 
-*
+-  
  %60JSON.s

Fix list item style