Perhaps one method could be working with strongly typed GP and only allow PowerFloat(a custom class but it's essentially a float, the custom class then prevent the GP from mixing types, you can essentially add units this way but the pset can get complication as you need to have mixing function, like power in this case, or like if-then-else like in the case of mixing bools with other types).
https://deap.readthedocs.io/en/master/examples/gp_spambase.html
Assuming you are using INT and FLOAT types in your pset already, lets say you want to form a power function that work like:
power(in_float, in_power_only_float)
Where
in_power_only_float is a new type to put the ephemeral floats in. Then we can try something like:
#Perhaps like this
class PowerFloat():
pass
#Modify pset accordingly
pset.addPrimitive(power, [float, PowerFloat], float, 'power')
pset.addEphemeralConstant("rand100", lambda: random.random() * 100, PowerFloat
)Here is an example with integers for a case of trading actions, note these are for constants but I imagine the addEphemeralConstant can be played with too like above or perhaps in the class.