LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Ceiling Decimal Places

    Employee
    Posted 02-24-2017 10:47

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: jchartrand

    I am working with a set of data and I would like to use a function similar to CEIL that can be applied to decimals.

    Here is a sample set of data...

    Field1
    0.1061
    0.1585
    0.1178
    0.0906


    I would like to round each number up to the nearest thousandth. In excel, you are able to apply a a significance to the function so it knows where to apply the ceiling function (eg. =CEILING(A2,0.001). The CEIL function in lavastorm is programmed to INT outputs. I need the output to be...

    Field1
    0.107
    0.159
    0.118
    0.091


  • 2.  RE: Ceiling Decimal Places

    Employee
    Posted 02-24-2017 12:04

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    emit ceil(Field1*1000)/1000 as Field1


  • 3.  RE: Ceiling Decimal Places

    Employee
    Posted 02-24-2017 12:32

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: prasmussen

    You can also use the round function in a filter node. The -3 specifies round to 3 decimal places and the 1 specifies to round up. i.e.

    emit 'field1', 'field1'.round(-3,1) as "rounded"

    Of course, this assumes you want a simple rounding, not exactly like the CEIL which let's you specify increments such as .005.


  • 4.  RE: Ceiling Decimal Places

    Employee
    Posted 02-24-2017 12:33

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: jchartrand

    Creative, but that also rounds up unwanted situations.

    Example:
    .106 becomes .107 in both of your solutions.