Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
val [2019/05/27 21:26] neilsval [2019/06/02 21:32] neils
Line 5: Line 5:
   val!(<string ptr str>) |  val(<string ptr str>) | val%(<string ptr str>)   val!(<string ptr str>) |  val(<string ptr str>) | val%(<string ptr str>)
      
-The ''VAL()'' function tries to parse the numeric value in a string pointed by //str// to the numeric type of the function. Parsing stops at the first character that is non-numeric (or a minus sign if the function type is integer).+The ''VAL()'' function tries to parse the numeric value in a string pointed by //str// to the numeric type of the function. 
 + 
 +===== Parsing rules for VAL!() ===== 
 + 
 +The ''VAL!()'' function will return 0 if: 
 + 
 +  * The argument points to an empty string 
 +  * The string is longer than 3 characters 
 +  * The string contains any non-numeric character, including a space 
 +  * The numeric value exceeds 255 
 + 
 +===== Parsing rules for VAL() ===== 
 + 
 +The ''VAL!()'' function will return 0 if: 
 + 
 +  * The argument points to an empty string 
 +  * The string is longer than 6 characters 
 +  * The string contains any non-numeric character, except for the first character which can be a minus sign (''-''
 +  * The numeric value is less than -32768 or greater than +32767 
 + 
 +===== Parsing rules for VAL%(=====
  
 The ''VAL%()'' function is hardwired to the equivalent function in BASIC ROM, please refer to [[https://www.c64-wiki.com/wiki/VAL|this page]] for parsing rules. The ''VAL%()'' function is hardwired to the equivalent function in BASIC ROM, please refer to [[https://www.c64-wiki.com/wiki/VAL|this page]] for parsing rules.