Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { ceil } from 'lodash-es';
import { AmaliaFunctionCategory, AmaliaFunctionKeys, type AmaliaFormula } from '@amalia/amalia-lang/formula/types';
import { AmaliaFunctionDefault } from '../../AmaliaFunction';
export const numbersCeil = new AmaliaFunctionDefault<[number, number], number>({
name: AmaliaFunctionKeys.CEIL,
category: AmaliaFunctionCategory.NUMBERS,
nbParamsRequired: 1,
description: 'Round a number up',
exec: (numberInput, nbDecimals) => ceil(numberInput, nbDecimals),
params: [
{
name: 'input',
description: 'Input number to get its ceil: numbers, fields, properties, variables',
},
{
name: 'nbDecimals',
description: 'The number of decimal places of the output. By default it is 0.',
defaultValue: '0',
},
],
examples: [
{
desc: 'Returns 6',
formula: 'CEIL(5.3)' as AmaliaFormula,
result: 6,
},
{
desc: 'Returns 1.7',
formula: 'CEIL(1.68, 1)' as AmaliaFormula,
result: 1.7,
},
{
desc: 'Returns 1.58',
formula: 'CEIL(1.573, 2)' as AmaliaFormula,
result: 1.58,
},
{
desc: 'Returns the closet ceil to Commission with 2 decimal places.',
formula: 'CEIL(statement.commission, 2)' as AmaliaFormula,
},
{
desc: 'Returns 160',
formula: 'CEIL(154, -1)' as AmaliaFormula,
result: 160,
},
],
});
|