Closed AlexRTer closed 6 months ago
Thank you for your feedback, I will go ahead and implement some better testing as well.
I changed the grammar slightly to disallow digit separators right behind the decimal point.
The tests now include some negative tests, i.e.
infff
, 1.
, 01.0
, 10.0_
, 1.'0
and cover (corresponding file index in brackets)
12.34
)1_000.0
)1e6
)0.000000e-6
)1.0_0e6
)For all tested ordinary values there is a test without signs, with a negative sign, as float type and mixed (negative and float type). The tests also cover small and capital e for scientific notation as well as +
, -
signs.
I believe a test to verify that e.g. 1.0f
is of float type is still missing in Daphne. Maybe a built-in typeof
function would be a good addition to DaphneDSL.
By the way, there is an open issue on introducing a typeof()
built-in function in DaphneDSL: #357.
This PR closes #659. It adds scientific notation for float literals as well as digit separators for both float and integer literals to improve readability.
Features:
e
andE
)1.2e3 = 1200
,1E-3 = 0.001
, both of typef64
'
and_
for float and integer literals1e6 = 1'000'000 = 1_000_000
Changes: