Giter VIP home page Giter VIP logo

Comments (4)

TWiStErRob avatar TWiStErRob commented on July 26, 2024

Tried .toUnsignedString(2), toHexString() as well, it's less 0s.

.toUlong().toString() gives a good decimal representation, but I need binary; UTypes don't have toString(radix) methods.

.toUlong().toBigInt().toString(2) gives the right value, but pretty tedious.

.toUBigInt().toString(2) is based on toUnsignedString(10), luckily that's not using toUnsignedString0, so it works.

The bug is in the konversion of formatUnsignedLong from the JDK: when you introduced _this, you forgot to replace the implicit this.toInt() and mask inside digits[], it should be _this.toInt() and mask.

from kotlin-unsigned.

elect86 avatar elect86 commented on July 26, 2024

Hi Róbert,

thanks for opening the issue and suggesting the fix, I quickly applied it and it worked.

I'll review all the other call and problems you mentioned with calm.

Btw, push request are welcome for the next time if you want to do it directly.

Shall I publish a release for this fix?

from kotlin-unsigned.

TWiStErRob avatar TWiStErRob commented on July 26, 2024

The other issues are not really issues, I was just looking to work around this bug.
I guess the only thing you need to look at is "UTypes don't have toString(radix) methods."

No need to push any quick, I decided to just go with fun Int.toBinaryHashString() = java.lang.Integer.toBinaryString(this) instead of pulling your whole lib in, I'm on desktop and targeting latest Java so have the API I need.

from kotlin-unsigned.

elect86 avatar elect86 commented on July 26, 2024

Added toString(radix) in 1.3 branch

A little late but better than never :p

from kotlin-unsigned.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.