66(require math/flonum
77 math/bigfloat
88 softposit-rkt
9- "../utils/float.rkt " ; for shift/unshift
9+ "../src/ utils/float.rkt " ; for shift/unshift
1010 rival
11- "../syntax/platform.rkt " )
11+ "../src/syntax/platform.rkt " )
12+ (provide platform)
1213
1314;;;;;;;;;;;;;;;;;;;;;;;;;;;;; utils ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1415
8687
8788(define cost 1 )
8889
89- (define softposit- platform
90+ (define platform
9091 (make-empty-platform 'softposit #:if-cost 1 ))
9192
9293;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REPRESENTATIONS ;;;;;;;;;;;;;;;;;;;;;;;
180181 #:total-bits 64
181182 #:special-value? nan?))
182183
183- (platform-register-representation! softposit- platform #:repr bool #:cost cost)
184- (platform-register-representation! softposit- platform #:repr posit8 #:cost cost)
185- (platform-register-representation! softposit- platform #:repr posit16 #:cost cost)
186- (platform-register-representation! softposit- platform #:repr posit32 #:cost cost)
187- (platform-register-representation! softposit- platform #:repr quire8 #:cost cost)
188- (platform-register-representation! softposit- platform #:repr quire16 #:cost cost)
189- (platform-register-representation! softposit- platform #:repr quire32 #:cost cost)
190- (platform-register-representation! softposit- platform #:repr binary64 #:cost cost)
184+ (platform-register-representation! platform #:repr bool #:cost cost)
185+ (platform-register-representation! platform #:repr posit8 #:cost cost)
186+ (platform-register-representation! platform #:repr posit16 #:cost cost)
187+ (platform-register-representation! platform #:repr posit32 #:cost cost)
188+ (platform-register-representation! platform #:repr quire8 #:cost cost)
189+ (platform-register-representation! platform #:repr quire16 #:cost cost)
190+ (platform-register-representation! platform #:repr quire32 #:cost cost)
191+ (platform-register-representation! platform #:repr binary64 #:cost cost)
191192
192193;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OPERATORS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
193194
194195;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BOOLEAN IMPLS ;;;;;;;;;;;;;;;;;;;;;;;;;
195196
196197(platform-register-implementations!
197- softposit- platform
198+ platform
198199 ([TRUE () bool (TRUE) (const true) (! TRUE) cost]
199200 [FALSE () bool (FALSE) (const false ) (! FALSE) cost]
200201 [not ([x : bool]) bool (not x) not (not x) cost]
205206
206207; ([name ([var : repr] ...) otype spec fl fpcore cost])
207208(platform-register-implementations!
208- softposit- platform
209+ platform
209210 (; Posit8
210211 [neg.p8 ([x : posit8]) posit8 (neg x) posit8-neg (! :precision posit8 (- x)) cost]
211212 [+.p8 ([x : posit8] [y : posit8]) posit8 (+ x y) posit8-add (! :precision posit8 (+ x y)) cost]
257258
258259; ([name ([var : repr] ...) otype spec fl fpcore cost])
259260(platform-register-implementations!
260- softposit- platform
261+ platform
261262 (; Posit/float implementations
262263 [binary64->posit8 ([x : binary64]) posit8 x double->posit8 (! :precision posit8 (cast x)) cost]
263264 [binary64->posit16 ([x : binary64]) posit16 x double->posit16 (! :precision posit16 (cast x)) cost]
280281 [posit16->quire16 ([x : posit16]) quire16 x posit16->quire16 (! :precision quire16 (cast x)) cost]
281282 [posit32->quire32 ([x : posit32]) quire32 x posit32->quire32 (! :precision quire32 (cast x)) cost]))
282283
283- (register-platform! softposit- platform)
284+ (register-platform! platform)
284285
285286(module+ main
286- (display-platform softposit- platform))
287+ (display-platform platform))
287288
288289;; Do not run this file during testing
289290(module test racket/base
290291 )
291-
292+
0 commit comments