/** * Returns the (presentation) MathML representation of the number * * @param {object} [options] - Optional options to style the output * @return {string} */ toMathML(options : toPresentationOptions = {}) : string { var str = '', option, reFlag = !MathLib.isZero(this.re), passOptions : toPresentationOptions = {}; if (!this.isFinite()) { return (options.sign ? '+' : '') + 'Complex' + this.re + ''; } if (!MathLib.isZero(this.im)) { for (option in options) { if (options.hasOwnProperty(option) && option !== 'sign') { passOptions[option] = options[option]; } } if (reFlag || options.sign) { passOptions.sign = false; str += '' + MathLib.toString(this.im, {sign: true}).slice(0, 1) + '' + MathLib.toMathML(MathLib.abs(this.im), passOptions) + '⁢i'; } else { str += '' + MathLib.toMathML(this.im, passOptions) + '⁢i'; } } if (reFlag || str.length === 0) { str = MathLib.toMathML(this.re, options) + str; } return str; }