June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
14
Task/Price-fraction/Gambas/price-fraction.gambas
Normal file
14
Task/Price-fraction/Gambas/price-fraction.gambas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Public Sub Main()
|
||||
Dim byValue As Byte[] = [10, 18, 26, 32, 38, 44, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 100]
|
||||
Dim byLimit As Byte[] = [6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
|
||||
Dim byCount, byCheck As Byte
|
||||
|
||||
For byCount = 0 To 100
|
||||
For byCheck = 0 To byLimit.Max
|
||||
If byCount < byLimit[byCheck] Then Break
|
||||
Next
|
||||
Print Format(byCount / 100, "0.00") & " = " & Format(byValue[byCheck] / 100, "0.00") & gb.Tab;
|
||||
If byCount Mod 5 = 0 Then Print
|
||||
Next
|
||||
|
||||
End
|
||||
18
Task/Price-fraction/VBA/price-fraction.vba
Normal file
18
Task/Price-fraction/VBA/price-fraction.vba
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Option Explicit
|
||||
|
||||
Sub Main()
|
||||
Dim test, i As Long
|
||||
test = Array(0.34, 0.070145, 0.06, 0.05, 0.50214, 0.56, 1#, 0.99, 0#, 0.7388727)
|
||||
For i = 0 To UBound(test)
|
||||
Debug.Print test(i) & " := " & Price_Fraction(CSng(test(i)))
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
Private Function Price_Fraction(n As Single) As Single
|
||||
Dim Vin, Vout, i As Long
|
||||
Vin = Array(0.06, 0.11, 0.16, 0.21, 0.26, 0.31, 0.36, 0.41, 0.46, 0.51, 0.56, 0.61, 0.66, 0.71, 0.76, 0.81, 0.86, 0.91, 0.96, 1.01)
|
||||
Vout = Array(0.1, 0.18, 0.26, 0.32, 0.38, 0.44, 0.5, 0.54, 0.58, 0.62, 0.66, 0.7, 0.74, 0.78, 0.82, 0.86, 0.9, 0.94, 0.98, 1#)
|
||||
For i = 0 To UBound(Vin)
|
||||
If n < Vin(i) Then Price_Fraction = Vout(i): Exit For
|
||||
Next i
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue