Restrict the Range

Write a function restrict_rangerestrict\_range that receives a function operating on floats ff, a lower bound lblb and an upper bound ubub. Then, restrict_rangerestrict\_range returns a new function that operates exactly as ff when f(x)f(x) falls within the closed interval [lb,ub][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