I think VAL() should work for hexadecimal numbers and not only for decimal as it does now.
PRINT VAL("$FFFFFFF")
should print: 268435455.
I believe it would not be too difficult to implement since the code already exists for converting numbers in code.
PRINT $FFFFFFF
works now, and types: 268435455.
Especially now when HEX$() exists. HEX$() converts without $ as prefix, but I think that's OK since $ could be added easily if one wants. It's also similar to how it works in other BASICs, e.g. GW-BASIC: http://www.antonis.de/qbebooks/gwbasman/hexs.html
In GW-BASIC HEX$() also works for negative numbers, e.g. HEX$(-32768) is "8000", but negative numbers doesn't currently work with X16 BASIC HEX$().
I don't think it's necessary to implement VAL() for binary numbers, even though BIN$() exists, but if one did they should probably have % as prefix, e.g. %101.
I think
VAL()
should work for hexadecimal numbers and not only for decimal as it does now.PRINT VAL("$FFFFFFF")
should print:
268435455
.I believe it would not be too difficult to implement since the code already exists for converting numbers in code.
PRINT $FFFFFFF
works now, and types:
268435455
.Especially now when
HEX$()
exists.HEX$()
converts without$
as prefix, but I think that's OK since$
could be added easily if one wants. It's also similar to how it works in other BASICs, e.g. GW-BASIC: http://www.antonis.de/qbebooks/gwbasman/hexs.htmlIn GW-BASIC
HEX$()
also works for negative numbers, e.g.HEX$(-32768)
is"8000"
, but negative numbers doesn't currently work with X16 BASICHEX$()
.I don't think it's necessary to implement
VAL()
for binary numbers, even thoughBIN$()
exists, but if one did they should probably have%
as prefix, e.g.%101
.FreePascal uses the same prefixes:
https://www.freepascal.org/docs-html/ref/refse6.html