fix `number_to_percentage` with `Float::NAN`, `Float::INFINITY`.

Closes #14405.

This is a follow-up to 9e997e9039435617b6a844158f5437e97f6bc107 to restore
the documented behavior.