fix some bug of strtold#8495
Conversation
with the test of sim:lua ,I have fixed some bug of error output 1.input: " " and error output string is "NULL" 2.input: "1.2e+", error output string is "NULL" 3.input: "." error output string is "NULL"
e6dc07e to
ed474ef
Compare
|
@flyingfish89 Thank you for this. Just to provide some feedback, after this patch, all tests pass, apart from specifically the following: assert(tonumber'+ 0.01' == nil and tonumber'+.e1' == nil and
tonumber'1e' == nil and tonumber'1.0e+' == nil and
tonumber'.' == nil)I think this is the only one left. |
yes,i have tried these,and i have found if " '1.0e+' == nil " is wrong ,because it will return 1.0 and "+" |
|
Well... After applying this change, a get a previous test failing: assert(0e12 == 0 and .0 == 0 and 0. == 0 and .2e2 == 20 and 2.E-1 == 0.2)with: |
|
Unfortunatelly not... assert(string.format("%+08d", 2^31 - 1) == "+2147483647")fails with: |
|
i'm sorry.i have tried this and i couldn't found any question,could you please show me about it! |
|
Maybe I did a typo? Can you please post as code, instead of a screenshot? |
|
em...,this mistake have no connection with what I just modified |
|
@flyingfish89 sorry for the long delay, I was concentrating on other issues. I applied your above change: if (((c | 32) == 'e' && isdigit(*f)) || ((*f == '+' || *f == '-') && (isdigit(*(f + 1)))))
{
num_decimal = scanexp(&f, 1) + num_decimal;
if (num_decimal <= llong_min / 100)
{
ifexist(endptr, f);
return zero;
}
}And indeed I get: If I remove this change, this test passes. So the error is only triggered with this change. I tried the same test with |
|
|
|
@flyingfish89 Yes! That did the trick! Can you please provide a PR for this? |
|
ok. |






Summary
with the test of sim:lua ,I have fixed some bug of error output
1.input: " " and error output string is "NULL"
2.input: "1.2e+", error output string is "NULL"
3.input: "." error output string is "NULL"
Impact
Testing