User Tools

Site Tools


gibson:teaching:fall-2016:math753:hw1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:fall-2016:math753:hw1 [2016/09/14 05:41]
gibson
gibson:teaching:fall-2016:math753:hw1 [2016/09/15 08:07] (current)
gibson
Line 13: Line 13:
 A PDF of the Julia notebook is available so you can view the assignment in a browser, without Julia. ​ A PDF of the Julia notebook is available so you can view the assignment in a browser, without Julia. ​
 {{:​gibson:​teaching:​fall-2016:​math753:​math753-hw1-floatingpoint.pdf|(HW1 viewable as PDF)}} {{:​gibson:​teaching:​fall-2016:​math753:​math753-hw1-floatingpoint.pdf|(HW1 viewable as PDF)}}
 +
 +
 +====== update to HW1, 9/15/2016 ======
 + 
 +
 +**Due date: ** changed to Friday 9/16 at midnight.
 +
 +**Problem 4:** The syntax for inputting a 16-bit float is ''​Float16(9.4)'',​ not ''​9.0f0''​. The latter produces a 32-bit float.
 +
 +**Problem 6:** This one's proving challenging for people. Some hints:
 +
 +How many of the 7s will survive when ''​x = 4778 + 3.77777e-10''​ is computed in 16 digits? Same for ''​y''​. ​
 +Once you have those rounded numbers, how many significant digits will survive in the floating=point computations $x+y$, $x-y$, etc.? If you can't figure this out, go ahead and do the computations in 64 bits and see if you can explain the answers you get.
 +
 +If you want to compare the 64-bit calculations to something more accurate, use Julia'​s 256-bit ''​BigFloat''​ type. There are two ways to get a ''​BigFloat''​.
 +
 +<​code>​
 +julia> BigFloat(9.4)
 +9.400000000000000355271367880050092935562133789062500000000000000000000000000000
 +
 +julia> big(9.4)
 +9.400000000000000355271367880050092935562133789062500000000000000000000000000000
 +</​code>​
 +
 +Observe, however, that though we have 80 digits of precision in a ''​BigFloat'',​ we've produced 9.4 accurate only to 16 digits. This is because you type 9.4, it's interpreted as a 64-bit float before it's handed off to the ''​BigFloat''​ type. To get an accurate 9.4, you can do this
 +
 +<​code>​
 +julia> big(94.0)/​big(10.0)^1
 +9.399999999999999999999999999999999999999999999999999999999999999999999999999945 ​
 +</​code>​
  
    
gibson/teaching/fall-2016/math753/hw1.1473856912.txt.gz ยท Last modified: 2016/09/14 05:41 by gibson