You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
describe/float-test-bigfloat.rkt

40 lines
948 B
Racket

#lang racket
(require math/bigfloat)
(require (planet williams/describe/describe))
(printf "--- Using literals (big float) ---~n")
(describe (bf 1/10))
(describe (bf 2/10))
(describe (bf 3/10))
(describe (bf 4/10))
(describe (bf 5/10))
(describe (bf 6/10))
(describe (bf 7/10))
(describe (bf 8/10))
(describe (bf 9/10))
(describe (bf 10/10))
(printf "--- Exact decimal values of big floats ---~n")
(float->string (bf 1/10))
(float->string (bf 2/10))
(float->string (bf 3/10))
(float->string (bf 4/10))
(float->string (bf 5/10))
(float->string (bf 6/10))
(float->string (bf 7/10))
(float->string (bf 8/10))
(float->string (bf 9/10))
(float->string (bf 10/10))
(printf "--- Using summation (big float) ---~n")
(for/fold ((sum 0.bf))
((i (in-range 10)))
(define new-sum (bf+ sum (bf 1/10)))
(describe new-sum)
new-sum)
(printf "--- Using product (big float) ---~n")
(for ((i (in-range 1 11)))
(describe (bf* (bf i) (bf 1/10))))