Project

General

Profile

Actions

Feature #20705

closed

Should "0.E-9" be a valid float value?

Added by kou (Kouhei Sutou) 2 months ago. Updated 29 days ago.

Status:
Closed
Target version:
-
[ruby-core:118979]

Description

Ruby doesn't accept "0.E-9" as a valid float value:

$ ruby -e 'Float("0.E-9")'
<internal:kernel>:218:in 'Kernel#Float': invalid value for Float(): "0.E-9" (ArgumentError)
	from -e:1:in '<main>'

But other systems accept "0.E-9" as a valid float value:

PostgreSQL:

=> select 0.E-9;
  ?column?   
-------------
 0.000000000
(1 row)

MySQL:

> select 0.E-9;
+-------+
| 0.E-9 |
+-------+
|     0 |
+-------+
1 row in set (0.00 sec)

Python:

$ python3 -c 'print(0.E-9)'
0.0

Node.js:

$ nodejs -e 'console.log(0.E-9)'
0

Should Ruby accept "0.E-9" as a valid float value?

FYI: I don't have an opinion of this. I just realized this by an issue from an user of a maintained library by me: https://github.com/apache/arrow/issues/43877

Actions

Also available in: Atom PDF

Like0
Like0Like1Like0Like0Like0Like0Like0Like0Like0Like0