Difference between revisions of "Talk:Documentation/BASIC Guide/Numbers"
From Apache OpenOffice Wiki
Yecril71pl (talk | contribs) m (signature) |
(→Special numeric values: Val and Asc) |
||
Line 7: | Line 7: | ||
--[[User:Yecril71pl|Yecril71pl]] 10:56, 6 March 2012 (UTC) | --[[User:Yecril71pl|Yecril71pl]] 10:56, 6 March 2012 (UTC) | ||
+ | |||
+ | :What "special numeric value" did you have in mind? | ||
+ | |||
+ | :I presume the above code errors out because of the "#" after the "VAL". It is neither necessary nor possible to specify the precision of the functions; Basic will provide the precision indicated by the destination (double, in this case). | ||
+ | :Please note that <tt>VAL</tt> only converts numeric characters ("123"), and would yield zero for the above case. The <tt>ASC</tt> function will return the numeric value of a character, but only of one character at a time. | ||
+ | :VAL("12") = 12 (decimal) | ||
+ | :ASC("12") = 49 (&H31 for character "1"; the "2" is ignored) | ||
+ | |||
+ | :The on-line Help is your friend for things like this; it is very complete, where this manual is an introduction. --[[User:TJFrazier|TJ]] ([[User_talk:TJFrazier|Talk]] | [[Special:Contributions/TJFrazier|Contribs]]) 00:15, 7 March 2012 (UTC) |
Latest revision as of 00:15, 7 March 2012
Special numeric values
Is it possible to assign a special numeric value to a variable? The following code errors out:
DIM F# F# = VAL# ("NaN")
--Yecril71pl 10:56, 6 March 2012 (UTC)
- What "special numeric value" did you have in mind?
- I presume the above code errors out because of the "#" after the "VAL". It is neither necessary nor possible to specify the precision of the functions; Basic will provide the precision indicated by the destination (double, in this case).
- Please note that VAL only converts numeric characters ("123"), and would yield zero for the above case. The ASC function will return the numeric value of a character, but only of one character at a time.
- VAL("12") = 12 (decimal)
- ASC("12") = 49 (&H31 for character "1"; the "2" is ignored)