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

Correct numeric precision comment #1666

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion logicals.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ x == c(1, 2)
```

What's going on?
Computers store numbers with a fixed number of decimal places so there's no way to exactly represent 1/49 or `sqrt(2)` and subsequent computations will be very slightly off.
Computers store numbers with finite precision so there's no way to exactly represent 1/49 or `sqrt(2)` and subsequent computations will be very slightly off.
We can see the exact values by calling `print()` with the `digits`[^logicals-1] argument:

[^logicals-1]: R normally calls print for you (i.e. `x` is a shortcut for `print(x)`), but calling it explicitly is useful if you want to provide other arguments.
Expand Down