Manipulating a list of numbers based on values

Hi,

I have a single column of numbers from in tabulated text format ranging from 0 to 1. I want to manipulate the list of numbers so that if the number is greater than 0.5 (> 0.5), I get 1 - number. If the number is less than 0.5, the number is taken as it is and not altered. For example:

Sample input

0.1
0.25
0.35
0.80
0.65

Output

0.1
0.25
0.35
0.20
0.35

How do I go about doing this? Thanks!

awk '$1 = $1 > 0.5 ? 1 - $1 : $1 x' infile