You can use calcfor this. The syntax for hexadecimals is slightly different, and I will not show how to convert them, but the core of your functionality can be written as follows.
(require 'calc)
(defun is-between (n low high)
(and (equal "1" (calc-eval (concat n " - " low " > 0")))
(equal "1" (calc-eval (concat high " - " n " > 0")))))
(is-between "16#f0" "16#f" "16#ff")
source
share