mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-25 22:00:19 +08:00
Make Float min and max use correct typing
Due to how floating point works with rounding, setting min to `-sys.maxsize` and max to `sys.maxsize` will result in following error: ``` * PrimitiveFloat 969: - Value -9.223372036854776e+18 smaller than min of -9223372036854775807: value ``` The error arises because the floating-point approximation (-9.223372036854776e+18) is slightly smaller (i.e., more negative) than the precise integer value of -sys.maxsize (-9223372036854775807). Alternative approach would be to use sys.float_info.min and sys.float_info.max instead but that range might seem a bit excessive for a primitive node.
This commit is contained in:
parent
fb763d4333
commit
ea1c370368
@ -66,7 +66,7 @@ class Float(io.ComfyNode):
|
|||||||
display_name="Float",
|
display_name="Float",
|
||||||
category="utils/primitive",
|
category="utils/primitive",
|
||||||
inputs=[
|
inputs=[
|
||||||
io.Float.Input("value", min=-sys.maxsize, max=sys.maxsize),
|
io.Float.Input("value", min=float(-sys.maxsize), max=float(sys.maxsize)),
|
||||||
],
|
],
|
||||||
outputs=[io.Float.Output()],
|
outputs=[io.Float.Output()],
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user