You are viewing a single comment's thread from:

RE: What are you building right now?

in #steemdev-megathreads7 years ago

I've just spent the last few hours trying to make the arithmetic in javascript work on the required numbers to determine the potential value of each new vote. It took me a while to realise that one of the numbers is too big for javascript to handle. I'm not sure what to do now, as I couldn't seem to get around it with a couple of libraries I looked at. But it must be easily doable as there are a number of sites on the blockchain that calculate it. Maybe I'll sleep on it and then come up with a manual algorithm to work it out.

Sort:  

Hrm, that's strange, I haven't encountered that before. Which numbers are you working with? rshares?

The estimates on chainBB are slightly off, but I didn't run into any issues with the numbers there. parseInt seemed to handle those large numbers alright.

It's the recent_claims variable that's a couple of digits too big. Perhaps I'm using a less than optimal equation to work out voting value. Although, having quick look at your link, you seem to be using recent_claims as well, without problems I'm assuming.

I ended up creating an algorithm to get a pretty good estimate of the value, but I've just noticed it's putting out wildly too big vote values for people with large sp. I might need to revisit it, or try and work out how you use recent_claims without getting a NaN error. Are you using a big number library?

edit: I've just noticed that when I run the app on my pc I get less wild results than when I run in as an Android app on my phone. Bloody strange..

edit2: I've just checked my calculation, and it gives allegedly accurate results for high steem power too. So there must be something wrong with algorithm I found to calculate vote value. Does this sound right?:
proportion = vests/recent_claims
100% upvote at 100% power = proportion * reward_balance

That's giving me different results than @penguinpablo's vote calculator.

edit infinity: Got it working. Woot!