(fn)
return wrapped_fn
Decorator to handle floating point errors.
Decorator to handle floating point errors.
Decorator to handle floating point errors .
def float_safe(fn):
    """Decorator to handle floating point errors."""
    def wrapped_fn(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except (ValueError, ArithmeticError) as e:
            return args[0].error_handler.handle(e)
    wrapped_fn.__name__ = fn.__name__
    return wrapped_fn
def float_safe ( fn ) : def wrapped_fn ( * args , * * kwargs ) : try : return fn ( * args , * * kwargs ) except ( ValueError , ArithmeticError ) as e : return args [ 0 ] . error_handler . handle ( e ) wrapped_fn . __name__ = fn . __name__ return wrapped_fn