forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
64 lines
6.6 KiB
HTML
64 lines
6.6 KiB
HTML
<a name="dli_spark_bround"></a><a name="dli_spark_bround"></a>
|
|
|
|
<h1 class="topictitle1">bround</h1>
|
|
<div id="body8662426"><p id="dli_spark_bround__en-us_topic_0000001696401501_p14292114918339">This function is used to return a value that is rounded off to <strong id="dli_spark_bround__en-us_topic_0000001696401501_b0811153416585">d</strong> decimal places.</p>
|
|
<div class="section" id="dli_spark_bround__en-us_topic_0000001696401501_section45291954203217"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="dli_spark_bround__en-us_topic_0000001696401501_screen19928459112517">bround(DOUBLE a, INT d)</pre>
|
|
</div>
|
|
<div class="section" id="dli_spark_bround__en-us_topic_0000001696401501_section992014913317"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_spark_bround__en-us_topic_0000001696401501_table1829154762513" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_spark_bround__en-us_topic_0000001696401501_row8830104792517"><th align="left" class="cellrowborder" valign="top" width="14.14%" id="mcps1.3.3.2.2.5.1.1"><p id="dli_spark_bround__en-us_topic_0000001696401501_p983074711252">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="12.379999999999999%" id="mcps1.3.3.2.2.5.1.2"><p id="dli_spark_bround__en-us_topic_0000001696401501_p6830124732517">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.78%" id="mcps1.3.3.2.2.5.1.3"><p id="dli_spark_bround__en-us_topic_0000001696401501_p13318164512614">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="52.7%" id="mcps1.3.3.2.2.5.1.4"><p id="dli_spark_bround__en-us_topic_0000001696401501_p08301547132513">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_spark_bround__en-us_topic_0000001696401501_row15830184792511"><td class="cellrowborder" valign="top" width="14.14%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p683034714250">a</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.379999999999999%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p12830184752518">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.78%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p0318545102615">DOUBLE, BIGINT, DECIMAL, or STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="52.7%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p1974432133011">The value can be a float, integer, or string.</p>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p0282133318304">It indicates the value that needs to be rounded.</p>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p16712313162810">The digit 5 is rounded up if the digit before 5 is an odd number and rounded down if the digit before 5 is an even number.</p>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p37121813202816">If the value is not of the DOUBLE type, the system will implicitly convert it to the DOUBLE type for calculation.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_spark_bround__en-us_topic_0000001696401501_row127982194288"><td class="cellrowborder" valign="top" width="14.14%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p379819197283">d</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="12.379999999999999%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p3799151902812">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.78%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p1679941962811">DOUBLE, BIGINT, DECIMAL, or STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="52.7%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_spark_bround__en-us_topic_0000001696401501_p13799171913287">It indicates the number of decimal places to which the value needs to be rounded.</p>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p139631023152914">If the value is not of the INT type, the system will implicitly convert it to the INT type for calculation.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_spark_bround__en-us_topic_0000001696401501_section210162513312"><h4 class="sectiontitle">Return Values</h4><p id="dli_spark_bround__en-us_topic_0000001696401501_p1387835132114">The return value is of the DOUBLE type.</p>
|
|
<div class="note" id="dli_spark_bround__en-us_topic_0000001696401501_note61422099395"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_spark_bround__en-us_topic_0000001696401501_p14226228252">If the value of <strong id="dli_spark_bround__en-us_topic_0000001696401501_b122365714513">a</strong> or <strong id="dli_spark_bround__en-us_topic_0000001696401501_b1471184615">d</strong> is <strong id="dli_spark_bround__en-us_topic_0000001696401501_b15224115714511">NULL</strong>, <strong id="dli_spark_bround__en-us_topic_0000001696401501_b112241157055">NULL</strong> is returned.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="dli_spark_bround__en-us_topic_0000001696401501_section13277192233920"><h4 class="sectiontitle">Example Code</h4><p id="dli_spark_bround__en-us_topic_0000001696401501_p2535113103113">The value <strong id="dli_spark_bround__en-us_topic_0000001696401501_b110700265865619">1</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_bround__en-us_topic_0000001696401501_screen3729192413314">select bin(1);</pre>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p41171264313">The value <strong id="dli_spark_bround__en-us_topic_0000001696401501_b16802181711613">NULL</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_bround__en-us_topic_0000001696401501_screen10891334183113">select bin(null);</pre>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p1573910793115">The value <strong id="dli_spark_bround__en-us_topic_0000001696401501_b13989223565589">1000</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_bround__en-us_topic_0000001696401501_screen862210415341">select bin(8);</pre>
|
|
<p id="dli_spark_bround__en-us_topic_0000001696401501_p1128829173111">The value <strong id="dli_spark_bround__en-us_topic_0000001696401501_b12639175995589">1000</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_bround__en-us_topic_0000001696401501_screen72812014193411">select bin(8.123456);</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0473.html">Mathematical Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|