# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
def nf(x):
    return x / (1 + x)

def zf(x):
    return nf(x) if x >= 0 else -nf(-x)

def scalef(x):
    return 0.5 * zf(3 * (x - 0.5)) + 0.5

a = [ -100.0, -10.0, -2.0, -1.0, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0, 10.0, 100.0 ]
for a1 in a:
    print('%.3f %.3f' % (a1, scalef(a1)))
