If you know the file extensions are working with, the best solution is to just use the auto-mode-alist to startup hexl-mode.
If not, and you take what you have said literally:
It's probably sufficient to define "binary" as "contains a null byte"
You can do this by adding a function that turns on hexl-mode if a file contain a null byte to the find-file-...
I think the most simple answer is "no, there is no way to make hexl-mode do that".
Mostly because hexl-mode is by nature very limited in what it can and can't do (or more specifically, to let it do other things, you'd have to change it substantially).
I'm not sure what you mean by "display hex values as floats", but if you mean "take 4-byte chunks and ...
I recomend you try nhexl-mode (install it from M-x package-install or M-x package-list). It does do what you want.
This said, hexl-mode almost does what you want, since it places the cursor right in front of the byte you want highlighted.
This answer doesn't really involve emacs per se, but you can use the Unix or GNU od command to solve your problem. In particular, od -f is probably what you are looking for regarding floats and od -t fD will format doubles. You could always use M-! to get the command output into a buffer if you really need it inside of emacs. ;)
That sounds like a missing feature in vlf-mode, and quite possibly some missing customization in hexl-mode.
The way hexl-mode works if by running the hexl program (shipped with Emacs, see hexl-program), and displaying the output. This output already contains the offsets, they're just made non-editable. So, vlf-mode should add vlf-start-pos to all of those. ...
Here's my own function. It seems to do the trick.
(defun hexl-hex-forward-char (hex-offset)
"Move to right HEX-OFFSET bytes (left if negative) in Hexl mode."
(interactive "sHex Offset: ")
And the following overwrites the key binding for hexl-forward-word ...
If you use nhexl-mode (available from your neighborly GNU ELPA archive), then you can do C-s f9beb4d9 and it will search for the sequence of 4 bytes with codes f9 be b4 d9 (as well as for the 8 bytes text f9beb4d9 of course, and also the bytes at addresses that include f9beb4d9 in their hex representation).
The following lisp code puts an entry "Hexl Isearch Mode" into the "Hexl" menu.
That menu item (de-)activates the minor mode hexl-isearch-mode.
If you activate that mode isearch searches in the binary data instead of the hexl buffer.
The search string is read with read.
So all escape sequences for lisp strings do work.
As an example you can search for \x0a\...
One simple way to hide the ascii-part of the hexl buffer is customizing the foreground of the face hexl-ascii-region to the background value (e.g., white).
For using this method make sure that font-lock-mode is active in the hexl-mode. It may be that you need
(add-hook 'hexl-mode-hook #'font-lock-mode)
in your init-file.
I've tried Jordon's answer and it works well, however I'd like to recommend replacing hexl-if-binary (and the (add-hook)) with this:
(add-to-list 'magic-fallback-mode-alist '(buffer-binary-p . hexl-mode) t)
This way it only uses Hexl mode as a last resort if no other mode recognises the file. I prefer this because otherwise, image files open in Hexl mode ...
Maybe no so elegant but should do the trick. Note I have assigned it to "C-." which might be used by other functions in your setup. Reassign as you wish:
(setq hx (format "%x" (char-before)))
(global-set-key (kbd "C-.") 'hexify)
Calling the function, replaces the character before ...
The following call to emacs inserts the hexadecimal number \x0b at character position 10 of the files 1st.bin and 2nd.bin.
emacs --batch --eval '(dolist (file-name (list "1st.bin" "2nd.bin")) (find-file-literally file-name) (goto-char 10) (insert "\x0b") (save-buffer 0) (kill-buffer))'
I implemented such a variant of overwrite-mode as part of nhexl-mode-0.4 (available from GNU ELPA), which I called nhexl-overwrite-only-mode. It also works in "normal" editing modes (i.e. outside of nhexl-mode) but it won't work for hexl-mode, I'm afraid.
The following elisp code defines a new minor mode hexl-bin-mode that replaces the ascii-region with spaces. That should avoid side-effects caused by faces as they may appear in my first answer.
You can switch on the binary hexl mode by M-x hexl-bin-mode or bind the command hexl-bin-mode to any key you want with local-set-key in hexl-mode-hook.