#C, 101 + 2 (-lm) bytes
C, 101 + 2 (-lm) bytes
Returns how many real solutions, and store them in an array.
This one is very slow, since it uses a brute-force approach to find roots. It handles up to x = 9e9.
f(a,b,p,t,c,x)float*b,a,x;{for(p=a<0,c=0,x=-50;x<9;x+=2e-6,p=t)(t=x*exp(x)>a)^p?b[c++]=x:0;return c;} #C, 148 146 + 2 (-lm) bytes
C, 148 146 + 2 (-lm) bytes
This function returns how many real solutions, and store them in the given pointers.
Use binary search to find a solution. It handles up to about x = 108.
#define h(x)99;for(l=-1;x=(l+r)/2,fabs(l-r)>1e-6;)x*exp(x)>a?r=x:(l=x); f(a,b,c,l,r)float*b,*c,a,l,r;{r=h(*b)r=-h(*c)return-1/exp(1)>a?0:a<0?2:1;}