-
Notifications
You must be signed in to change notification settings - Fork 0
Number Syntax
Tarn W. Burton edited this page Jul 17, 2024
·
1 revision
number
::= integer | ratio | float
integer
::= [sign] {decimal-digit}+ decimal-point | [sign] {digit}+
ratio
::= [sign] {digit}+ slash {digit}+
float
::= [sign] {decimal-digit}* decimal-point {decimal-digit}+ [exponent]
| [sign] {decimal-digit}+ [decimal-point {decimal-digit}*] exponent
exponent
::= exponent-marker sign {digit}+
exponent-marker
:= 'e' | 'E' | 's' | 'S' | 'f' | 'F' | 'd' | 'D' | 'l' | 'L'
number
::= integer [fraction] [exponent]
integer
::= [negative-sign] digit | [negative-sign] non-zero-digit {digit}+
fraction
::= decimal-point {digit}+
exponent
::= exponent-marker [sign] {digit}+
float
::= {decimal-digit}+ decimal-exponent [suffix]
| {decimal-digit}+ decimal-point [decimal-exponent] [suffix]
| {decimal-digit}* decimal-point {decimal-digit}+ [decimal-exponent] [suffix]
| hex-radix-marker {hex-digit}+ hex-exponent [suffix]
| hex-radix-marker {hex-digit}+ decimal-point hex-exponent [suffix]
| hex-radix-marker {hex-digit}* decimap-point {hex-digit}+ hex-exponent [suffix]
decimal-exponent
:= {'e' | 'E'} [sign] [decimal-digit]+
decimal-exponent
:= {'p' | 'P'} [sign] [decimal-digit]+
suffix
:= 'f' | 'l' | 'F' | 'L' | 'f16' | 'f32' | 'f64' | 'f128' | 'bf16' | 'F16' | 'F32'
| 'F64' | 'F128' | 'BF16'