Skip to content
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

Closed
DartBot opened this issue May 27, 2014 · 8 comments
Closed

Up and Running / Tour Libs / Math / possible example error #19048

DartBot opened this issue May 27, 2014 · 8 comments
Assignees

Comments

@DartBot
Copy link

DartBot commented May 27, 2014

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)

@kwalrath
Copy link
Contributor

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.
Added Docs-UpAndRunning label.

@DartBot
Copy link
Author

DartBot commented May 27, 2014

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. :)

@kwalrath
Copy link
Contributor

kwalrath commented Jun 4, 2014

Removed Area-Documentation label.
Added Area-Site label.

@DartBot
Copy link
Author

DartBot commented Jun 9, 2014

This comment was originally written by googlegroups...@kaioa.com


Same effect:

    assert((sinOf30degrees - 0.5).abs() < 0.01);

@kwalrath
Copy link
Contributor

kwalrath commented Aug 8, 2014

We've already shown toStringAsPrecision(), so it seems like kaioa's assertion is a good way to go.


Added Started label.

@kwalrath
Copy link
Contributor

kwalrath commented Aug 8, 2014

@kwalrath
Copy link
Contributor

Added Fixed label.

@nicolasgarnier
Copy link
Contributor

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 closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants