<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">I'd say that the specification of the input to erlang:list_to_float/1 should be in</div><div class="gmail_default" style="font-family:monospace,monospace">the manual entry for erlang:list_to_float/1, namely</div><div class="gmail_default" style="font-family:monospace,monospace"><a href="http://erlang.org/doc/man/erlang.html#list_to_float-1">http://erlang.org/doc/man/erlang.html#list_to_float-1</a><br></div><div class="gmail_default" style="font-family:monospace,monospace">By experiment, it looks like /^[-+]?[0-9]+[.][0-9]+([eE][-+]?[0-9]+)?$/</div><div class="gmail_default" style="font-family:monospace,monospace">(Note: [-+] works but [+-] of course does not.)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 16 Mar 2019 at 11:52, Hugo Mills <<a href="mailto:hugo@carfax.org.uk">hugo@carfax.org.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Where in the manual is the set of allowable string representations<br>
of floating point numbers documented? I'd have expected it to be here:<br>
<br>
<a href="http://erlang.org/doc/reference_manual/data_types.html" rel="noreferrer" target="_blank">http://erlang.org/doc/reference_manual/data_types.html</a><br>
<br>
... but apparently not.<br>
<br>
Specifically, I'm trying to use list_to_float/1, and I've been<br>
trying to reverse engineer it:<br>
<br>
1> list_to_float("-1").<br>
** exception error: bad argument<br>
in function list_to_float/1<br>
called as list_to_float("-1")<br>
2> list_to_float("-1.0").<br>
-1.0<br>
3> list_to_float("-1.0e-23").<br>
-1.0e-23<br>
4> list_to_float("-1e-23"). <br>
** exception error: bad argument<br>
in function list_to_float/1<br>
called as list_to_float("-1e-23")<br>
5> list_to_float(".3").<br>
** exception error: bad argument<br>
in function list_to_float/1<br>
called as list_to_float(".3")<br>
<br>
An actual written specification would be really handy here. Even<br>
just a regex or EBNF for them. I'm writing a parser for something<br>
where the definition of floating point literals isn't quite the same<br>
as Erlang's, and it's a bit painful.<br>
<br>
Hugo.<br>
<br>
-- <br>
Hugo Mills | Your problem is that you've got too much taste to be<br>
hugo@... <a href="http://carfax.org.uk" rel="noreferrer" target="_blank">carfax.org.uk</a> | a web developer.<br>
<a href="http://carfax.org.uk/" rel="noreferrer" target="_blank">http://carfax.org.uk/</a> |<br>
PGP: E2AB1DE4 | Steve Harris<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.12 (GNU/Linux)<br>
<br>
iQIbBAEBAgAGBQJcjCyYAAoJEFheFHXiqx3kBo8P+KYpzGUmaV4lA8jopR5h39S8<br>
XMt6e+mO4zceiz1LE9mGFozayPPgPlchuJz3h/9EgtvNKXV8AvUGLFOZHtcE5qeM<br>
wDwQg6kreHW/5ejrpYFCH1rZt9DftnAzMQo0SXOCQTfLkAC5W/jRrZyAE8ibVEH+<br>
JoAOG/ZRUTz4E3bnoSGfcrY13IwD5A3sJ3Jex6rLttVjJyfCEbBJMx5ofFXO9WbY<br>
PfggXSD7EALHdUOT1vQWJsRiJClq25HjAucblA+zst/8N1wllpRnK3uhA1M22lNB<br>
OuYv0lnvKwYmyNSs/VcXRAne5CXjpf/CxJpVMuvXdbRYxrlsybWz9+UWMk7DB+TA<br>
fQvCRIGROG/DlVWo8KAoMN6ZgfxE3pmVjfN3p2usDza2V43QAY+jaZF7x2SyxKxo<br>
Bw4/jW7RODduzWu/XQvRX0780RQlbPbNcFjrOHIt3PZe7+Qtl++6QQcVCJ+TrE8h<br>
1drKkbFvm2/ecyAXdMkXV8CxiJdbgcSkz2kgIYhTUpiGJz0ubCt3HOA/byh3P8em<br>
/5EhxuQQo5r+Yvn4rHkOIe2KBJuBHHhNky9f8xRU7j9JnxFvm6tQK8tJ4C3fIklI<br>
yua+T9thS3XifUNiWTw/WX6CjSYVl2/lFtmzXYZ5+LiZgd4IImEHnXik/jOv/2eC<br>
ayHhzl8YuA1yxsjULsw=<br>
=Y3WO<br>
-----END PGP SIGNATURE-----<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>