Linear interpolation from a to b, with step t a + (b - a) * t = a * (1-t) + b * t for better floating-point precision
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8), | intent(in) | :: | a | |||
real(kind=8), | intent(in) | :: | b | |||
real(kind=8), | intent(in) | :: | t |
pure elemental function linear_interpolation(a,b,t) result(l) !! Linear interpolation from a to b, with step t !! a + (b - a) * t = a * (1-t) + b * t !! for better floating-point precision real(8),intent(in) :: a,b,t real(8) :: l l = a * (1-t) + b * t end function linear_interpolation