From: "kou (Kouhei Sutou) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "kou (Kouhei Sutou)" <noreply@ruby-lang.org>
Subject: [ruby-core:118979] [Ruby master Feature#20705] Should "0.E-9" be a valid float value?
Date: Thu, 29 Aug 2024 08:01:56 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-20705.20240829080155.32@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20705.20240829080155.32@ruby-lang.org>
Issue #20705 has been reported by kou (Kouhei Sutou).
----------------------------------------
Feature #20705: Should "0.E-9" be a valid float value?
https://bugs.ruby-lang.org/issues/20705
* Author: kou (Kouhei Sutou)
* Status: Open
----------------------------------------
Ruby doesn't accept "0.E-9" as a valid float value:
```console
$ 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:
```text
=> select 0.E-9;
?column?
-------------
0.000000000
(1 row)
```
MySQL:
```text
> select 0.E-9;
+-------+
| 0.E-9 |
+-------+
| 0 |
+-------+
1 row in set (0.00 sec)
```
Python:
```console
$ python3 -c 'print(0.E-9)'
0.0
```
Node.js:
```console
$ 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
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
next parent reply other threads:[~2024-08-29 8:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 8:01 kou (Kouhei Sutou) via ruby-core [this message]
2024-08-29 9:02 ` [ruby-core:118980] " nobu (Nobuyoshi Nakada) via ruby-core
2024-08-29 9:10 ` [ruby-core:118981] " mame (Yusuke Endoh) via ruby-core
2024-08-29 14:10 ` [ruby-core:118982] " Hanmac (Hans Mackowiak) via ruby-core
2024-09-05 8:49 ` [ruby-core:119061] " matz (Yukihiro Matsumoto) via ruby-core
2024-09-05 9:05 ` [ruby-core:119063] " nobu (Nobuyoshi Nakada) via ruby-core
2024-09-06 2:48 ` [ruby-core:119077] " kou (Kouhei Sutou) via ruby-core
2024-09-06 8:06 ` [ruby-core:119083] " mrkn (Kenta Murata) via ruby-core
2024-10-03 8:58 ` [ruby-core:119426] " matz (Yukihiro Matsumoto) via ruby-core
2024-10-03 9:11 ` [ruby-core:119429] " kou (Kouhei Sutou) via ruby-core
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-20705.20240829080155.32@ruby-lang.org \
--to=ruby-core@ml.ruby-lang.org \
--cc=noreply@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).