9.9 KiB
9.9 KiB
| 1 | taos> select TRUNCATE(10.55, 3) |
|---|---|
| 2 | truncate(10.55, 3) | |
| 3 | ============================ |
| 4 | 10.550000000000001 | |
| 5 | taos> select TRUNCATE(10.55, 2) |
| 6 | truncate(10.55, 2) | |
| 7 | ============================ |
| 8 | 10.550000000000001 | |
| 9 | taos> select TRUNCATE(10.55, 1) |
| 10 | truncate(10.55, 1) | |
| 11 | ============================ |
| 12 | 10.500000000000000 | |
| 13 | taos> select TRUNCATE(10.55, 0) |
| 14 | truncate(10.55, 0) | |
| 15 | ============================ |
| 16 | 10.000000000000000 | |
| 17 | taos> select TRUNCATE(10.55, -1) |
| 18 | truncate(10.55, -1) | |
| 19 | ============================ |
| 20 | 10.000000000000000 | |
| 21 | taos> select TRUNCATE(10.55, -10) |
| 22 | truncate(10.55, -10) | |
| 23 | ============================ |
| 24 | 0.000000000000000 | |
| 25 | taos> select TRUNCATE(-10.55, 1) |
| 26 | truncate(-10.55, 1) | |
| 27 | ============================ |
| 28 | -10.500000000000000 | |
| 29 | taos> select TRUNCATE(99, 1) |
| 30 | truncate(99, 1) | |
| 31 | ======================== |
| 32 | 99 | |
| 33 | taos> select TRUNCATE(10.55, 1) + 1 |
| 34 | truncate(10.55, 1) + 1 | |
| 35 | ============================ |
| 36 | 11.500000000000000 | |
| 37 | taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3) |
| 38 | truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 | |
| 39 | =================================================================== |
| 40 | 1.231230000000000e+02 | |
| 41 | taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7) |
| 42 | truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 | |
| 43 | =================================================================== |
| 44 | 1.200000000000000e+08 | |
| 45 | taos> select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10 |
| 46 | truncate(87654321.123456789, id) | |
| 47 | =================================== |
| 48 | 8.765432100000000e+07 | |
| 49 | 8.765432109999999e+07 | |
| 50 | 8.765432112000000e+07 | |
| 51 | 8.765432112300000e+07 | |
| 52 | 8.765432112340000e+07 | |
| 53 | 8.765432112345000e+07 | |
| 54 | 8.765432112345600e+07 | |
| 55 | 8.765432112345670e+07 | |
| 56 | 8.765432112345679e+07 | |
| 57 | 8.765432112345679e+07 | |
| 58 | taos> select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10 |
| 59 | truncate(current, id) | |
| 60 | ======================== |
| 61 | 1.0000000e+01 | |
| 62 | 8.5000000e+00 | |
| 63 | 9.7900000e+00 | |
| 64 | 1.1233000e+01 | |
| 65 | 1.0706000e+01 | |
| 66 | 8.5080004e+00 | |
| 67 | 9.5959997e+00 | |
| 68 | 1.0962000e+01 | |
| 69 | 1.1226000e+01 | |
| 70 | 1.0337000e+01 | |
| 71 | taos> select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10 |
| 72 | truncate(current, 1) | |
| 73 | ======================= |
| 74 | 10.6000004 | |
| 75 | 8.5000000 | |
| 76 | 9.6999998 | |
| 77 | 11.1999998 | |
| 78 | 10.6999998 | |
| 79 | 8.5000000 | |
| 80 | 9.5000000 | |
| 81 | 10.8999996 | |
| 82 | 11.1999998 | |
| 83 | 10.3000002 | |
| 84 | taos> select TRUNC(10.55, 3) |
| 85 | trunc(10.55, 3) | |
| 86 | ============================ |
| 87 | 10.550000000000001 | |
| 88 | taos> select TRUNC(10.55, 2) |
| 89 | trunc(10.55, 2) | |
| 90 | ============================ |
| 91 | 10.550000000000001 | |
| 92 | taos> select TRUNC(10.55, 1) |
| 93 | trunc(10.55, 1) | |
| 94 | ============================ |
| 95 | 10.500000000000000 | |
| 96 | taos> select TRUNC(10.55, 0) |
| 97 | trunc(10.55, 0) | |
| 98 | ============================ |
| 99 | 10.000000000000000 | |
| 100 | taos> select TRUNC(10.55, -1) |
| 101 | trunc(10.55, -1) | |
| 102 | ============================ |
| 103 | 10.000000000000000 | |
| 104 | taos> select TRUNC(10.55, -10) |
| 105 | trunc(10.55, -10) | |
| 106 | ============================ |
| 107 | 0.000000000000000 | |
| 108 | taos> select TRUNC(-10.55, 1) |
| 109 | trunc(-10.55, 1) | |
| 110 | ============================ |
| 111 | -10.500000000000000 | |
| 112 | taos> select TRUNC(99, 1) |
| 113 | trunc(99, 1) | |
| 114 | ======================== |
| 115 | 99 | |
| 116 | taos> select TRUNC(10.55, 1) + 1 |
| 117 | trunc(10.55, 1) + 1 | |
| 118 | ============================ |
| 119 | 11.500000000000000 | |
| 120 | taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3) |
| 121 | trunc(trunc(trunc(trunc(trunc(trunc(trunc(123.123456789, 9), 8), | |
| 122 | =================================================================== |
| 123 | 1.231230000000000e+02 | |
| 124 | taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7) |
| 125 | trunc(trunc(trunc(trunc(trunc(trunc(trunc(123456789.123456789, - | |
| 126 | =================================================================== |
| 127 | 1.200000000000000e+08 | |
| 128 | taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10 |
| 129 | trunc(87654321.123456789, id) | |
| 130 | ================================ |
| 131 | 8.765432100000000e+07 | |
| 132 | 8.765432109999999e+07 | |
| 133 | 8.765432112000000e+07 | |
| 134 | 8.765432112300000e+07 | |
| 135 | 8.765432112340000e+07 | |
| 136 | 8.765432112345000e+07 | |
| 137 | 8.765432112345600e+07 | |
| 138 | 8.765432112345670e+07 | |
| 139 | 8.765432112345679e+07 | |
| 140 | 8.765432112345679e+07 | |
| 141 | taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10 |
| 142 | trunc(current, id) | |
| 143 | ======================= |
| 144 | 10.0000000 | |
| 145 | 8.5000000 | |
| 146 | 9.7900000 | |
| 147 | 11.2329998 | |
| 148 | 10.7060003 | |
| 149 | 8.5080004 | |
| 150 | 9.5959997 | |
| 151 | 10.9619999 | |
| 152 | 11.2259998 | |
| 153 | 10.3369999 | |
| 154 | taos> select TRUNC(current, 1) from ts_4893.meters order by ts limit 10 |
| 155 | trunc(current, 1) | |
| 156 | ======================= |
| 157 | 10.6000004 | |
| 158 | 8.5000000 | |
| 159 | 9.6999998 | |
| 160 | 11.1999998 | |
| 161 | 10.6999998 | |
| 162 | 8.5000000 | |
| 163 | 9.5000000 | |
| 164 | 10.8999996 | |
| 165 | 11.1999998 | |
| 166 | 10.3000002 | |
| 167 | taos> select truncate(99.99, 3) |
| 168 | truncate(99.99, 3) | |
| 169 | ============================ |
| 170 | 99.989999999999995 | |
| 171 | taos> select truncate(99.99, 2) |
| 172 | truncate(99.99, 2) | |
| 173 | ============================ |
| 174 | 99.989999999999995 | |
| 175 | taos> select truncate(99.99, 1) |
| 176 | truncate(99.99, 1) | |
| 177 | ============================ |
| 178 | 99.900000000000006 | |
| 179 | taos> select truncate(99.99, 0) |
| 180 | truncate(99.99, 0) | |
| 181 | ============================ |
| 182 | 99.000000000000000 | |
| 183 | taos> select truncate(99.99, -1) |
| 184 | truncate(99.99, -1) | |
| 185 | ============================ |
| 186 | 90.000000000000000 | |
| 187 | taos> select truncate(99.99, -10) |
| 188 | truncate(99.99, -10) | |
| 189 | ============================ |
| 190 | 0.000000000000000 | |
| 191 | taos> select truncate(99, 1) |
| 192 | truncate(99, 1) | |
| 193 | ======================== |
| 194 | 99 | |
| 195 | taos> select truncate(current, 1) from ts_4893.d0 order by ts limit 10 |
| 196 | truncate(current, 1) | |
| 197 | ======================= |
| 198 | 10.6000004 | |
| 199 | 8.5000000 | |
| 200 | 9.6999998 | |
| 201 | 11.1999998 | |
| 202 | 10.6999998 | |
| 203 | 8.5000000 | |
| 204 | 9.5000000 | |
| 205 | 10.8999996 | |
| 206 | 11.1999998 | |
| 207 | 10.3000002 | |
| 208 | taos> select truncate(current, 1) from ts_4893.meters order by ts limit 10 |
| 209 | truncate(current, 1) | |
| 210 | ======================= |
| 211 | 10.6000004 | |
| 212 | 8.5000000 | |
| 213 | 9.6999998 | |
| 214 | 11.1999998 | |
| 215 | 10.6999998 | |
| 216 | 8.5000000 | |
| 217 | 9.5000000 | |
| 218 | 10.8999996 | |
| 219 | 11.1999998 | |
| 220 | 10.3000002 | |
| 221 | taos> select truncate(99.99, null) |
| 222 | truncate(99.99, null) | |
| 223 | ============================ |
| 224 | NULL | |
| 225 | taos> select truncate(null, 3) |
| 226 | truncate(null, 3) | |
| 227 | ==================== |
| 228 | NULL | |
| 229 | taos> select truncate(1.0001, 3) |
| 230 | truncate(1.0001, 3) | |
| 231 | ============================ |
| 232 | 1.000000000000000 | |
| 233 | taos> select truncate(2.71828, 4) |
| 234 | truncate(2.71828, 4) | |
| 235 | ============================ |
| 236 | 2.718200000000000 | |
| 237 | taos> select truncate(3.14159, 2) |
| 238 | truncate(3.14159, 2) | |
| 239 | ============================ |
| 240 | 3.140000000000000 | |
| 241 | taos> select truncate(100.9876, 2) |
| 242 | truncate(100.9876, 2) | |
| 243 | ============================ |
| 244 | 100.980000000000004 | |
| 245 | taos> select truncate(99999999999999.9999, 2) |
| 246 | truncate(99999999999999.9999, 2) | |
| 247 | =================================== |
| 248 | 1.000000000000000e+14 | |
| 249 | taos> select truncate(-5.678, 2) |
| 250 | truncate(-5.678, 2) | |
| 251 | ============================ |
| 252 | -5.670000000000000 | |
| 253 | taos> select truncate(voltage, 2) from ts_4893.meters limit 1 |
| 254 | truncate(voltage, 2) | |
| 255 | ======================= |
| 256 | 221 | |
| 257 | taos> select truncate(current, 1) from ts_4893.meters limit 1 |
| 258 | truncate(current, 1) | |
| 259 | ======================= |
| 260 | 10.6000004 | |
| 261 | taos> select truncate(phase, 3) from ts_4893.meters limit 1 |
| 262 | truncate(phase, 3) | |
| 263 | ======================= |
| 264 | 0.5080000 | |
| 265 | taos> select truncate(voltage + current, 2) from ts_4893.meters limit 1 |
| 266 | truncate(voltage + current, 2) | |
| 267 | ================================= |
| 268 | 2.316400000000000e+02 | |
| 269 | taos> select truncate(voltage, -1) from ts_4893.meters limit 1 |
| 270 | truncate(voltage, -1) | |
| 271 | ======================== |
| 272 | 220 | |
| 273 | taos> select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1 |
| 274 | round(truncate(voltage, 1), 2) | |
| 275 | ================================= |
| 276 | 221 | |
| 277 | taos> select truncate(abs(current), 1) from ts_4893.meters limit 1 |
| 278 | truncate(abs(current), 1) | |
| 279 | ============================ |
| 280 | 1.0600000e+01 | |
| 281 | taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1 |
| 282 | truncate(exp(phase), 2) | |
| 283 | ============================ |
| 284 | 1.660000000000000 | |
| 285 | taos> select truncate(log(current), 1) from ts_4893.meters limit 1 |
| 286 | truncate(log(current), 1) | |
| 287 | ============================ |
| 288 | 2.300000000000000 | |