Skip to main content
1 of 7
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

#JavaScript (ES6), 99 bytes

Takes input as a string. Returns a float.

s=>+(s[0]>1?0+s:s).replace(/(.)(\.?)([0189])(.*)/,(_,a,b,c,d)=>[+a+c>>3]+(b||0)+d.replace(/\d/g,0)) 

Try it online!

Arnauld
  • 205.5k
  • 21
  • 187
  • 670