Skip to content

Instantly share code, notes, and snippets.

@gergoerdi
Created June 25, 2020 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergoerdi/2f69ff4895c4060ca8c48e6416f3c7ac to your computer and use it in GitHub Desktop.
Save gergoerdi/2f69ff4895c4060ca8c48e6416f3c7ac to your computer and use it in GitHub Desktop.
function r(e) {
var n =
[[1.11e11, 0.6819],
[8.12e10, 0.6518],
[2.93e9, 0.4678],
[4.83e17, 1.4809],
[1.26e24, 2.1947],
[8.11e65, 6.6294]];
var tmp = n[e];
return {
k1: tmp[0],
k2: tmp[1]
};
}
var s = function(usd)
{
var tmp =
usd < 2e3 ? r(5) :
usd < 85e3 ? r(4) :
usd < 6e5 ? r(3) :
usd < 1e6 ? r(2) :
usd < 1e9 ? r(1) :
r(0);
return tmp;
}
var wealth_rank = function(usd) {
var e = s(usd)
n = Math.pow(e.k1 / usd, 1 / e.k2);
return n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment