Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Correctsignum function according to the Haskell report.#60

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
leftaroundabout wants to merge1 commit intoarrayfire:master
base:master
Choose a base branch
Loading
fromleftaroundabout:bug/incorrect-signum-convention

Conversation

leftaroundabout
Copy link
Contributor

In Haskell,signum x is defined to be -1 if x is negative, 1 if it is positive, and 0 if x is 0.

(In particular,signum x * abs x ≡ x should hold.)

This is different fromArrayFire'ssign function (which yields 1 for a negative number and 0 else), but it can be implemented in terms of that function:

  • For negativex, we haveA.sign (-x) - A.sign x = 0 - 1 = -1
  • Forx=0, we haveA.sign (-x) - A.sign x = 1 - 1 = 0
  • For positivex, we haveA.sign (-x) - A.sign x = 1 - 0 = 1

In Haskell, `signum x` is defined to be -1 if x is negative, 1 if it is positive,and 0 if x is 0.This is different from ArrayFire's `sign` function, but it can be implementedin terms of this function.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@leftaroundabout

[8]ページ先頭

©2009-2025 Movatter.jp