-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for multiple bases to Prefix. #57
Copy link
Copy link
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requesthardNot recommended for beginners. Will take significant effort to complete.Not recommended for beginners. Will take significant effort to complete.
Description
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requesthardNot recommended for beginners. Will take significant effort to complete.Not recommended for beginners. Will take significant effort to complete.
Add support for multiple bases in
INTandFLTto Prefix.Each number (
INTorFLT) literal MUST be determined by a base prefix.The following base prefixes are valid for number literals:
0b= Binary literals consist of0-10o= Octal literals consist of0-70d= Decimal literals consist of0-90x= Hexadecimal literals consist of0-9&A-F0t= Duotrigesimal (base 32) literals consist of0-9&A-V0c= Base 58 literals consist of1-9&A-H&J-N&P-Z&a-k&m-z0s= Base 64 literals consist of0-9&A-Z&a-z&+_0rNN= BaseNN.NNis two decimal digits, smaller than or equal to 64. Literals consist of the same set as base 64, only limited to those smaller than the base.Numbers MUST NOT have a base less than decimal 2 or greater than decimal 64. If an operation (either with
0rNNorCONVERT) would produce such a number, it MUST error.The output of a mathematical operation uses the highest base present in the operands.
The sign (
-or nothing) MUST appear before the base prefix.FLTinfinities and NaN do not have a base specified with a prefix, and are considered base NaN.Conversion of a number to a
STR(including inPRINT) MUST represent the number in it's base, with the base prefix included.Add new operator
INT|FLT: CONVERT(INT|FLT: num, INT: base). Convertnumto basebase. Ifnumwas anINTthat can not be represented precisely inbase, keep it as anINTanyway. Add new operatorINT: BASE(INT|FLT: num). Return the base ofnum.BAND,BOR,BXOR,SHL, andSHRonly accept binaryINT.Numbers remain otherwise the same.
Update both the implementation and the specification.