Price fraction: Difference between revisions

Content added Content deleted
(add Scala)
Line 1,115: Line 1,115:


def testPriceFraction()=
def testPriceFraction()=
for(n <- 0.00 until (1.00, 0.01)) println("%.2f %.2f".format(n, priceFraction(n)))</lang>
for(n <- 0.00 to (1.00, 0.01)) println("%.2f %.2f".format(n, priceFraction(n)))</lang>
Output
<pre>
0,00 0,10
0,01 0,10
0,02 0,10
0,03 0,10
0,04 0,10
0,05 0,10
0,06 0,18
...
0,25 0,38
0,26 0,44
0,27 0,44
0,28 0,44
0,29 0,44
0,30 0,44
0,31 0,50
0,32 0,50
0,33 0,50
0,34 0,50
0,35 0,50
0,36 0,54
0,37 0,54
...
0,88 0,94
0,89 0,94
0,90 0,94
0,91 0,98
0,92 0,98
0,93 0,98
0,94 0,98
0,95 0,98
0,96 1,00
0,97 1,00
0,98 1,00
0,99 1,00
1,00 1,00
</pre>


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==