This commit is contained in:
jverzani 2023-03-29 11:25:58 -04:00
parent a126dafd73
commit f373c9bf37
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
version: "0.15"
version: "0.16"
project:
type: book

View File

@ -1113,14 +1113,16 @@ radioq(choices, answ)
[Sagan's](https://en.wiktionary.org/wiki/Sagan%27s_number) number is defined to be the total number of stars in the observable universe. How big is it? A *sextillion* is 7 groups of three 0's after a leading 1. One estimate is $10$ sextillion. How might this be entered into `Julia`? Select the one that *doesn't* work:
```{julia}
#| echo: false
choices = [
"`10*10^21`",
"`10*10.0^21`",
"`10e21`",
"`1e22`",
"`10*10^21`",
"`10*10.0^21`",
"`10e21`",
"`1e22`",
"`10_000_000_000_000_000_000_000`"]
explanation = "With an *integer* base, `10^21` overflows. For typical integers, onmly `10^18` is defined as expected. Once `10^19` is entered the mathematical value is larger the the `typemax` for `Int64` and so the value *wraps* around. The number written out with underscores to separate groups of 0s is parsed as an integer with 128 bits, not 64."
explanation = "With an *integer* base, `10^21` overflows. For typical integers, only `10^18` is defined as expected. Once `10^19` is entered the mathematical value is larger the the `typemax` for `Int64` and so the value *wraps* around. The number written out with underscores to separate groups of 0s is parsed as an integer with 128 bits, not 64."
buttonq(choices, 1; explanation=explanation)
```
The estimate of 10 sextillion for Sagan's number was made in 1980, a more modern estimate is 30 times larger.