Skip to content

Commit

Permalink
Fix TeXification of named constants like PI
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha committed Jan 26, 2025
1 parent 896f1ee commit 6dea6de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/platforms/runtime/utils.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

(define-syntax-rule (define-constants repr [name impl-name value] ...)
(begin
(define-operator-impl (impl-name) repr #:spec (name) #:fl (const value)) ...))
(define-operator-impl (impl-name)
repr
#:spec (name)
#:fl (const value)
#:fpcore (! :precision binary64 name)) ...))

(define-syntax-rule (define-comparator-impls repr [name impl-name impl-fn attrib ...] ...)
(begin
Expand Down
6 changes: 5 additions & 1 deletion src/syntax/platform.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,12 @@
(for ([impl (in-list (platform-impls (*active-platform*)))]
#:when (equal? ireprs (impl-info impl 'itype)))
(define-values (prop-dict* expr) (impl->fpcore impl))
(define expr*
(if (symbol? expr)
(list expr)
expr*)) ; Handle named constants
(define pattern (cons op (map (lambda (_) (gensym)) ireprs)))
(when (and (subset? prop-dict* prop-dict) (pattern-match pattern expr))
(when (and (subset? prop-dict* prop-dict) (pattern-match pattern expr*))
(sow impl)))))
; check that we have any matching impls
(cond
Expand Down

0 comments on commit 6dea6de

Please sign in to comment.