Common Errors and Problems
Floating Point Precision Limits
No computer can store all floating point numbers (i.e., non-integers) with perfect precision. The float data type offers about 7 decimal digits of precision; the double data type offers about 15 decimal digits of precision. Comparing two float or double values by using operators involving exact equality (==, ⇐, >=, BETWEEN … AND …) might lead to unexpected behavior. If the GSQL language parser detects that the user is attempting an exact equivalence test with float or double data types, it will display a warning message and suggestion. For example, if there are two float variables v and v2, the expression v == v2 causes the following warning message:
The comparison 'v==v2' may lead to unexpected behavior because it involves
equality test between float/double numeric values. We suggest to do such
comparison with an error margin, e.g. 'abs((v) - (v2)) < epsilon', where epsilon
is a very small positive value of your choice, such as 0.0001.
Response to Non-existent vertex ID
If a query has a vertex parameter (VERTEX or VERTEX<vType>), and if the ID for a nonexistent vertex is given when running the query, an error message is shown, and the query won’t run. This is also the response when calling a function to convert a single vertex ID string to a vertex:
-
to_vertex(): See Section "Miscellaneous Functions".
However, if the parameter is a vertex set (SET<VERTEX> or SET<VERTEX<vType>>), and one or more nonexistent IDs are given when running the query, a warning message is shown, but the query still runs, ignoring those nonexistent IDs. Therefore, if all given IDs are nonexistent, the parameter becomes an empty set. T his is also the response when calling a function to convert a set of vertex IDs to a set of vertices :
-
to_vertex_set(): See Section " Miscellaneous Functions ".
-
SelectVertex(): See Section " Miscellaneous Functions ".