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
Up and Running / Tour Libs / Math / possible example error #19048
Comments
I'm practically positive it works, but you've made me wonder if it's as correct/clear as it could be. Set owner to @kwalrath. |
This comment was originally written by Neta...@gmail.com My suggestion is that it is misleading to show a round to 2 decimals, while the result show one decimal. I'm not questioning the method's accuracy. :) |
Removed Area-Documentation label. |
This comment was originally written by googlegroups...@kaioa.com Same effect: assert((sinOf30degrees - 0.5).abs() < 0.01); |
We've already shown toStringAsPrecision(), so it seems like kaioa's assertion is a good way to go. Added Started label. |
CL in review: https://chromiumcodereview.appspot.com/453093005/ |
Added Fixed label. |
This issue has been moved to Github as part of a migration. Please use the Issue on Github going forward: https://github.com/dart-lang/dartlang.org/issues |
This issue was originally filed by NetaisLLC...@gmail.com
URL: https://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-trigonometry
Issue/feedback:
The last example assert in the Trig. section seems wrong.
// Truncate the decimal places to 2.
assert(double.parse(sinOf30degrees.toStringAsPrecision(2)) == 0.5);
Should not the value on the right of == be 0.50, or perhaps to make it more clear, a value such as 0.51?
Attachment:
[5-27-2014 1-56-33 PM.jpg](https://storage.googleapis.com/google-code-attachments/dart/issue-19048/comment-0/5-27-2014 1-56-33 PM.jpg) (134.68 KB)
The text was updated successfully, but these errors were encountered: