UNPKG

@abaplint/runtime

Version:
51 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DecFloat34 = void 0; const _1 = require("."); const hex_1 = require("./hex"); const xstring_1 = require("./xstring"); class DecFloat34 { constructor() { this.value = 0; } clone() { const n = new DecFloat34(); n.value = this.value; return n; } set(value) { if (typeof value === "number") { this.value = value; } else if (typeof value === "string" && value.trim().length === 0) { this.value = 0; } else if (typeof value === "string") { this.value = parseFloat(value); } else if (value instanceof _1.Float) { this.value = value.getRaw(); } else if (value instanceof hex_1.Hex || value instanceof xstring_1.XString) { // todo, how/if should this work? this.set(parseInt(value.get(), 16)); } else { this.set(value.get()); } return this; } clear() { this.value = 0; } getRaw() { return this.value; } get() { let text = new Number(this.value).toString(); text = text.replace(".", ","); return text; } } exports.DecFloat34 = DecFloat34; //# sourceMappingURL=decfloat34.js.map