Jump to content

Map range: Difference between revisions

(→‎{{header|Euphoria}}: Euphoria example added)
Line 629:
print( string.format( "f(%d) = %f", i, map_range( 0, 10, -1, 0, i ) ) )
end</lang>
 
 
=={{header|Mathematica}}==
Such a function is already built in
<lang Mathematica>
Rescale[#,{0,10},{-1,0}]&/@Range[0,10]
</lang>
 
Output:
{-1., -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.}
 
=={{header|Nemerle}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.