File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 88 ulp-difference ulps->bits
99 midpoint random-generate
1010 </total <=/total
11- value->string value->json
11+ value->string value->json json->value
1212 real->repr repr->real)
1313
1414(define (ulp-difference x y repr)
6262 [_ (hash 'type (~a (representation-name repr))
6363 'ordinal (~a ((representation-repr->ordinal repr) x)))]))
6464
65+ (define (json->value x repr)
66+ (match x
67+ [(? real?) x]
68+ [(? hash?)
69+ (match (hash-ref x 'type )
70+ ["real "
71+ (match (hash-ref x 'value )
72+ ["-inf " -inf.0 ]
73+ ["+inf " +inf.0 ]
74+ ["NaN " +nan.0 ]
75+ [_ +nan.0 ])]
76+ [_ ((representation-ordinal->repr repr)
77+ (string->number (hash-ref x 'ordinal )))])]))
78+
6579(define (value->string n repr)
6680 ;; Prints a number with relatively few digits
6781 (define ->bf (representation-repr->bf repr))
Original file line number Diff line number Diff line change 9191 (define-values (pts exs)
9292 (for/lists (pts exs) ([entry (in-list json)])
9393 (match-define (list pt ex) entry)
94- (values (map real->repr pt var-reprs) (real->repr ex output-repr))))
94+ (values (map real->repr pt var-reprs) (real->repr (json->value ex output-repr) output-repr))))
9595 (mk-pcontext pts exs))
9696
9797(define (pcontext->json pcontext repr)
You can’t perform that action at this time.
0 commit comments