Skip to content

Commit

Permalink
docs-Changes to Number data types documentation (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjnield authored Sep 4, 2024
1 parent 0de4644 commit dc3b823
Showing 1 changed file with 60 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: In SurrealDB, numbers can be one of three types - 64-bit integers,

In SurrealDB, numbers can be one of three types: 64-bit integers, 64-bit floating point numbers, or 128-bit decimal numbers.

Integer numbers
## Integer numbers
If a numeric value is specified without a decimal point and is within the range `-9223372036854775808` to `9223372036854775807` then the value will be parsed, stored, and treated as a 64-bit integer.

```surql
Expand Down Expand Up @@ -87,6 +87,7 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<thead>
<tr>
<th colspan="2" scope="col">Constant</th>
<th colspan="2" scope="col">Description</th>
<th colspan="2" scope="col">Value</th>
</tr>
</thead>
Expand All @@ -95,6 +96,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::E</code>
</td>
<td colspan="2" scope="row" data-label="Description">
Euler’s number (e)
</td>
<td colspan="2" scope="row" data-label="Value">
2.718281828459045
</td>
Expand All @@ -103,6 +107,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_1_PI</code>
</td>
<td colspan="2" scope="row" data-label="Description">
1/π
</td>
<td colspan="2" scope="row" data-label="Value">
0.3183098861837907
</td>
Expand All @@ -111,6 +118,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_1_SQRT_2</code>
</td>
<td colspan="2" scope="row" data-label="Description">
1/sqrt(2)
</td>
<td colspan="2" scope="row" data-label="Value">
0.7071067811865476
</td>
Expand All @@ -119,6 +129,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_2_PI</code>
</td>
<td colspan="2" scope="row" data-label="Description">
2/π
</td>
<td colspan="2" scope="row" data-label="Value">
0.6366197723675814
</td>
Expand All @@ -127,6 +140,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_2_SQRT_PI</code>
</td>
<td colspan="2" scope="row" data-label="Description">
2/sqrt(π)
</td>
<td colspan="2" scope="row" data-label="Value">
1.1283791670955126
</td>
Expand All @@ -135,6 +151,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_PI_2</code>
</td>
<td colspan="2" scope="row" data-label="Description">
π/2
</td>
<td colspan="2" scope="row" data-label="Value">
1.5707963267948966
</td>
Expand All @@ -143,6 +162,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_PI_3</code>
</td>
<td colspan="2" scope="row" data-label="Description">
π/3
</td>
<td colspan="2" scope="row" data-label="Value">
1.0471975511965979
</td>
Expand All @@ -151,6 +173,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_PI_4</code>
</td>
<td colspan="2" scope="row" data-label="Description">
π/4
</td>
<td colspan="2" scope="row" data-label="Value">
0.7853981633974483
</td>
Expand All @@ -159,6 +184,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_PI_6</code>
</td>
<td colspan="2" scope="row" data-label="Description">
π/6
</td>
<td colspan="2" scope="row" data-label="Value">
0.5235987755982989
</td>
Expand All @@ -167,6 +195,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::FRAC_PI_8</code>
</td>
<td colspan="2" scope="row" data-label="Description">
π/8
</td>
<td colspan="2" scope="row" data-label="Value">
0.39269908169872414
</td>
Expand All @@ -175,6 +206,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LN_10</code>
</td>
<td colspan="2" scope="row" data-label="Description">
ln(10)
</td>
<td colspan="2" scope="row" data-label="Value">
2.302585092994046
</td>
Expand All @@ -183,6 +217,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LN_2</code>
</td>
<td colspan="2" scope="row" data-label="Description">
ln(2)
</td>
<td colspan="2" scope="row" data-label="Value">
0.6931471805599453
</td>
Expand All @@ -191,6 +228,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LOG10_2</code>
</td>
<td colspan="2" scope="row" data-label="Description">
log<sub>10</sub>(2)
</td>
<td colspan="2" scope="row" data-label="Value">
0.3010299956639812
</td>
Expand All @@ -199,6 +239,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LOG10_E</code>
</td>
<td colspan="2" scope="row" data-label="Description">
log<sub>10</sub>(e)
</td>
<td colspan="2" scope="row" data-label="Value">
0.4342944819032518
</td>
Expand All @@ -207,6 +250,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LOG2_10</code>
</td>
<td colspan="2" scope="row" data-label="Description">
log<sub>2</sub>(10)
</td>
<td colspan="2" scope="row" data-label="Value">
3.321928094887362
</td>
Expand All @@ -215,6 +261,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::LOG2_E</code>
</td>
<td colspan="2" scope="row" data-label="Description">
log<sub>2</sub>(e)
</td>
<td colspan="2" scope="row" data-label="Value">
1.4426950408889634
</td>
Expand All @@ -223,6 +272,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::PI</code>
</td>
<td colspan="2" scope="row" data-label="Description">
Archimedes’ constant (π)
</td>
<td colspan="2" scope="row" data-label="Value">
3.141592653589793
</td>
Expand All @@ -231,6 +283,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::SQRT_2</code>
</td>
<td colspan="2" scope="row" data-label="Description">
sqrt(2)
</td>
<td colspan="2" scope="row" data-label="Value">
1.4142135623730951
</td>
Expand All @@ -239,6 +294,9 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
<td colspan="2" scope="row" data-label="Constant">
<code>MATH::TAU</code>
</td>
<td colspan="2" scope="row" data-label="Description">
The full circle constant (τ)
</td>
<td colspan="2" scope="row" data-label="Value">
6.283185307179586
</td>
Expand All @@ -247,4 +305,4 @@ CREATE circle SET radius = circumference / ( 2 * MATH::PI );
</table>

## Next steps
You've now seen how to use numeric values in SurrealDB. For more advanced functionality, take a look at the operators and math functions, which enable advanced calculations on numeric values and sets of numeric values.
You've now seen how to use numeric values in SurrealDB. For more advanced functionality, take a look at the operators and math functions, which enable advanced calculations on numeric values and sets of numeric values.

0 comments on commit dc3b823

Please sign in to comment.