Skip to content

Commit

Permalink
fix precision
Browse files Browse the repository at this point in the history
  • Loading branch information
winitzki committed Oct 15, 2024
1 parent eba3996 commit 54c19f6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tutorial/compute_pi_machin.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,17 @@ let arctan_1_n
(Natural/fold number_of_terms Accum update init).current_result
prec

let prec = 14
let prec_given = env:PRECISION

let prec = prec_given + T.log 2 prec_given

let pi =
Float/subtract
(Float/multiply (Float/ofNatural 4) (arctan_1_n 239 prec) prec)
(Float/multiply (Float/ofNatural 16) (arctan_1_n 5 prec) prec)
prec
Float/round
( Float/subtract
(Float/multiply (Float/ofNatural 4) (arctan_1_n 239 prec) prec)
(Float/multiply (Float/ofNatural 16) (arctan_1_n 5 prec) prec)
prec
)
prec_given

in Float/show pi

0 comments on commit 54c19f6

Please sign in to comment.