Map range: Difference between revisions

Content added Content deleted
(→‎{{header|C}}: Maked incorrect. C++ has right output, for example.)
(→‎{{header|Ada}}: fix wrong example used)
Line 9: Line 9:


=={{header|Ada}}==
=={{header|Ada}}==

{{incorrect|Ada|Wrong output.}}
<lang Ada>with Ada.Text_IO;
<lang Ada>with Ada.Text_IO;
procedure Map is
procedure Map is
type First_Range is new Float range 1.0 .. 10.0;
type First_Range is new Float range 0.0 .. 10.0;
type Second_Range is new Float range -1.0 .. 0.0;
type Second_Range is new Float range -1.0 .. 0.0;
function Translate (Value : First_Range) return Second_Range is
function Translate (Value : First_Range) return Second_Range is
Line 45: Line 45:


Output:
Output:
<pre> 1.00000E+00 maps to: -1.00000E+00
<pre> 0.00000E+00 maps to: -1.00000E+00
2.00000E+00 maps to: -8.88889E-01
1.00000E+00 maps to: -9.00000E-01
3.00000E+00 maps to: -7.77778E-01
2.00000E+00 maps to: -8.00000E-01
4.00000E+00 maps to: -6.66667E-01
3.00000E+00 maps to: -7.00000E-01
5.00000E+00 maps to: -5.55556E-01
4.00000E+00 maps to: -6.00000E-01
6.00000E+00 maps to: -4.44444E-01
5.00000E+00 maps to: -5.00000E-01
7.00000E+00 maps to: -3.33333E-01
6.00000E+00 maps to: -4.00000E-01
8.00000E+00 maps to: -2.22222E-01
7.00000E+00 maps to: -3.00000E-01
9.00000E+00 maps to: -1.11111E-01
8.00000E+00 maps to: -2.00000E-01
9.00000E+00 maps to: -1.00000E-01
1.00000E+01 maps to: 0.00000E+00</pre>
1.00000E+01 maps to: 0.00000E+00</pre>