Floating point numbers are represented as sign+magnitude rather than the two's complement used for integers.
The details are a bit messy but basically, the 32 bits in a float are divided as S-EEEEEEEE-MMMMMMMMMMMMMMMMMMMMMMM
where S is the sign, 0 for positive, 1 for negative, EE...EE is an 8 bit exponent, and MM...MM is a 23 bit magnitude(see note 1)
One characteristic of this representation is that if one or both of the numbers is positive, you can do a standard 32 bit integer compare and trust the result. If BOTH of the numbers are negative, you can still do an integer compare but you have to reverse the operands.
The assembly code for the 32 bit integer and float compares is below. A float compare is almost 70 bytes total because of repeating the integer compare with the operands reversed. The challenge is to reduce this. Execution time is less significant, you could use registers 14 or 15 if you needed them. Bonus points if the reduction improves the 32 bit integer compare. I already have special cases for equal/not equal and zero compares but if there any other special cases that would be good.
Sample positive and negative floats are one=0x3f800000, minus one is 0xbf800000. You can see that the two are the same except for the sign bit and if you did a signed integer compare you'd get a correct result.
(because outlook seems to mungle my email sometimes I've attached the code as well as including it in the email)
To do a 32 bit integer compare for a jump-if-A-less-than-B, the code is about 28 bytes long(here A is in R8:R9 and B is in R10:R11
;signed comparison(less than) of two long integers - subtract R10:R11 from R8:R9 and jump if borrow
dec sp ;make a work area
glo 11 ;lowest order byte
smb ;that's a standard signed subtraction of one reg
glo 10 ;lowest order byte of the top register
smb ;that's a standard signed subtraction of a double register
ghi 8 ;
xor ;sets the top bit if the signs are different
inc sp ;release the work area
shlc ;the original df is now in bit 0 and df=1 if signs were different
lsnf ;bypass the flip if signs were the same
xri 01 ;invert original df if signs were different
shrc ;put it back in df
LBNF label ;execute
To do a float comparison, I have to check the signs before comparing and, if both are negative, reverse the operands.
;jump if float reg R8:R9< float reg R10:R11
ghi rR8 ;see if first arg is -v
lbnf $$comp ;if at least 1 reg positive, just compare
ghi R10 ;check 2nd reg
$$comp: jltI4 R8:R9,R10:R11,label ;as long as one register is +v
$$rcomp: jltI4 R10:R11,R8:R9,label ;reverse the order of the operands
(note 1) floats are "normalized" by shifting the magnitude left until bit 23 is 1 and adjusting the exponent then, since bit 23 is always 1, it's stripped off and used to hold one of the exponent bits. The exponent is carried as excess 127 i.e. 2^0 is carried as 127 and 2^-1 is carried as 126. See https://en.wikipedia.org/wiki/Floating_point#Internal_representation