Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Primitive] Floor: Redo the model for floor #37

Open
sloorush opened this issue Dec 14, 2023 · 2 comments
Open

[Primitive] Floor: Redo the model for floor #37

sloorush opened this issue Dec 14, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed Size: M Medium sized task

Comments

@sloorush
Copy link
Member

sloorush commented Dec 14, 2023

Redo the model function for floor to handle inputs like 1E200.

The current model of floor calculates it by using a very non-intrusive (with the actual primitive being tested) approach by using strings to calculate the result. But it fails to evaluate inputs like 1E200 and fails.

@sloorush sloorush added help wanted Extra attention is needed Size: M Medium sized task labels Dec 14, 2023
@sloorush sloorush changed the title Redo the model for floor [Primitive] Floor: Redo the model for floor Dec 14, 2023
@sloorush sloorush added the bug Something isn't working label Dec 14, 2023
@sloorush
Copy link
Member Author

Turns out ⍕ is a beast of a primitive.

Next steps two approaches:

  • The Interfacing approach: try out using .NET interfacing and what impact that has on code coverage and other segments of tests
  • The "machine code" approach: implementing floor using binary numbers

@sloorush
Copy link
Member Author

Logging this here for the future, since the PR has been closed

Proposed model in the closed PR was:

     model of floor using exponents
     has issues with hdbl and hfl values
    modelFloorNew{
        fmt{⎕FR1287:¯33  ¯16}
        (m e)'E'()fmt
        ene
        diff-(<0)('.')
        en<0:diff+0
        m3+(<0)+en
        diff+m,'E',e
    }

It does the same thing as the current model but it uses the scientific form the number and removes the decimal places. But it is still not precise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed Size: M Medium sized task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant