diff --git a/README.md b/README.md index ea5a622..b4b4eaf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🔗 Comfyui : Bjornulf_custom_nodes v0.28 🔗 +# 🔗 Comfyui : Bjornulf_custom_nodes v0.29 🔗 # ❤️ Coffee : ☕☕☕☕☕ 5/5 @@ -76,6 +76,7 @@ wget --content-disposition -P /workspace/ComfyUI/models/checkpoints "https://civ - **v0.26**: New node : Loop write Text. Also increase nb of inputs allowed for most nodes. (+ update some breaking changes) - **v0.27**: Two new nodes : Loop (Model+Clip+Vae) and Random (Model+Clip+Vae) - aka Checkpoint / Model - **v0.28**: Fix random texts and add a lot of screenshots examples for several nodes. +- **v0.29**: Fix floating points issues with loop float node. # 📝 Nodes descriptions diff --git a/loop_float.py b/loop_float.py index 13ff9f3..90331d6 100644 --- a/loop_float.py +++ b/loop_float.py @@ -1,3 +1,4 @@ +from decimal import Decimal, ROUND_HALF_UP class LoopFloat: @classmethod @@ -17,8 +18,12 @@ class LoopFloat: def create_loop_float(self, from_this, to_that, jump): range_values = [] - current_value = from_this + current_value = Decimal(str(from_this)) + to_that = Decimal(str(to_that)) + jump = Decimal(str(jump)) + while current_value <= to_that: - range_values.append(round(current_value, 2)) # Round to two decimal places + range_values.append(float(current_value.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP))) current_value += jump - return (range_values,) + + return (range_values,) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6eb0208..0a7c638 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "bjornulf_custom_nodes" description = "Nodes: Ollama, Text to Speech, Combine Texts, Random Texts, Save image for Bjornulf LobeChat, Text with random Seed, Random line from input, Combine images, Image to grayscale (black & white), Remove image Transparency (alpha), Resize Image, ..." -version = "0.28" +version = "0.29" license = {file = "LICENSE"} [project.urls] diff --git a/screenshots/loop_float_example.png b/screenshots/loop_float_example.png index 339de21..0af2b59 100644 Binary files a/screenshots/loop_float_example.png and b/screenshots/loop_float_example.png differ