import { eSign } from "./e-sign.js";
import { eNegativeOf } from "./e-negative-of.js";


// We *have* to do the below❗ The assignee is a getter❗ The assigned is a pure function❗
const sign = eSign;
const negativeOf = eNegativeOf;


/**
 * Returns the absolute value of the given floating point expansion.
 * 
 * * see [Shewchuk](https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf)
 * 
 * @param e a floating point expansion
 */
function eAbs(e: number[]) {
    if (e[e.length-1] < 0) {
        return negativeOf(e);
    }

    return e;
}


export { eAbs }
