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

Robert Virding robert.virding@REDACTED
Sat Sep 3 00:32:20 CEST 2011


Are you sure that <<64,46,0,0,0,0,0,0>> is a legal float. If not then trying to "extract" a float from it is bound to fail. Otherwise I have no problems pattern matching 64 bit floats in the shell:

2> B = <<1.4:64/float>>.
<<"?öffffff">>
3> <<F:64/float>> = B.
<<"?öffffff">>
4> F.
1.4

I am running R14B03.

Robert

----- Original Message -----
> 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
> 
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
> 



More information about the erlang-bugs mailing list