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

Robert Virding robert.virding@REDACTED
Sat Sep 3 12:40:35 CEST 2011


That is really strange. I am running on MacOSX 10.6.7 Snow Leopard with an erlang compiled straight from the download. And it works for me with 15.0 as well:

Erlang R14B03 (erts-5.8.4) [source] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4  (abort with ^G)
1> B = <<15.0:64/float>>.
<<64,46,0,0,0,0,0,0>>
2> <<F:64/float>> = B.
<<64,46,0,0,0,0,0,0>>
3> F.
15.0
4> 

You sure you are getting all the right standard libraries? Otherwise it could be architecture related. But you mentioned that it worked compiled which would mean that it is NOT architecture related. Weird.

Robert

----- Original Message -----
> Le 3 sept. 2011 à 00:32, Robert Virding a écrit :
> 
> > 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
> 
> <<64,46,0,0,0,0,0,0>> is 15.0.
> 
> 1> <<15.0:64/float>>.
> <<64,46,0,0,0,0,0,0>>
> 
> I cannot reproduce your example.
> 
> 2> B = <<1.4:64/float>>.
> <<"?öffffff">>
> 3> <<F:64/float>> = B.
> ** exception error: no match of right hand side value <<"?öffffff">>
> 
> The same issue occurs with an amd64 R14B03 installation.
> 
> Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8]
> [async-threads:0] [hipe] [kernel-poll:false]
> 
> Eshell V5.8.4  (abort with ^G)
> 1> B = <<1.4:64/float>>.
> <<"?öffffff">>
> 2>  <<F:64/float>> = B.
> ** exception error: no match of right hand side value <<"?öffffff">>
> 
> Could this be architecture related? What is your architecture?
> 
> Paul
> --
> Semiocast            http://semiocast.com/
> +33.183627948 - 20 rue Lacaze, 75014 Paris
> 
> 



More information about the erlang-bugs mailing list