little formula to solve

BlitzMax Forums/BlitzMax Programming/little formula to solve

Ha, shaken off the hangover, here you are :

Two functions, One will return the value at a given percentage of the slider. The other will return the percentage value of the slider for a given value.
For Local a = 0 To 99
	Print SliderValue(-2.0,4.0,a)
Next


Function SliderValue:Float(Range1:Float,Range2:Float,SliderValue:Float)
	Return (SliderValue * ((Range2 - Range1) / 100)) + Range1
End Function

Function SliderPercentage:Float(Range1:Float,Range2:Float,ActualValue:Float)
	Return  (ActualValue - Range1) / ((Range2 - Range1) / 100)
End Function