If you can reduce your condition to 0 or 1, and the result you want is numeric, you can multiply the condition (or 1 - condition, depending on needs) by the result to give you either 0 or the appropriate result. Scratching something out quickly for your described problem:
/me gains [[{abs(floor(@{hp|max} / @{hp} / 2)), 1}kl1 * 3d8]] temporary hit points
(Assuming the number of temporary hit points gained is 3d8)
Testing:
/roll {abs(floor(50 / 100 / 2)), 1}kl1 * 3d8
= 0
/roll {abs(floor(50 / 50 / 2)), 1}kl1 * 3d8
= 0
/roll {abs(floor(50 / 26 / 2)), 1}kl1 * 3d8
= 0
/roll {abs(floor(50 / 25 / 2)), 1}kl1 * 3d8
= 8+7+5 = 20
/roll {abs(floor(50 / 24 / 2)), 1}kl1 * 3d8
= 1+7+2 = 10
/roll {abs(floor(50 / 1 / 2)), 1}kl1 * 3d8
= 6+6+8 = 20
/roll {abs(floor(50 / -10 / 2)), 1}kl1 * 3d8
= 4+7+2 = 13
/roll {abs(floor(50 / -25 / 2)), 1}kl1 * 3d8
= 4+2+5 = 11
/roll {abs(floor(50 / -50 / 2)), 1}kl1 * 3d8
= 2+1+5 = 8