Price fraction: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 633: | Line 633: | ||
| otherwise = snd $ head $ dropWhile ((<= n) . fst) table</lang> |
| otherwise = snd $ head $ dropWhile ((<= n) . fst) table</lang> |
||
=={{header|HicEst}}== |
|||
<lang HicEst>DIMENSION upperbound(20), rescaleTo(20), temp(20) |
|||
upperbound = (.06,.11,.16,.21,.26,.31,.36,.41,.46,.51,.56,.61,.66,.71,.76,.81,.86,.91,.96,1.01) |
|||
rescaleTo = (.10,.18,.26,.32,.38,.44,.50,.54,.58,.62,.66,.70,.74,.78,.82,.86,.90,.94,.98,1.00) |
|||
DO test = 1, 10 |
|||
value = RAN(0.5, 0.5) |
|||
temp = value > upperbound |
|||
PriceFraction = rescaleTo( INDEX(temp, 0) ) |
|||
WRITE(Format="F8.6, F6.2") value, PriceFraction |
|||
ENDDO</lang> |
|||
<pre>0.589230 0.70 |
|||
0.017623 0.10 |
|||
0.314343 0.50 |
|||
0.553303 0.66 |
|||
0.676283 0.78 |
|||
0.016883 0.10 |
|||
0.265656 0.44 |
|||
0.460880 0.62 |
|||
0.837450 0.90 |
|||
0.228953 0.38</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |
||
'''Solution:''' |
'''Solution:''' |