Restrict the Range

Write a function restrict_range that receives a function operating on
floats f, a lower bound lb and an upper bound ub. Then, restrict_range
returns a new function that operates exactly as f when f(x) falls within
the closed interval [lb, ub]. Instead of outputs outside that interval,
the function produced returns $float("-inf")$.

Problem information

Author: Jordi Delgado and José Luis Balcázar

Generation: 2026-01-25T16:52:33.579Z

© Jutge.org, 2006–2026.
https://jutge.org
