[erlang-questions] Binary comprehensions again.

Bob Cowdery bob@REDACTED
Sun Mar 20 19:15:49 CET 2011


Thank you very much both. It does exactly what I want. Hopefully next
time I will figure it out myself.

Bob

On 20/03/2011 13:24, Philip Robinson wrote:
> Bob, have you tried this?
>
> << <<(round(L * ?M)):16/big-signed, (round(R * ?M)):16/big-signed,
> 0:16, 0:16>> ||
>         <<L:32/float,R:32/float>> <= Bin >>.
>
> I think that this might be what you are after.

On 20/03/2011 16:51, Anthony Ramine wrote:
>
> You can't have expressions which aren't constant in patterns so your code
> obviously does not compile.
>
> You want something along those lines:
>
> << <<(round(L*?M):24/big-signed, (round(R*?M)):24/big-signed, 0:16>> ||
>    <<L:32/float, R:32/float>> <= Bin >>.
>
> Regards,
> --
> Anthony Ramine
> Dev:Extend
> http://dev-extend.eu
>
>
>
>



More information about the erlang-questions mailing list