# Function that returns $0$ for all negative values

I need a function that returns $0$ if the given number is negative, and otherwise doesn't change the number.

Example: $$y(-5)=0,\ y(-2)=0,\ y(0)=0,\ y(3)=3,\ y(2566)=2566.$$

Does such a function exist?

You can take for example $$\frac{|x|+x}{2}.$$ You can construct similar examples.

Exotic: $0^{\sqrt{x^2}-x}\cdot x$.

• It is undefined at 1 – MATHS MOD Apr 24 '19 at 14:44
• Not if we agree upon $0^0=1$. – Michael Hoppe Apr 24 '19 at 15:00
• Well that's a kind of cheating – MATHS MOD Apr 27 '19 at 2:57

Just use

$$f(x) = \max\{x,0\}$$

This way it's clear what your function do