Round values of a f-curve to be either 0 or 1
Add an Envelope Modifier with the following settings:

Reference Value: 0.5
Min: -0.5
Max: 0.5

Add a control point to the Envelope and use Min and Max bounds of “large” absolute value, but between the allowed range of -10000 and 10000, e.g.:

Frame: 0
Min: -9998
Max: 10000

Finally, add a Limits Modifier with Minimum Y of 0 and Maximum Y of 1.



The control point's Min and Max values are important when you care about the rounding of the input value 0.5.


With Min and Max equally distant away from the reference value of 0.5, the input value of 0.5 will not be modified.
e.g. Min = -9999, Max = 10000.
I used a slightly larger value of -9998 for Min so that the input of 0.5 will be rounded up.
You can use a slightly smaller value like -9999 to round the input of 0.5 down.


The size of the bounds will determine how well this method works for values which are close to the reference value. F-Curves with easing near it or keyframes obtained by simulation or experiment might produce numbers which will not be pushed all the way to the intended limits.
For example the image below shows the result of a sinusoidal ease-out over frames 0 to 10 with input values 0.499 to 0.5. Frame 9 ends up with a value of about 0.75 instead of 0.



It's not possible to change the control point's bounds beyond 10000, but if you work with values close to 0.5 you could duplicate the envelope modifier: