Price fraction: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 3,237: | Line 3,237: | ||
<syntaxhighlight lang="langur"> |
<syntaxhighlight lang="langur"> |
||
val |
val table = [ |
||
{"low": 0.00, "high": 0.06, "use": 0.10}, |
|||
{"low": 0.06, "high": 0.11, "use": 0.18}, |
|||
{"low": 0.11, "high": 0.16, "use": 0.26}, |
|||
{"low": 0.16, "high": 0.21, "use": 0.32}, |
|||
{"low": 0.21, "high": 0.26, "use": 0.38}, |
|||
{"low": 0.26, "high": 0.31, "use": 0.44}, |
|||
{"low": 0.31, "high": 0.36, "use": 0.50}, |
|||
{"low": 0.36, "high": 0.41, "use": 0.54}, |
|||
{"low": 0.41, "high": 0.46, "use": 0.58}, |
|||
{"low": 0.46, "high": 0.51, "use": 0.62}, |
|||
{"low": 0.51, "high": 0.56, "use": 0.66}, |
|||
{"low": 0.56, "high": 0.61, "use": 0.70}, |
|||
{"low": 0.61, "high": 0.66, "use": 0.74}, |
|||
{"low": 0.66, "high": 0.71, "use": 0.78}, |
|||
{"low": 0.71, "high": 0.76, "use": 0.82}, |
|||
{"low": 0.76, "high": 0.81, "use": 0.86}, |
|||
{"low": 0.81, "high": 0.86, "use": 0.90}, |
|||
{"low": 0.86, "high": 0.91, "use": 0.94}, |
|||
{"low": 0.91, "high": 0.96, "use": 0.98}, |
|||
{"low": 0.96, "high": 1.00, "use": 1.00}, |
|||
] |
|||
⚫ | |||
val pricefrac = fn f: { |
|||
if f == 1.00: return 1.00 |
|||
for h in table { |
|||
if f >= h'low and f < h'high: return h'use |
|||
} |
|||
⚫ | |||
} |
} |
||