processing / processing/libprocessing
Discrepancy: number comparison differs from Processing Java `(0.1 + 0.2 == 0.3)`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 69
- Forks
- 14
- Avg merge
- 15d 22h
- Merged PRs (30d)
- 3
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
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.
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.
Assessment
- Tech stack
- java, python, rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100