MathTools extension

This is a simple math extension. Which functions or constants should I add? It has the following functions:

  • isEven(double number)
    • returns true if number is even, false otherwise
    • even numbers can be divided by two without remainders
  • isPrime(double number)
    • returns true if the number is a prime number, false otherwise
  • isInteger(double number)
    • returns true if the number is whole, false otherwise
  • isPositive(double number)
    • returns true if the number is greater than zero, false otherwise
  • The constants π, e, c (in m/s), g (in m/s^2)
  • mapping numbers from a scale to a scale
  • conversion of
    • degree Celsius toFahrenheit
    • degree Fahrenheit toCelsius
    • miles toKilometers
    • kilometers toMiles

The extension can be found in my GitHub repo. Please post all suggestions and issues here.


Changelog

2017-09-05: Initial release
2017-09-18: v2 is out
2018-02-09: v3 fixes an error with the isPrime function

2 Likes

the following blocks provide the same result without need of using an extension

also for a powerful math extension see also here

Taifun