Thanks—I think that's the root of the problem. It appears to be resolved, in the sense of marking the answer correctly, with your fix plus the possibility
lc($x) eq '-nan'.
That said, it marks the answer wrong without reporting an error, which seems odd. The only reason I can think this would happen is if the value being evaluated is raising an unreported error in the answer processing.
p.s.: thus, my corrected code reads
return $self->inherit($other)->make($x) unless lc($x) eq 'nan' || lc($x) eq '-nan';
pg/lib/Value/Real.pm, lines around 98 and 39, and
pg/lib/Parser/BOP/power.pm around line 34.