Basic Rounding

Query

flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0[/Filter/] result{{Result Set}} repo --> 0 0 --> result
logscale
round(myvalue)

Introduction

The round() function rounds a number to the nearest integer (whole number) using standard math rules. Numbers greater than 0.5 are rounded up, numbers lower than 0.5 are rounded down.

Step-by-Step

  1. Starting with the source repository events.

  2. flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0[/Filter/] result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;
    logscale
    round(myvalue)

    Rounds the number in myvalue.

  3. Event Result set.

Summary and Results

The query is used to round a floating point number to the nearest integer. Rounding is used to simplify numbers. The benefit to rounding is that it returns numbers that are easier to work with.

Note

To format a number, or round to a specific decimal accuracy, use format(). See Rounding to n Decimal Places.