Line data Source code
1 : module m_map_to_unit 2 : contains 3 1504 : function map_to_unit(x) result(y) 4 : implicit none 5 : real, intent(in) :: x(:) 6 : real :: y(size(x)) 7 : 8 6016 : y = x 9 : 10 : ! everything close to 0 or 1 get's mapped to 0 and 1 11 6016 : where (abs(y - anint(y)) < 1e-6) y = anint(y) 12 : ! map to 0 -> 1 interval 13 6016 : y = y - floor(y) 14 1504 : end function map_to_unit 15 : end module m_map_to_unit