TDengine/tests/army/query/function/ans/round.csv
2025-02-10 20:24:21 +08:00

360 lines
9.8 KiB
Text

taos> select ROUND(10.55, 3)
round(10.55, 3) |
============================
10.55 |
taos> select ROUND(10.55, 2)
round(10.55, 2) |
============================
10.55 |
taos> select ROUND(10.55, 1)
round(10.55, 1) |
============================
10.6 |
taos> select ROUND(10.55, 0)
round(10.55, 0) |
============================
11 |
taos> select ROUND(10.55)
round(10.55) |
============================
11 |
taos> select ROUND(10.55, -1)
round(10.55, -1) |
============================
10 |
taos> select ROUND(10.55, -10)
round(10.55, -10) |
============================
0 |
taos> select ROUND(-10.55, 1)
round(-10.55, 1) |
============================
-10.6 |
taos> select ROUND(99, 1)
round(99, 1) |
========================
99 |
taos> select ROUND(111.1111)
round(111.1111) |
============================
111 |
taos> select ROUND(111.5111)
round(111.5111) |
============================
112 |
taos> select ROUND(10.55) + 1
round(10.55) + 1 |
============================
12 |
taos> select ROUND(10.55, 1) + 1
round(10.55, 1) + 1 |
============================
11.6 |
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
round(round(round(round(round(round(round(123.123456789, 9), 8), |
===================================================================
1.230000000000000e+02 |
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
round(round(round(round(round(round(round(123456789.123456789, - |
===================================================================
1.230000000000000e+08 |
taos> select ROUND(current) from ts_4893.meters order by ts limit 20
round(current) |
=======================
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
11 |
9 |
11 |
8 |
12 |
9 |
10 |
10 |
10 |
10 |
taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
round(87654321.123456789, id) |
================================
8.765432100000000e+07 |
8.765432109999999e+07 |
8.765432112000000e+07 |
8.765432112300000e+07 |
8.765432112350000e+07 |
8.765432112345999e+07 |
8.765432112345700e+07 |
8.765432112345681e+07 |
8.765432112345679e+07 |
8.765432112345679e+07 |
taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
round(current, id) |
=======================
11 |
8.6 |
9.8 |
11.233 |
10.706 |
8.508 |
9.596 |
10.962 |
11.226 |
10.337 |
taos> select ROUND(current, 1) from ts_4893.meters order by ts limit 10
round(current, 1) |
=======================
10.7 |
8.6 |
9.8 |
11.2 |
10.7 |
8.5 |
9.6 |
11 |
11.2 |
10.3 |
taos> select round(10.55, 3)
round(10.55, 3) |
============================
10.55 |
taos> select round(10.55, 2)
round(10.55, 2) |
============================
10.55 |
taos> select round(10.55, 1)
round(10.55, 1) |
============================
10.6 |
taos> select round(10.55, 0)
round(10.55, 0) |
============================
11 |
taos> select round(10.55)
round(10.55) |
============================
11 |
taos> select round(10.55, -1)
round(10.55, -1) |
============================
10 |
taos> select round(10.55, -10)
round(10.55, -10) |
============================
0 |
taos> select round(-10.55, 1)
round(-10.55, 1) |
============================
-10.6 |
taos> select round(99, 1)
round(99, 1) |
========================
99 |
taos> select round(current) from ts_4893.d0 order by ts limit 10
round(current) |
=======================
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
taos> select round(current) from ts_4893.meters order by ts limit 10
round(current) |
=======================
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
taos> select round(10, null)
round(10, null) |
========================
NULL |
taos> select round(null, 2)
round(null, 2) |
========================
NULL |
taos> select round(123.456, null)
round(123.456, null) |
============================
NULL |
taos> select round(100)
round(100) |
========================
100 |
taos> select round(0.00123, -2)
round(0.00123, -2) |
============================
0 |
taos> select round(123.456, 0)
round(123.456, 0) |
============================
123 |
taos> select round(123.456, -5)
round(123.456, -5) |
============================
0 |
taos> select round(12345.6789, -2)
round(12345.6789, -2) |
============================
12300 |
taos> select round(-123.456, 2)
round(-123.456, 2) |
============================
-123.46 |
taos> select round(-1234.5678, 2)
round(-1234.5678, 2) |
============================
-1234.57 |
taos> select round(voltage, 0) from ts_4893.meters limit 1
round(voltage, 0) |
====================
221 |
taos> select round(current, 1) from ts_4893.meters limit 1
round(current, 1) |
=======================
10.7 |
taos> select round(phase, 3) from ts_4893.meters limit 1
round(phase, 3) |
=======================
0.509 |
taos> select round(voltage, -1) from ts_4893.meters limit 1
round(voltage, -1) |
=====================
220 |
taos> select round(current * voltage, 2) from ts_4893.meters limit 1
round(current * voltage, 2) |
==============================
2.353650000000000e+03 |
taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
round(abs(voltage), 2) |
=========================
221 |
taos> select round(pi() * phase, 3) from ts_4893.meters limit 1
round(pi() * phase, 3) |
============================
1.599 |
taos> select round(sqrt(voltage), 2) from ts_4893.meters limit 1
round(sqrt(voltage), 2) |
============================
14.87 |
taos> select round(log(current), 2) from ts_4893.meters limit 1
round(log(current), 2) |
============================
2.37 |
taos> select round(cast(1.0e+400 as float), 0);
round(cast(1.0e+400 as float), 0) |
====================================
NULL |
taos> select round(cast(1.0e+400 as double), 0);
round(cast(1.0e+400 as double), 0) |
=====================================
NULL |
taos> select round(cast(5 as tinyint), 1);
round(cast(5 as tinyint), 1) |
===============================
5 |
taos> select round(cast(50 as smallint), 1);
round(cast(50 as smallint), 1) |
=================================
50 |
taos> select round(cast(500 as int), 1);
round(cast(500 as int), 1) |
=============================
500 |
taos> select round(cast(50000 as bigint), 1);
round(cast(50000 as bigint), 1) |
==================================
50000 |
taos> select round(cast(5 as TINYINT UNSIGNED), 1);
round(cast(5 as tinyint unsigned), 1) |
========================================
5 |
taos> select round(cast(50 as smallint unsigned), 1);
round(cast(50 as smallint unsigned), 1) |
==========================================
50 |
taos> select round(cast(500 as int unsigned), 1);
round(cast(500 as int unsigned), 1) |
======================================
500 |
taos> select round(cast(50000 as bigint unsigned), 1)
round(cast(50000 as bigint unsigned), 1) |
===========================================
50000 |