API Matemática
Operaciones básicas y avanzadas vía REST
GET
/api/math/add
Suma
Calcula la suma aritmética de dos números proporcionados.
Query Parameters
a
number*
Primer sumando
b
number*
Segundo sumando
Response Example (200 OK)
{
"operation": "add",
"inputs": {
"a": 5,
"b": 3
},
"result": 8
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/add?a=5&b=3"
GET
/api/math/subtract
Resta
Calcula la diferencia entre dos números.
Query Parameters
a
number*
Minuendo
b
number*
Sustraendo
Response Example (200 OK)
{
"operation": "subtract",
"inputs": {
"a": 5,
"b": 3
},
"result": 2
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/subtract?a=5&b=3"
GET
/api/math/multiply
Multiplicación
Obtiene el producto de dos números.
Query Parameters
a
number*
Multiplicando
b
number*
Multiplicador
Response Example (200 OK)
{
"operation": "multiply",
"inputs": {
"a": 5,
"b": 3
},
"result": 15
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/multiply?a=5&b=3"
GET
/api/math/divide
División
Calcula el cociente de la división. Retorna error si el divisor es cero.
Query Parameters
a
number*
Dividendo
b
number*
Divisor
Response Example (200 OK)
{
"operation": "divide",
"inputs": {
"a": 6,
"b": 2
},
"result": 3
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/divide?a=6&b=2"
GET
/api/math/power
Potenciación
Eleva una base a un exponente determinado.
Query Parameters
base
number*
Número base
exponent
number*
Potencia
Response Example (200 OK)
{
"operation": "power",
"inputs": {
"base": 2,
"exponent": 3
},
"result": 8
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/power?base=2&exponent=3"
GET
/api/math/sqrt
Raíz Cuadrada
Calcula la raíz cuadrada de un número positivo.
Query Parameters
number
number*
Radicando
Response Example (200 OK)
{
"operation": "sqrt",
"inputs": {
"number": 16
},
"result": 4
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/sqrt?number=16"
GET
/api/math/modulo
Módulo
Calcula el residuo de una división entera.
Query Parameters
a
number*
Dividendo
b
number*
Divisor
Response Example (200 OK)
{
"operation": "modulo",
"inputs": {
"a": 7,
"b": 3
},
"result": 1
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/modulo?a=7&b=3"
GET
/api/math/abs
Valor Absoluto
Retorna la magnitud de un número sin considerar su signo.
Query Parameters
number
number*
Número de entrada
Response Example (200 OK)
{
"operation": "abs",
"inputs": {
"number": -5
},
"result": 5
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/abs?number=-5"
GET
/api/math/round
Redondeo
Redondea un número al entero más cercano o a un número específico de decimales.
Query Parameters
number
number*
Número a redondear
decimals
number
Cantidad de decimales (default: 0)
Response Example (200 OK)
{
"operation": "round",
"inputs": {
"number": 3.14159,
"decimals": 2
},
"result": 3.14
}
Usage with cURL
curl -X GET "https://testio.dev/api/math/round?number=3.14159&decimals=2"