-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaked foreach
loops in example diagrams to avoid a floating-point rounding error.
#1050
Conversation
…-point rounding error. Signed-off-by: 3geek14 <[email protected]>
Nice catch. I'm thinking if we should mention the rounding errors and their workarounds when |
I'm not sure there's a good way to fit it into Karl's tutorial without it feeling out of place. I agree it's an important thing to remind users of, and I'm pretty certain I've made this exact error before. I'll try to spend more time thinking about this, and I'll make an issue or another PR if I come up with something I like. |
* Changed to 1/8 steps to be more similar to original 1/10 steps Signed-off-by: 3geek14 <[email protected]>
There were a few other places where the same rounding error came up. I did a search for I also searched for
For the cover, I think the visual design (for both picture and code) matters a lot more than it does in the examples I was editing, so I left it alone. I think my suggestion would be to use Of course, it's possible that it's intentional to have only 15 (rather than 16) snowflakes and for none of them to have opacity 1 (the highest currently around 0.95). In this case, I think it would be better to use |
foreach
loops in example diagrams to avoid a floating-point rounding error.
…t floating-point arithmetic to the first introduction of `foreach` in Karl's tutorial. Signed-off-by: 3geek14 <[email protected]>
…t floating-point arithmetic to the first introduction of `foreach` in Karl's tutorial. Signed-off-by: 3geek14 <[email protected]>
Per a suggestion from @muzimuzhi, add a warning about floating-point arithmetic to the first introduction of `foreach` in Karl's tutorial. Signed-off-by: 3geek14 <[email protected]>
Per a suggestion from @muzimuzhi on pgf-tikz#1050, add a warning about floating-point arithmetic to the first introduction of `foreach` in Karl's tutorial.
Per a suggestion from @muzimuzhi on pgf-tikz#1050, add a warning about floating-point arithmetic to the first introduction of `foreach` in Karl's tutorial. Signed-off-by: 3geek14 <[email protected]>
At the beginning I thought maybe the two examples not related to animations could be adopted to show workarounds for rounding errors, but now I decided to keep drawing examples simple and perhaps extend the doc for Hence approved and I'm merging this. |
…-point rounding error.
Signed-off-by: 3geek14 [email protected]
Motivation for this change
An example in The Pic Syntax uses
{0, 0.1, ..., 1}
for aforeach
loop. Due to floating-point arithmetic, this leaves out the value1
. Rather than changing it to1.01
or adding, 1
to the list or using integers and dividing by 10 later…I changed the step to0.25
to avoid the rounding error while maintaining the simplicity of the example.Checklist
Please check the boxes below and signoff your commits to explicitly
state your agreement to the Developer Certificate of Origin: