[erlang-bugs] Pattern matching of floats does not work in the shell

Paul Guyot <>
Fri Sep 2 18:17:54 CEST 2011


Hello,

We've just noticed that simple pattern matching of 64 bits floats do not work in the shell or in the eval parameter of erl(1)

For example, the following line will crash:
erl -eval '<<X:64/float>> = <<1.4:64/float>>,init:stop().' -noshell

Or with the following session:
-----
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> B = <<64,46,0,0,0,0,0,0>>.
<<64,46,0,0,0,0,0,0>>
2> <<F:64/float>> = B.
** exception error: no match of right hand side value <<64,46,0,0,0,0,0,0>>
-----

While pattern matching with integers works:
erl -eval '<<X:64>> = <<1:64>>,init:stop().' -noshell

The pattern matching code works properly when compiled (BEAM and HiPE).

Paul
-- 
Semiocast            http://semiocast.com/
+33.183627948 - 20 rue Lacaze, 75014 Paris



More information about the erlang-bugs mailing list