A function f that is not Riemann integrable but |f| is Riemann integrable?

1. Aug 10, 2011

MimuiSnoopy

I was just going over Riemann integrability and how to prove it, and was just wondering is it possible to have a function f that is not Riemann integrable but |f| is Riemann integrable? Say on an interval [0,1] for example. (as that is what most examples I have done are on so easiest for me to compare)
How would this work? Or does it not?

2. Aug 10, 2011

asmani

f(x)=1 for rational x
f(x)=-1 for irrational x

Is it Riemann integrable?