impc:ti:numeric-cast-operator   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

(define impc:ti:numeric-cast-operator
  (lambda (a b)
    (let* ((lowest (if (< a b) a b))
           (highest (if (= a lowest) b a))
           (caststr (string-append (if (impc:ir:floating-point? highest)
                                       (if (= highest *impc:ir:fp64*) "d" "f")
                                       (impc:ir:pretty-print-type highest))
                                   "to"
                                   (if (impc:ir:floating-point? lowest)
                                       (if (= lowest *impc:ir:fp64*) "d" "f")
                                       (impc:ir:pretty-print-type lowest)))))
      caststr)))


Back to Index