Price fraction: Difference between revisions

Content added Content deleted
(Added F# version)
(→‎version 2: optimized)
Line 2,231: Line 2,231:
* Inspired by some other solutions tested with version 1 (above)
* Inspired by some other solutions tested with version 1 (above)
* 20.04.2013 Walter Pachl
* 20.04.2013 Walter Pachl
* 03.11.2013 -"- move r. computation (once is enough)
**********************************************************************/
**********************************************************************/
rl='0.10 0.18 0.26 0.32 0.38 0.44 0.50 0.54 0.58 0.62',
'0.66 0.70 0.74 0.78 0.82 0.86 0.90 0.94 0.98 1.00'
Do i=1 To 20
Parse Var rl r.i rl
End
Do x=0 To 1 By 0.01
Do x=0 To 1 By 0.01
old=adjprice(x)
old=adjprice(x)
Line 2,241: Line 2,247:
Exit
Exit


adjprice2: Procedure
adjprice2: Procedure Expose r.
i=((100*arg(1)-1)%5+1)
rl='0.10 0.18 0.26 0.32 0.38 0.44 0.50 0.54 0.58 0.62',
'0.66 0.70 0.74 0.78 0.82 0.86 0.90 0.94 0.98 1.00'
Do i=1 To 20
Parse Var rl r.i rl
End
Parse Arg p
i=((100*p-1)%5+1)
Return r.i</lang>
Return r.i</lang>