fixed rounding error
added amd (require) ready version