Documentation Source Text

Check-in [85757c1492]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Revised and amplified definition of the tointeger() and toreal() functions.
Timelines: family | ancestors | toTypeFuncs
Files: files | file ages | folders
SHA1: 85757c1492ce7f8c535c1d57480188f456f942cd
User & Date: drh 2013-08-20 03:06:08
Context
2013-08-20
03:06
Revised and amplified definition of the tointeger() and toreal() functions. Leaf check-in: 85757c1492 user: drh tags: toTypeFuncs
2013-08-19
21:17
Initial docs for tointeger() and toreal() SQL functions. check-in: 083cd58817 user: mistachkin tags: toTypeFuncs
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/lang.in.

  2310   2310     right rather than the left.  ^If Z is negative then
  2311   2311     the abs(Z) characters preceding the Y-th character are returned.
  2312   2312     ^If X is a string then characters indices refer to actual UTF-8 
  2313   2313     characters.  ^If X is a BLOB then the indices refer to bytes.
  2314   2314   }
  2315   2315   
  2316   2316   funcdef {tointeger(X)} {} {
  2317         -  If X is any value (integer, double, or string) that can be losslessly
  2318         -  converted into an integer, then make the conversion and return the result.
  2319         -  Otherwise, return NULL.
         2317  +  If X is an integer then tointeger(X) returns X.
         2318  +  If X is a floating point number or a string that can be losslessly converted 
         2319  +  into a 64-bit signed integer then tointeger(X) returns that integer.
         2320  +  If X is NULL or a BLOB or a floating point number that cannot be represented as a
         2321  +  64-bit signed integer or a string that contains whitespace or a string that
         2322  +  does not describe a 64-bit signed integer, then tointeger(X) returns NULL.
  2320   2323   }
  2321   2324   
  2322   2325   funcdef {toreal(X)} {} {
  2323         -  If X can be losslessly converted into a real number, then do so and return
  2324         -  that real number.  Otherwise return NULL.
         2326  +  If X is a floating point number then toreal(X) returns X.
         2327  +  If X is an integer that can be converted into a 64-bit IEEE-754 floating point
         2328  +  number with no loss of precision, then toreal(X) returns that number.
         2329  +  If X is a string that describes a floating point number, then toreal(X)
         2330  +  returns that number or a close approximation.
         2331  +  If X is NULL or a BLOB or an integer that is too large to be losslessly
         2332  +  converted into a 64-bit IEEE-754 number or a string that contains whitespace
         2333  +  or a string that does not describe a floating point value, then
         2334  +  toreal(X) returns NULL.
  2325   2335   }
  2326   2336   
  2327   2337   funcdef {total_changes()} {} {
  2328   2338     ^The total_changes() function returns the number of row changes
  2329   2339     caused by INSERT, UPDATE or DELETE
  2330   2340     statements since the current database connection was opened.
  2331   2341     ^This function is a wrapper around the [sqlite3_total_changes()]