15 lines
322 B
Text
15 lines
322 B
Text
Function MapRange(s As Integer, a1 As Integer, a2 As Integer, b1 As Integer, b2 As Integer) As Float
|
|
|
|
Return b1 + (s - a1) * (b2 - b1) / (a2 - a1)
|
|
|
|
End Function
|
|
|
|
Public Sub Main()
|
|
|
|
Dim i As Integer
|
|
|
|
For i = 0 To 10
|
|
Print Format$(i, "##"); " maps to "; Format$(MapRange(i, 0, 10, -1, 0), "+##.0")
|
|
Next
|
|
|
|
End Sub
|