Closed sgramsay closed 8 months ago
Taking the below example node code, utilising the increment/decrement handles results in weird precision issues, am I missing something or is this a bug? Entering numbers directly is fine.
import { defineNode, NodeInterface, NumberInterface, SelectInterface } from "baklavajs"; export default defineNode({ type: "MathNode", inputs: { number1: () => new NumberInterface("A", 1), number2: () => new NumberInterface("B", 10), operation: () => new SelectInterface("Operation", "Add", ["Add", "Subtract"]).setPort(false), }, outputs: { output: () => new NodeInterface("Output", 0), }, calculate({ number1, number2, operation }) { let output: Number console.log(number1,"-",number2) // Outputs 1.6000000000000005 '0' - 10 if (operation === "Add") { output = number1 + number2; } else if (operation === "Subtract") { output = number1 - number2; } else { throw new Error("Unknown operation: " + operation); } return { output }; }, });
V2 Beta 5 BTW
Fixed in v2.3.0
Taking the below example node code, utilising the increment/decrement handles results in weird precision issues, am I missing something or is this a bug? Entering numbers directly is fine.