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

Paul Guyot pguyot@REDACTED
Sat Sep 3 08:31:47 CEST 2011


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