real numbers algorithm templates for JavaScript