Mathematically speaking, does anyone know of a formula to do this:

given the number 502,345 -- I want in return 502,000

given the number 1,345,899 -- I want 1,346,000

given the number 18,373 -- I want 18,000

given the number 5389 -- I want 5000

given the number 130 -- I want 100