From 02cc9a1ccf92cfe990c19cd6c7576f5925f00784 Mon Sep 17 00:00:00 2001 From: atsiv sivat Date: Sat, 31 Jan 2026 15:54:16 +0000 Subject: [PATCH] Add FromIEEEBinary Operation --- src/core/operations/FromIEEEBinary.mjs | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/core/operations/FromIEEEBinary.mjs diff --git a/src/core/operations/FromIEEEBinary.mjs b/src/core/operations/FromIEEEBinary.mjs new file mode 100644 index 000000000..9bbe2bc4a --- /dev/null +++ b/src/core/operations/FromIEEEBinary.mjs @@ -0,0 +1,47 @@ +/** + * @author atsiv1 + * @copyright Crown Copyright 2019 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import { FromIEEE754Float64 } from "../lib/IEEEBinary.mjs"; + +/** + * From IEEEBinary operation + */ +class FromIEEEBinary extends Operation { + /** + * FromIEEEBinary constructor + */ + constructor() { + super(); + + this.name = "From IEEEBinary"; + this.module = "Default"; + this.description = ` + Converts a 64-bit IEEE-754 binary64 representation (float64) + into its exact decimal value.

+ Example: 0 10000000010 0100000000000000000000000000000000000000000000000000 + becomes 10.`; + this.infoURL = "https://en.wikipedia.org/wiki/IEEE_754"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + if (!input || input.trim().length === 0) { + return ""; + } + + return FromIEEE754Float64(input); + } +} + +export default FromIEEEBinary;