Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
22
Task/Price-fraction/Chipmunk-Basic/price-fraction.basic
Normal file
22
Task/Price-fraction/Chipmunk-Basic/price-fraction.basic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
100 cls
|
||||
110 data 10,18,26,32,38,44,50,54,58,62,66,70,74,78,82,86,90,94,98,100
|
||||
120 data 6,11,16,21,26,31,36,41,46,51,56,61,66,71,76,81,86,91,96
|
||||
130 dim od(21)
|
||||
140 for i = 1 to 20
|
||||
150 read olddec
|
||||
160 od(i) = olddec
|
||||
170 next i
|
||||
180 dim nd(20)
|
||||
190 for j = 1 to 19
|
||||
200 read nuedec
|
||||
210 nd(j) = nuedec
|
||||
220 next j
|
||||
230 for i = 1 to 100
|
||||
240 for j = 1 to ubound(nd)-1
|
||||
250 if i < nd(j) then exit for
|
||||
260 next j
|
||||
270 print using "#.##";(i/100);" -> ";
|
||||
280 print using "#.##";(od(j)/100);chr$(9);
|
||||
290 if i mod 5 = 0 then print
|
||||
300 next i
|
||||
310 end
|
||||
33
Task/Price-fraction/Langur/price-fraction-1.langur
Normal file
33
Task/Price-fraction/Langur/price-fraction-1.langur
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
}
|
||||
throw "no match"
|
||||
}
|
||||
|
||||
writeln pricefrac(0.17)
|
||||
writeln pricefrac(0.71)
|
||||
35
Task/Price-fraction/Langur/price-fraction-2.langur
Normal file
35
Task/Price-fraction/Langur/price-fraction-2.langur
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
val table = [
|
||||
# [low, use]
|
||||
[0.00, 0.10],
|
||||
[0.06, 0.18],
|
||||
[0.11, 0.26],
|
||||
[0.16, 0.32],
|
||||
[0.21, 0.38],
|
||||
[0.26, 0.44],
|
||||
[0.31, 0.50],
|
||||
[0.36, 0.54],
|
||||
[0.41, 0.58],
|
||||
[0.46, 0.62],
|
||||
[0.51, 0.66],
|
||||
[0.56, 0.70],
|
||||
[0.61, 0.74],
|
||||
[0.66, 0.78],
|
||||
[0.71, 0.82],
|
||||
[0.76, 0.86],
|
||||
[0.81, 0.90],
|
||||
[0.86, 0.94],
|
||||
[0.91, 0.98],
|
||||
[0.96, 1.00],
|
||||
]
|
||||
|
||||
val pricefrac = fn f: {
|
||||
if f >= table[-1][1] and f <= table[-1][2]: return table[-1][2]
|
||||
|
||||
for t of len(table)-1 {
|
||||
if f >= table[t][1] and f < table[t+1][1]: return table[t][2]
|
||||
}
|
||||
throw "no match"
|
||||
}
|
||||
|
||||
writeln pricefrac(0.17)
|
||||
writeln pricefrac(0.71)
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
val .pricefrac = fn(.f) switch[and] .f {
|
||||
case >= 0.00, < 0.06: 0.10
|
||||
case >= 0.06, < 0.11: 0.18
|
||||
case >= 0.11, < 0.16: 0.26
|
||||
case >= 0.16, < 0.21: 0.32
|
||||
case >= 0.21, < 0.26: 0.38
|
||||
case >= 0.26, < 0.31: 0.44
|
||||
case >= 0.31, < 0.36: 0.50
|
||||
case >= 0.36, < 0.41: 0.54
|
||||
case >= 0.41, < 0.46: 0.58
|
||||
case >= 0.46, < 0.51: 0.62
|
||||
case >= 0.51, < 0.56: 0.66
|
||||
case >= 0.56, < 0.61: 0.70
|
||||
case >= 0.61, < 0.66: 0.74
|
||||
case >= 0.66, < 0.71: 0.78
|
||||
case >= 0.71, < 0.76: 0.82
|
||||
case >= 0.76, < 0.81: 0.86
|
||||
case >= 0.81, < 0.86: 0.90
|
||||
case >= 0.86, < 0.91: 0.94
|
||||
case >= 0.91, < 0.96: 0.98
|
||||
case >= 0.96, <= 1.00: 1.00
|
||||
default: throw "bad data"
|
||||
}
|
||||
|
||||
writeln .pricefrac(0.17)
|
||||
writeln .pricefrac(0.71)
|
||||
19
Task/Price-fraction/QB64/price-fraction.qb64
Normal file
19
Task/Price-fraction/QB64/price-fraction.qb64
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Data 10,18,26,32,38,44,50,54,58,62,66,70,74,78,82,86,90,94,98,100
|
||||
Data 6,11,16,21,26,31,36,41,46,51,56,61,66,71,76,81,86,91,96
|
||||
Dim od(21)
|
||||
For i = 1 To 20
|
||||
Read olddec
|
||||
od(i) = olddec
|
||||
Next i
|
||||
Dim nd(20)
|
||||
For j = 1 To 19
|
||||
Read nuedec
|
||||
nd(j) = nuedec
|
||||
Next j
|
||||
For i = 1 To 100
|
||||
For j = 1 To UBound(nd) - 1
|
||||
If i < nd(j) Then Exit For
|
||||
Next j
|
||||
Print Using "#.## -> #.##"; (i / 100); (od(j) / 100);
|
||||
If i Mod 5 = 0 Then Print Else Print Chr$(9);
|
||||
Next i
|
||||
Loading…
Add table
Add a link
Reference in a new issue