racket / racket/racket

floating-point-bytes->real and real->floating-point-bytes are not inverses for all inputs

Open
#4,487 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

What version of Racket are you using?
v8.5.0.2 [cs]

What program did you run?

(define input (bytes #x7f #x80 #x01 #x01))
(equal? input (real->floating-point-bytes (floating-point-bytes->real input #t 0 4) 4 #t))

What should have happened?
It should have answered #t, but it answered #f, because real->floating-point-bytes yielded (bytes #x7f #xc0 #x01 #x01).

Please include any other relevant details
x86_64 Debian linux.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Racket program on v8.5.0.2 [cs] and compare floating-point-bytes->real with real->floating-point-bytes for the four-byte input on x86_64 Debian Linux. Trace these two functions to determine why the second byte changes from #x80 to #xc0, and consider the issue done when the round trip returns #t for this case and relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.