This function has been developped an tested since 1995. You cannot be sure, if it works correctly with singles as inputs.
converttosingle is an interesting idea. Unfortunately you explain only, that "it doesn't work" without mentioning the details.
With using the debugger, you should be able to find all commands, which create double arrays or rely on the inputs to be doubles. Most of all these are a lot of eps(), ones() and zeros() calls. In addition I find eye() and inf. Some constants as 0, 1 and 2 are occuring also, but they might be used as integers, e.g. in indices.
I would not rely on an automatic conversion, because for such a complicated code this is too fragile.