# MathHelper.LerpPrecise Method (Microsoft.Xna.Framework)

Linearly interpolates between two values. This method is a less efficient, more precise version of Lerp(float, float, float). See remarks for more info.

Namespace: Microsoft.Xna.Framework
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.616)
• C#
• VB
• F#
```public static float LerpPrecise(
float value1,
float value2,
float amount
)```

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

#### Parameters

value1
Type: System.Single
Source value.
value2
Type: System.Single
Destination value.
amount
Type: System.Single
Value between 0 and 1 indicating the weight of value2.

#### Return Value

Type: System.Single
Interpolated value.
This method performs the linear interpolation based on the following formula: `((1 - amount) * value1) + (value2 * amount)`. Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned. This method does not have the floating point precision issue that Lerp(float, float, float) has. i.e. If there is a big gap between value1 and value2 in magnitude (e.g. value1=10000000000000000, value2=1), right at the edge of the interpolation range (amount=1), Lerp(float, float, float) will return 0 (whereas it should return 1). This also holds for value1=10^17, value2=10; value1=10^18,value2=10^2... so on. For an in depth explanation of the issue, see below references: Relevant Wikipedia Article: https://en.wikipedia.org/wiki/Linear_interpolation#Programming_language_support Relevant StackOverflow Answer: http://stackoverflow.com/questions/4353525/floating-point-linear-interpolation#answer-23716956
Supported in:

Windows DirectX Desktop

Linux Desktop

Windows OpenGL Desktop

Web