Price fraction: Difference between revisions
Content added Content deleted
Line 347: | Line 347: | ||
=={{header|Erlang}}== |
=={{header|Erlang}}== |
||
<lang erlang>priceFraction(N) when N < 0 orelse N > |
<lang erlang>priceFraction(N) when N < 0 orelse N > 1 -> |
||
erlang:error('Values must be between 0 and 1.'); |
erlang:error('Values must be between 0 and 1.'); |
||
priceFraction(N) when N < 0.06 |
priceFraction(N) when N < 0.06 -> 0.10; |
||
priceFraction(N) when N < 0.11 -> 0.18; |
priceFraction(N) when N < 0.11 -> 0.18; |
||
priceFraction(N) when N < 0.16 -> 0.26; |
priceFraction(N) when N < 0.16 -> 0.26; |
||
Line 358: | Line 358: | ||
priceFraction(N) when N < 0.41 -> 0.54; |
priceFraction(N) when N < 0.41 -> 0.54; |
||
priceFraction(N) when N < 0.46 -> 0.58; |
priceFraction(N) when N < 0.46 -> 0.58; |
||
priceFraction(N) when N < 0.51 |
priceFraction(N) when N < 0.51 -> 0.62; |
||
priceFraction(N) when N < 0.56 -> 0.66; |
priceFraction(N) when N < 0.56 -> 0.66; |
||
priceFraction(N) when N < 0.61 -> 0.70; |
priceFraction(N) when N < 0.61 -> 0.70; |