Discrepancy: number comparison differs from Processing Java `(0.1 + 0.2 == 0.3)`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Run the provided Processing Java and mewnala Python sketches to confirm the differing results. Then trace the numeric evaluation behavior in the Rust implementation and determine whether the discrepancy should be fixed or documented, with a test or documentation update defining the expected behavior.
Written by the indexing model from the issue text.
Description
I don't know whether this is something that needs to be addressed or just documented.
I suppose this is related to the difference between float and double precision (?)
In Processing, this condition evaluates to true:
void setup() {
size(400, 400);
if (0.1 + 0.2 == 0.3) {
background(0, 255, 0);
circle(200, 200, 100);
}
}
The equivalent mewnala sketch evaluates the condition as false.
from mewnala import *
def setup():
size(200, 200)
if 0.1 + 0.2 == 0.3:
background(0, 255, 0)
circle(200, 200, 100)
run()
Note: size is reduced in mewnala to account for https://github.com/processing/libprocessing/issues/198
- Dominant language
- Rust
- Stars
- 69
- Forks
- 14
- Avg merge
- 15d 22h
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from processing/libprocessing
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
processing/libprocessing#233 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
processing/libprocessing#229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
processing/libprocessing#201 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
processing/libprocessing#194 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
processing/libprocessing#146 · 1 comment ·
All issues in processing/libprocessing
Similar issues
-
todo:perf
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
ACP agents get no MCP servers when the thread is created before the project's first worktree loads Openstate:needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zed-industries/zed#64611 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
objectionary/phie#154 ·