Skip to content

Instantly share code, notes, and snippets.

@carld
Created June 3, 2017 01:27
Show Gist options
  • Select an option

  • Save carld/cd1f396e2c43987e7c33316d35697689 to your computer and use it in GitHub Desktop.

Select an option

Save carld/cd1f396e2c43987e7c33316d35697689 to your computer and use it in GitHub Desktop.
LLVM literal float representation from Chez Scheme
(define (float->hex fl)
(string-append "0x"
(with-output-to-string
(lambda ()
(write-ieee-float32 fl
(make-output-port
(lambda (m . args)
(case m
((write-char)
(format #t "~X" (char->integer (car args)))))) (make-string 0))
'big-endian
))) "00000000" ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment