Skip to content

readFloat64xx doesn't work properly #2

@w35l3y

Description

@w35l3y

Both functions readFloat64BE and readFloat64LE are buggy at the following line:

(((b5 & 0x7F) << 24) | (b6 << 16) | (b7 << 8) | b8).toString(2)

If you do, for example:
var b5 = 0, b6 = 0, b7 = 0, b8 = 0;

The expected value should be "0000000000000000000000000000000" (31 zeros), but instead it returns "0"

I solved it by using:

("000000000000000000000000000000" + (((b5 & 0x7F) << 24) | (b6 << 16) | (b7 << 8) | b8).toString(2)).substr(-31)

But this solution isn't cross-browser.

Tested on Firefox 12.0

Thank you for your great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions