File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -460,7 +460,8 @@ namespace ent
460
460
461
461
try
462
462
{
463
- if (item.find (' .' ) == string::npos)
463
+ // if (item.find('.') == string::npos)
464
+ if (item.find_first_of (" .eE" ) == string::npos)
464
465
{
465
466
return std::stoll (item, nullptr , 0 );
466
467
}
Original file line number Diff line number Diff line change @@ -163,16 +163,18 @@ TEST_SUITE("json")
163
163
"upper": 3.141E-10,
164
164
"long": 12345123456789,
165
165
"big": 123456789123456789123456789.0,
166
- "tiny": 1.0e-300
166
+ "tiny": 1.0e-300,
167
+ "pointless": 1e-5
167
168
})json" );
168
169
169
- CHECK (t[" integer" ].as_long () == 42 );
170
- CHECK (t[" double" ].as_double () == 3.14 );
171
- CHECK (t[" scientific" ].as_double () == 3.141e-10 );
172
- CHECK (t[" upper" ].as_double () == 3.141e-10 );
173
- CHECK (t[" long" ].as_long () == 12345123456789 );
174
- CHECK (t[" big" ].as_double () == 123456789123456789123456789.0 );
175
- CHECK (t[" tiny" ].as_double () == 1.0e-300 );
170
+ CHECK (t[" integer" ].as_long () == 42 );
171
+ CHECK (t[" double" ].as_double () == 3.14 );
172
+ CHECK (t[" scientific" ].as_double () == 3.141e-10 );
173
+ CHECK (t[" upper" ].as_double () == 3.141e-10 );
174
+ CHECK (t[" long" ].as_long () == 12345123456789 );
175
+ CHECK (t[" big" ].as_double () == 123456789123456789123456789.0 );
176
+ CHECK (t[" tiny" ].as_double () == 1.0e-300 );
177
+ CHECK (t[" pointless" ].as_double () == 1e-5 ); // Check for scientific notation without a decimal point
176
178
}
177
179
178
180
You can’t perform that action at this time.
0 commit comments