Skip to content

Number encoding #9

Description

@837951602

There should only be XXXeYYY and (AAA)(.BBB) -- since point costs 72 chars far larger than '9' 47, it's never cheap to use both.
With x being a positive finite number, turning x to XXXeYYY style uses x.toExponential().replace(/^(\d)\.?(\d*)e(.*)$/,function(x,a,b,c){return a+b+'e'+(c-b.length)}) and to (AAA)(.BBB) use Number.prototype.forceFixed=function(){var t=this.toString().split('e');if(t.length==1)return t.replace(/^0/,'');t[0]=t[0].replace(/\./,'');return t[1]>0?t[0]+Array(2- -t[1]-t[0].length).join(0):'.'+Array(-t[1]).join('0')+t[0]}? (code not tested fully)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions