@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
110 lines • 2.42 kB
JavaScript
import { fn } from '../util/function.js';
/**
* Return true if the floating point value is not a number, false otherwise.
* @param expr The input number.
*/
export function isNaN(expr) {
return fn('isnan', expr);
}
/**
* Return true if the floating point value is finite, false otherwise.
* @param expr The input number.
*/
export function isFinite(expr) {
return fn('isfinite', expr);
}
/**
* Return true if the floating point value is infinite, false otherwise.
* @param expr The input number.
*/
export function isInfinite(expr) {
return fn('isinf', expr);
}
/**
* Selects the largest value.
* @param expr The input expressions.
*/
export function greatest(...expr) {
return fn('greatest', ...expr);
}
/**
* Selects the smallest value.
* @param expr The input expressions.
*/
export function least(...expr) {
return fn('least', ...expr);
}
/**
* Compute the exponentional function `e ** expr`.
* @param expr The input number.
*/
export function exp(expr) {
return fn('exp', expr);
}
/**
* Compute a base 10 logarithm.
* @param expr The input number.
*/
export function log(expr) {
return fn('log', expr);
}
/**
* Compute a natural logarithm.
* @param expr The input number.
*/
export function ln(expr) {
return fn('ln', expr);
}
/**
* Compute the sign of a number.
* @param expr The input number.
*/
export function sign(expr) {
return fn('sign', expr);
}
/**
* Compute the absolute value of a number.
* @param expr The input number.
*/
export function abs(expr) {
return fn('abs', expr);
}
/**
* Compute the square root of a number.
* @param expr The input number.
*/
export function sqrt(expr) {
return fn('sqrt', expr);
}
/**
* Rounds the number up.
* @param expr The input number.
*/
export function ceil(expr) {
return fn('ceil', expr);
}
/**
* Rounds the number down.
* @param expr The input number.
*/
export function floor(expr) {
return fn('floor', expr);
}
/**
* Round to the given decimal places.
* @param expr The input number.
* @param places The decimal places.
* Negative values are allowed, to round to tens, hundreds, etc.
* If unspecified, defaults to zero.
*/
export function round(expr, places) {
return fn('round', expr, places);
}
/**
* Truncates the number.
* @param expr The input number.
*/
export function trunc(expr) {
return fn('trunc', expr);
}
//# sourceMappingURL=numeric.js.map