Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix negative zero issue on balance #2715

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

ahmedmolawale
Copy link
Contributor

Pull Request (PR) Checklist

Please check if your pull request fulfills the following requirements:

  • The PR is submitted to the main branch.
  • I've read the Contribution Guidelines.
  • I've read the Architecture Guidelines.
  • My code builds and is tested on a real Android device.
  • I confirm that I've run the code locally and everything works as expected.

What's changed?

Obtaining the integer part of balance via toInt() method drops the negative sign when the balance x is such that -1.0 < x < 0.0. For example, (-0.21).toInt() will produce 0.
This PR will append a negative sign to the integer part of the balance in this case.

Before Fix

before_compressed.mp4

After Fix

after.mov

Does this PR closes any GitHub Issues?

Copy link
Collaborator

@ILIYANGERMANOV ILIYANGERMANOV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work and a great catch on this nasty bug! Very well documented and explained PR 💯 👏

@ILIYANGERMANOV ILIYANGERMANOV merged commit 7df0ad8 into Ivy-Apps:main Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Neg + smaller pos = neg
2 participants