/* this file is auto-generated, do not modify */
let wasm;

function addToExternrefTable0(obj) {
    const idx = wasm.__externref_table_alloc();
    wasm.__wbindgen_export_2.set(idx, obj);
    return idx;
}

function handleError(f, args) {
    try {
        return f.apply(this, args);
    } catch (e) {
        const idx = addToExternrefTable0(e);
        wasm.__wbindgen_exn_store(idx);
    }
}

let WASM_VECTOR_LEN = 0;

let cachedUint8ArrayMemory0 = null;

function getUint8ArrayMemory0() {
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
    }
    return cachedUint8ArrayMemory0;
}

const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );

const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
    ? function (arg, view) {
    return cachedTextEncoder.encodeInto(arg, view);
}
    : function (arg, view) {
    const buf = cachedTextEncoder.encode(arg);
    view.set(buf);
    return {
        read: arg.length,
        written: buf.length
    };
});

function passStringToWasm0(arg, malloc, realloc) {

    if (realloc === undefined) {
        const buf = cachedTextEncoder.encode(arg);
        const ptr = malloc(buf.length, 1) >>> 0;
        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
        WASM_VECTOR_LEN = buf.length;
        return ptr;
    }

    let len = arg.length;
    let ptr = malloc(len, 1) >>> 0;

    const mem = getUint8ArrayMemory0();

    let offset = 0;

    for (; offset < len; offset++) {
        const code = arg.charCodeAt(offset);
        if (code > 0x7F) break;
        mem[ptr + offset] = code;
    }

    if (offset !== len) {
        if (offset !== 0) {
            arg = arg.slice(offset);
        }
        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
        const ret = encodeString(arg, view);

        offset += ret.written;
        ptr = realloc(ptr, len, offset, 1) >>> 0;
    }

    WASM_VECTOR_LEN = offset;
    return ptr;
}

let cachedDataViewMemory0 = null;

function getDataViewMemory0() {
    if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
        cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
    }
    return cachedDataViewMemory0;
}

function debugString(val) {
    // primitive types
    const type = typeof val;
    if (type == 'number' || type == 'boolean' || val == null) {
        return  `${val}`;
    }
    if (type == 'string') {
        return `"${val}"`;
    }
    if (type == 'symbol') {
        const description = val.description;
        if (description == null) {
            return 'Symbol';
        } else {
            return `Symbol(${description})`;
        }
    }
    if (type == 'function') {
        const name = val.name;
        if (typeof name == 'string' && name.length > 0) {
            return `Function(${name})`;
        } else {
            return 'Function';
        }
    }
    // objects
    if (Array.isArray(val)) {
        const length = val.length;
        let debug = '[';
        if (length > 0) {
            debug += debugString(val[0]);
        }
        for(let i = 1; i < length; i++) {
            debug += ', ' + debugString(val[i]);
        }
        debug += ']';
        return debug;
    }
    // Test for built-in
    const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
    let className;
    if (builtInMatches && builtInMatches.length > 1) {
        className = builtInMatches[1];
    } else {
        // Failed to match the standard '[object ClassName]'
        return toString.call(val);
    }
    if (className == 'Object') {
        // we're a user defined class or Object
        // JSON.stringify avoids problems with cycles, and is generally much
        // easier than looping through ownProperties of `val`.
        try {
            return 'Object(' + JSON.stringify(val) + ')';
        } catch (_) {
            return 'Object';
        }
    }
    // errors
    if (val instanceof Error) {
        return `${val.name}: ${val.message}\n${val.stack}`;
    }
    // TODO we could test for more things here, like `Set`s and `Map`s.
    return className;
}

function isLikeNone(x) {
    return x === undefined || x === null;
}

const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );

if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };

function getStringFromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}

function _assertClass(instance, klass) {
    if (!(instance instanceof klass)) {
        throw new Error(`expected instance of ${klass.name}`);
    }
}

const FloatFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_float_free(ptr >>> 0, 1));

export class Float {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(Float.prototype);
        obj.__wbg_ptr = ptr;
        FloatFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        FloatFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_float_free(ptr, 0);
    }
    /**
     * Returns the 32-byte hexadecimal string representation of the float.
     *
     * # Returns
     *
     * * `String` - The 32-byte hex string.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.fromHex("0x0000000000000000000000000000000000000000000000000000000000000005").value!;
     * assert(float.asHex() === "0x0000000000000000000000000000000000000000000000000000000000000005");
     * ```
     * @returns {`0x${string}`}
     */
    asHex() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.float_asHex(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * Convert the float to a JS/TS bigint equivalent of `asHex()` returned hex string.
     *
     * # Throws
     * if conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.fromHex("0xfffffffe0000000000000000000000000000000000000000000000000000013a");
     * const value = float.toBigInt();
     * assert(value === 115792089183396302089269705419353877679230723318366275194376439045705909141818n);
     * ```
     * @returns {bigint}
     */
    toBigint() {
        const ret = wasm.float_toBigint(this.__wbg_ptr);
        return ret;
    }
    /**
     * Constructs a `Float` from a bigint equivalent of the `fromHex()` returned Float.
     *
     * # Throws
     * if conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.fromBigint(115792089183396302089269705419353877679230723318366275194376439045705909141818n);
     * assert(float.asHex() === "0xfffffffe0000000000000000000000000000000000000000000000000000013a");
     * ```
     * @param {bigint} value
     * @returns {Float}
     */
    static fromBigint(value) {
        const ret = wasm.float_fromBigint(value);
        return Float.__wrap(ret);
    }
    /**
     * Tries to convert the float to a JS/TS bigint equivalent of `asHex()` returned hex string.
     *
     * # Returns
     *
     * * `Ok(bigint)` - The resulting `bigint` value.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.fromHex("0xfffffffe0000000000000000000000000000000000000000000000000000013a");
     * const bigintResult = float.tryToBigInt();
     * if (bigintResult.error) {
     *     console.error(bigintResult.error);
     * }
     * assert(bigintResult.value === 115792089183396302089269705419353877679230723318366275194376439045705909141818n);
     * ```
     * @returns {WasmEncodedResult<bigint>}
     */
    tryToBigint() {
        const ret = wasm.float_tryToBigint(this.__wbg_ptr);
        return ret;
    }
    /**
     * Constructs a `Float` from a bigint equivalent of the `fromHex()` returned Float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The resulting `Float` value.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.tryFromBigint(115792089183396302089269705419353877679230723318366275194376439045705909141818n);
     * if (floatResult.error) {
     *   console.error(floatResult.error);
     * }
     * const value = float.value;
     * assert(value.asHex() === "0xfffffffe0000000000000000000000000000000000000000000000000000013a");
     * ```
     * @param {bigint} value
     * @returns {WasmEncodedResult<Float>}
     */
    static tryFromBigint(value) {
        const ret = wasm.float_tryFromBigint(value);
        return ret;
    }
    /**
     * Converts a fixed-point decimal value to a `Float` using the specified number of decimals.
     *
     * # Arguments
     *
     * * `value` - The fixed-point decimal value as a `string`.
     * * `decimals` - The number of decimals in the fixed-point representation.
     *
     * # Returns
     *
     * * `Ok(Float)` - The resulting `Float` value.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.fromFixedDecimal("12345", 2);
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.format() === "123.45");
     * ```
     * @param {bigint} value
     * @param {number} decimals
     * @returns {WasmEncodedResult<Float>}
     */
    static fromFixedDecimal(value, decimals) {
        const ret = wasm.float_fromFixedDecimal(value, decimals);
        return ret;
    }
    /**
     * Converts a `Float` to a fixed-point decimal value using the specified number of decimals.
     *
     * # Arguments
     *
     * * `decimals` - The number of decimals in the fixed-point representation.
     *
     * # Returns
     *
     * * `Ok(String)` - The resulting fixed-point decimal value as a string.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.parse("123.45").value!;
     * const result = float.toFixedDecimal(2);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value === "12345");
     * ```
     * @param {number} decimals
     * @returns {WasmEncodedResult<bigint>}
     */
    toFixedDecimal(decimals) {
        const ret = wasm.float_toFixedDecimal(this.__wbg_ptr, decimals);
        return ret;
    }
    /**
     * Converts a fixed-point decimal value to a `Float` using the specified number of decimals lossy.
     *
     * # Arguments
     *
     * * `value` - The fixed-point decimal value as a `string`.
     * * `decimals` - The number of decimals in the fixed-point representation.
     *
     * # Returns
     *
     * * `Ok(Float)` - The resulting `Float` value.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.fromFixedDecimalLossy("12345", 2);
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.format() === "123.45");
     * ```
     * @param {bigint} value
     * @param {number} decimals
     * @returns {WasmEncodedResult<Float>}
     */
    static fromFixedDecimalLossy(value, decimals) {
        const ret = wasm.float_fromFixedDecimalLossy(value, decimals);
        return ret;
    }
    /**
     * Converts a `Float` to a fixed-point decimal value using the specified number of decimals lossy.
     *
     * # Arguments
     *
     * * `decimals` - The number of decimals in the fixed-point representation.
     *
     * # Returns
     *
     * * `Ok(String)` - The resulting fixed-point decimal value as a string.
     * * `Err(FloatError)` - If the conversion fails.
     *
     * # Example
     *
     * ```typescript
     * const float = Float.fromFixedDecimal(12345n, 3).value!;
     * const result = float.toFixedDecimalLossy(2);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value === "1234");
     * ```
     * @param {number} decimals
     * @returns {WasmEncodedResult<bigint>}
     */
    toFixedDecimalLossy(decimals) {
        const ret = wasm.float_toFixedDecimalLossy(this.__wbg_ptr, decimals);
        return ret;
    }
    /**
     * Parses a decimal string into a `Float`.
     *
     * # Arguments
     *
     * * `str` - The string to parse.
     *
     * # Returns
     *
     * * `Ok(Float)` - The parsed float.
     * * `Err(FloatError)` - If parsing fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.parse("3.1415");
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.format() === "3.1415");
     * ```
     * @param {string} str
     * @returns {WasmEncodedResult<Float>}
     */
    static parse(str) {
        const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.float_parse(ptr0, len0);
        return ret;
    }
    /**
     * Constructs a `Float` from a 32-byte hexadecimal string.
     *
     * # Arguments
     *
     * * `hex` - The 32-byte hex string to parse.
     *
     * # Returns
     *
     * * `Ok(Float)` - The float parsed from the hex string.
     * * `Err(FloatError)` - If the hex string is not valid or not 32 bytes.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.fromHex("0x0000000000000000000000000000000000000000000000000000000000000005");
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.asHex() === "0x0000000000000000000000000000000000000000000000000000000000000005");
     * ```
     * @param {`0x${string}`} hex
     * @returns {WasmEncodedResult<Float>}
     */
    static fromHex(hex) {
        const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.float_fromHex(ptr0, len0);
        return ret;
    }
    /**
     * Returns the maximum positive value that can be represented as a `Float`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The maximum positive value.
     * * `Err(FloatError)` - If the EVM call fails.
     *
     * # Example
     *
     * ```typescript
     * const maxPosResult = Float.maxPositiveValue();
     * if (maxPosResult.error) {
     *    console.error(maxPosResult.error);
     * }
     * const maxPos = maxPosResult.value;
     * assert(!maxPos.format().error);
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    static maxPositiveValue() {
        const ret = wasm.float_maxPositiveValue();
        return ret;
    }
    /**
     * Returns the minimum positive value that can be represented as a `Float`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The minimum positive value.
     * * `Err(FloatError)` - If the EVM call fails.
     *
     * # Example
     *
     * ```typescript
     * const minPosResult = Float.minPositiveValue();
     * if (minPosResult.error) {
     *    console.error(minPosResult.error);
     * }
     * const minPos = minPosResult.value;
     * assert(!minPos.format().error);
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    static minPositiveValue() {
        const ret = wasm.float_minPositiveValue();
        return ret;
    }
    /**
     * Returns the maximum negative value that can be represented as a `Float`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The maximum negative value (closest to zero).
     * * `Err(FloatError)` - If the EVM call fails.
     *
     * # Example
     *
     * ```typescript
     * const maxNegResult = Float.maxNegativeValue();
     * if (maxNegResult.error) {
     *    console.error(maxNegResult.error);
     * }
     * const maxNeg = maxNegResult.value;
     * assert(!maxNeg.format().error);
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    static maxNegativeValue() {
        const ret = wasm.float_maxNegativeValue();
        return ret;
    }
    /**
     * Returns the minimum negative value that can be represented as a `Float`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The minimum negative value (furthest from zero).
     * * `Err(FloatError)` - If the EVM call fails.
     *
     * # Example
     *
     * ```typescript
     * const minNegResult = Float.minNegativeValue();
     * if (minNegResult.error) {
     *    console.error(minNegResult.error);
     * }
     * const minNeg = minNegResult.value;
     * assert(!minNeg.format().error);
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    static minNegativeValue() {
        const ret = wasm.float_minNegativeValue();
        return ret;
    }
    /**
     * Returns the zero value of a `Float` in its maximized representation.
     *
     * # Returns
     *
     * * `Ok(Float)` - The zero value.
     * * `Err(FloatError)` - If the EVM call fails.
     *
     * # Example
     *
     * ```typescript
     * const zeroResult = Float.zero();
     * if (zeroResult.error) {
     *    console.error(zeroResult.error);
     * }
     * const zero = zeroResult.value;
     * assert(zero.isZero().value);
     * assert(zero.format().value === "0");
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    static zero() {
        const ret = wasm.float_zero();
        return ret;
    }
    /**
     * Formats the float as a decimal string.
     *
     * # Returns
     *
     * * `Ok(String)` - The formatted string.
     * * `Err(FloatError)` - If formatting fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.parse("2.5");
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.format() === "2.5");
     * ```
     * @returns {WasmEncodedResult<String>}
     */
    format() {
        const ret = wasm.float_format(this.__wbg_ptr);
        return ret;
    }
    /**
     * Formats the float as a decimal string with a specified significant figures limit.
     *
     * # Arguments
     *
     * * `sig_figs_limit` - The significant figures limit.
     *
     * # Returns
     *
     * * `Ok(String)` - The formatted string.
     * * `Err(FloatError)` - If formatting fails.
     *
     * # Example
     *
     * ```typescript
     * const floatResult = Float.parse("3.14159265359");
     * if (floatResult.error) {
     *    console.error(floatResult.error);
     * }
     * const float = floatResult.value;
     * assert(float.formatWithLimit(5) === "3.1416");
     * ```
     * @param {number} sig_figs_limit
     * @returns {WasmEncodedResult<String>}
     */
    formatWithLimit(sig_figs_limit) {
        const ret = wasm.float_formatWithLimit(this.__wbg_ptr, sig_figs_limit);
        return ret;
    }
    /**
     * Returns `true` if `self` is less than `b`.
     *
     * # Arguments
     *
     * * `b` - The `Float` value to compare with `self`.
     *
     * # Returns
     *
     * * `Ok(true)` if `self` is less than `b`.
     * * `Ok(false)` if `self` is not less than `b`.
     * * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("1.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.lt(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<boolean>}
     */
    lt(b) {
        _assertClass(b, Float);
        const ret = wasm.float_lt(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns `true` if `self` is equal to `b`.
     *
     * # Arguments
     *
     * * `b` - The `Float` value to compare with `self`.
     *
     * # Returns
     *
     * * `Ok(true)` if `self` is equal to `b`.
     * * `Ok(false)` if `self` is not equal to `b`.
     * * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("2.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.eq(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<boolean>}
     */
    eq(b) {
        _assertClass(b, Float);
        const ret = wasm.float_eq(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns `true` if `self` is less than or equal to `b`.
     *
     * # Arguments
     *
     * * `b` - The `Float` value to compare with `self`.
     *
     * # Returns
     *
     * * `Ok(true)` if `self` is less than or equal to `b`.
     * * `Ok(false)` if `self` is not less than or equal to `b`.
     * * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("1.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.lte(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<boolean>}
     */
    lte(b) {
        _assertClass(b, Float);
        const ret = wasm.float_lte(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns `true` if `self` is greater than or equal to `b`.
     *
     * # Arguments
     *
     * * `b` - The `Float` value to compare with `self`.
     *
     * # Returns
     *
     * * `Ok(true)` if `self` is greater than or equal to `b`.
     * * `Ok(false)` if `self` is not greater than or equal to `b`.
     * * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("2.0").value!;
     * const b = Float.parse("1.0").value!;
     * const result = a.gte(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<boolean>}
     */
    gte(b) {
        _assertClass(b, Float);
        const ret = wasm.float_gte(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns `true` if `self` is greater than `b`.
     *
     * # Arguments
     *
     * * `b` - The `Float` value to compare with `self`.
     *
     * # Returns
     *
     * * `Ok(true)` if `self` is greater than `b`.
     * * `Ok(false)` if `self` is not greater than `b`.
     * * `Err(FloatError)` if the comparison fails due to an error in the underlying EVM call or decoding.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("2.0").value!;
     * const b = Float.parse("1.0").value!;
     * const result = a.gt(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<boolean>}
     */
    gt(b) {
        _assertClass(b, Float);
        const ret = wasm.float_gt(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the multiplicative inverse of the float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The inverse.
     * * `Err(FloatError)` - If inversion fails.
     *
     * # Example
     *
     * ```typescript
     * const x = Float.parse("2.0").value!;
     * const inv = x.inv();
     * if (inv.error) {
     *    console.error(inv.error);
     * }
     * assert(inv.value.format().startsWith("0.5"));
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    inv() {
        const ret = wasm.float_inv(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the absolute value of the float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The absolute value.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const x = Float.parse("-3.14").value!;
     * const abs = x.abs();
     * if (abs.error) {
     *    console.error(abs.error);
     * }
     * assert(abs.value.format() === "3.14");
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    abs() {
        const ret = wasm.float_abs(this.__wbg_ptr);
        return ret;
    }
    /**
     * Adds two floats.
     *
     * # Returns
     *
     * * `Ok(Float)` - The sum.
     * * `Err(FloatError)` - If addition fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("1.5").value!;
     * const b = Float.parse("2.5").value!;
     * const result = a.add(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "4");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    add(b) {
        _assertClass(b, Float);
        const ret = wasm.float_add(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Subtracts `b` from `self`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The difference.
     * * `Err(FloatError)` - If subtraction fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("5.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.sub(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "3");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    sub(b) {
        _assertClass(b, Float);
        const ret = wasm.float_sub(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Multiplies two floats.
     *
     * # Returns
     *
     * * `Ok(Float)` - The product.
     * * `Err(FloatError)` - If multiplication fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("2.0").value!;
     * const b = Float.parse("3.0").value!;
     * const result = a.mul(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "6");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    mul(b) {
        _assertClass(b, Float);
        const ret = wasm.float_mul(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Divides `self` by `b`.
     *
     * # Returns
     *
     * * `Ok(Float)` - The quotient.
     * * `Err(FloatError)` - If division fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("6.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.div(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "3");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    div(b) {
        _assertClass(b, Float);
        const ret = wasm.float_div(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the fractional part of the float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The fractional part.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const x = Float.parse("3.75").value!;
     * const result = x.frac();
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "0.75");
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    frac() {
        const ret = wasm.float_frac(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the floor of the float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The floored value.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const x = Float.parse("3.75").value!;
     * const result = x.floor();
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "3");
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    floor() {
        const ret = wasm.float_floor(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the minimum of `self` and `b`.
     *
     * # Arguments
     *
     * * `b` - The other `Float` to compare with.
     *
     * # Returns
     *
     * * `Ok(Float)` - The minimum value.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("1.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.min(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "1");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    min(b) {
        _assertClass(b, Float);
        const ret = wasm.float_min(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the maximum of `self` and `b`.
     *
     * # Arguments
     *
     * * `b` - The other `Float` to compare with.
     *
     * # Returns
     *
     * * `Ok(Float)` - The maximum value.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const a = Float.parse("1.0").value!;
     * const b = Float.parse("2.0").value!;
     * const result = a.max(b);
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "2");
     * ```
     * @param {Float} b
     * @returns {WasmEncodedResult<Float>}
     */
    max(b) {
        _assertClass(b, Float);
        const ret = wasm.float_max(this.__wbg_ptr, b.__wbg_ptr);
        return ret;
    }
    /**
     * Checks if the float is zero.
     *
     * # Returns
     *
     * * `Ok(true)` if the float is zero.
     * * `Ok(false)` if the float is not zero.
     * * `Err(FloatError)` if the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const zero = Float.parse("0").value!;
     * const result = zero.isZero();
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value);
     * ```
     * @returns {WasmEncodedResult<boolean>}
     */
    isZero() {
        const ret = wasm.float_isZero(this.__wbg_ptr);
        return ret;
    }
    /**
     * Returns the negation of the float.
     *
     * # Returns
     *
     * * `Ok(Float)` - The negated value.
     * * `Err(FloatError)` - If the operation fails.
     *
     * # Example
     *
     * ```typescript
     * const x = Float.parse("3.14").value!;
     * const result = x.neg();
     * if (result.error) {
     *    console.error(result.error);
     * }
     * assert(result.value.format() === "-3.14");
     * ```
     * @returns {WasmEncodedResult<Float>}
     */
    neg() {
        const ret = wasm.float_neg(this.__wbg_ptr);
        return ret;
    }
}

async function __wbg_load(module, imports) {
    if (typeof Response === 'function' && module instanceof Response) {
        if (typeof WebAssembly.instantiateStreaming === 'function') {
            try {
                return await WebAssembly.instantiateStreaming(module, imports);

            } catch (e) {
                if (module.headers.get('Content-Type') != 'application/wasm') {
                    console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);

                } else {
                    throw e;
                }
            }
        }

        const bytes = await module.arrayBuffer();
        return await WebAssembly.instantiate(bytes, imports);

    } else {
        const instance = await WebAssembly.instantiate(module, imports);

        if (instance instanceof WebAssembly.Instance) {
            return { instance, module };

        } else {
            return instance;
        }
    }
}

function __wbg_get_imports() {
    const imports = {};
    imports.wbg = {};
    imports.wbg.__wbg_BigInt_ddea6d2f55558acb = function() { return handleError(function (arg0) {
        const ret = BigInt(arg0);
        return ret;
    }, arguments) };
    imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
        const ret = String(arg1);
        const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
        getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
    };
    imports.wbg.__wbg_float_new = function(arg0) {
        const ret = Float.__wrap(arg0);
        return ret;
    };
    imports.wbg.__wbg_new_405e22f390576ce2 = function() {
        const ret = new Object();
        return ret;
    };
    imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
        arg0[arg1] = arg2;
    };
    imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
        const ret = Reflect.set(arg0, arg1, arg2);
        return ret;
    }, arguments) };
    imports.wbg.__wbg_toString_b5d4438bc26b267c = function() { return handleError(function (arg0, arg1) {
        const ret = arg0.toString(arg1);
        return ret;
    }, arguments) };
    imports.wbg.__wbg_toString_c813bbd34d063839 = function(arg0) {
        const ret = arg0.toString();
        return ret;
    };
    imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
        const ret = debugString(arg1);
        const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
        getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
    };
    imports.wbg.__wbindgen_init_externref_table = function() {
        const table = wasm.__wbindgen_export_2;
        const offset = table.grow(4);
        table.set(0, undefined);
        table.set(offset + 0, undefined);
        table.set(offset + 1, null);
        table.set(offset + 2, true);
        table.set(offset + 3, false);
        ;
    };
    imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
        const obj = arg1;
        const ret = typeof(obj) === 'string' ? obj : undefined;
        var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
        getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
    };
    imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
        const ret = getStringFromWasm0(arg0, arg1);
        return ret;
    };
    imports.wbg.__wbindgen_throw = function(arg0, arg1) {
        throw new Error(getStringFromWasm0(arg0, arg1));
    };

    return imports;
}

function __wbg_init_memory(imports, memory) {

}

function __wbg_finalize_init(instance, module) {
    wasm = instance.exports;
    __wbg_init.__wbindgen_wasm_module = module;
    cachedDataViewMemory0 = null;
    cachedUint8ArrayMemory0 = null;


    wasm.__wbindgen_start();
    return wasm;
}

function initSync(module) {
    if (wasm !== undefined) return wasm;


    if (typeof module !== 'undefined') {
        if (Object.getPrototypeOf(module) === Object.prototype) {
            ({module} = module)
        } else {
            console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
        }
    }

    const imports = __wbg_get_imports();

    __wbg_init_memory(imports);

    if (!(module instanceof WebAssembly.Module)) {
        module = new WebAssembly.Module(module);
    }

    const instance = new WebAssembly.Instance(module, imports);

    return __wbg_finalize_init(instance, module);
}

async function __wbg_init(module_or_path) {
    if (wasm !== undefined) return wasm;


    if (typeof module_or_path !== 'undefined') {
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
            ({module_or_path} = module_or_path)
        } else {
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
        }
    }

    if (typeof module_or_path === 'undefined') {
        module_or_path = new URL('float_bg.wasm', import.meta.url);
    }
    const imports = __wbg_get_imports();

    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
        module_or_path = fetch(module_or_path);
    }

    __wbg_init_memory(imports);

    const { instance, module } = await __wbg_load(await module_or_path, imports);

    return __wbg_finalize_init(instance, module);
}

import { Buffer } from 'buffer';
import wasmB64 from './float_wbg.json';
const bytes = Buffer.from(wasmB64.wasm, 'base64');
initSync(bytes);
