Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FN.DEF Converti$(tempo)
- IF tempo > 3600
- ore = INT(tempo / 3600)
- temporest = tempo - (ore * 3600)
- min = INT(temporest / 60)
- sec = tempo - ((ore * 3600) + (min * 60))
- IF round(sec) = 60
- min = min + 1
- sec = 0
- endif
- IF round(min) = 60
- ore = ore + 1
- min = 0
- endif
- result$ = format$("##########",ore) + "h" +format$("##",min) + "m" + format$("##",sec) +"s"
- result$ = replace$(result$," ","")
- FN.rtn result$
- endif
- IF tempo < 3600
- min = INT(tempo / 60)
- sec = tempo - (min * 60)
- IF round(sec) = 60
- min = min + 1
- sec = 0
- endif
- IF round(min) = 60
- ore = ore + 1
- min = 0
- endif
- IF min = 0
- sec = round(sec)
- result$ = format$("##", sec) + "s"
- result$ = replace$(result$," ","")
- ELSE
- sec = round(sec)
- min = round(min)
- result$ = format$("##",min) + "m" +format$("##", sec) + "s"
- result$ = replace$(result$," ","")
- endif
- FN.rtn result$
- endif
- FN.END
- FN.DEF FIX(tempo, min, max, ev1, av2)
- evmin = (pow(av2,2)) / min
- evmin = log2(evmin)
- evmax = (pow(av2,2)) / max
- evmax = log2(evmax)
- result1 = ABS(ev1 - evmin)
- result2 = ABS(ev1 - evmax)
- IF result2 > result1
- FN.rtn min
- endif
- IF result1 > result2
- FN.rtn max
- endif
- IF result1 = result2
- FN.rtn min
- endif
- FN.END
- FN.DEF Abx(tempo)
- LIST.create N, tempi
- LIST.add tempi,8000,6400,5000,4000,3200,2500,2000,1600,1250,1000,800,640,500,400,320,250,200,160,125,100,80,60,50,40,30,25,20,15,13,10,8,6,5,4
- IF tempo <= 3.33
- LIST.CLEAR tempi
- FN.rtn tempo
- endif
- IF tempo >= 8300
- LIST.CLEAR tempi
- FN.rtn tempo
- endif
- IF (tempo > 3.33) & (tempo < 4)
- result1 = 4 - tempo
- result2 = tempo - 3.33
- IF result1 < result2
- LIST.CLEAR tempi
- FN.rtn 4
- ELSEIF result1 > result2
- LIST.CLEAR tempi
- FN.rtn 3
- ELSEIF result1 = result2
- LIST.CLEAR tempi
- FN.rtn 3
- endif
- endif
- IF (tempo < 8300) & (tempo > 8000)
- LIST.CLEAR tempi
- FN.rtn 8000
- endif
- LIST.SIZE tempi, ln
- ln = ln - 1
- FOR i = 1 TO ln
- min = i
- j = i + 1
- WHILE j < ln
- LIST.GET tempi, j, rslt1
- LIST.GET tempi, min, rslt2
- IF rslt1 > rslt2
- min = j
- endif
- j = j + 1
- repeat
- LIST.GET tempi, min, t
- LIST.GET tempi, i, backup
- LIST.REPLACE tempi, min, backup
- LIST.REPLACE tempi, i, t
- NEXT
- tempo = tempo
- LIST.size tempi, ln
- intervalli = ln - 1
- trovato = 0
- k=1
- WHILE trovato = 0
- LIST.GET tempi, k, max
- LIST.GET tempi, k+1, min
- IF (tempo >= min) & (tempo <= max) & (trovato = 0)
- LIST.GET tempi, k, max
- LIST.GET tempi, k+1, min
- trovato = 1
- endif
- k= k +1
- repeat
- result1 = (1/max) - (1/tempo)
- result2 = (1/tempo) - (1/min)
- result1 = ABS(result1)
- result2 = ABS(result2)
- IF result1 > result2
- LIST.CLEAR tempi
- FN.rtn min
- ELSEIF result2 > result1
- LIST.CLEAR tempi
- FN.rtn max
- ELSEIF result2 = result1
- LIST.CLEAR tempi
- FN.rtn min
- endif
- FN.END
- FN.DEF Abx2(tempo, ev1, av2)
- IF tempo >= 0.3 & tempo < 0.4
- FN.rtn FIX(tempo, 0.3, 0.4, ev1, av2)
- endif
- IF tempo >= 0.4 & tempo < 0.5
- FN.rtn FIX(tempo, 0.4, 0.5, ev1, av2)
- endif
- IF tempo >= 0.5 & tempo < 0.6
- FN.rtn FIX(tempo, 0.5, 0.6, ev1, av2)
- endif
- IF tempo >= 0.6 & tempo < 0.8
- FN.rtn FIX(tempo, 0.6, 0.8, ev1, av2)
- endif
- IF tempo >= 0.8 & tempo < 1
- FN.rtn FIX(tempo, 0.8, 1, ev1, av2)
- endif
- IF tempo >= 1 & tempo < 1.3
- FN.rtn FIX(tempo, 1, 1.3, ev1, av2)
- endif
- IF tempo >= 1.3 & tempo < 1.6
- FN.rtn FIX(tempo, 1.3, 1.6, ev1, av2)
- endif
- IF tempo >= 1.6 & tempo < 2
- FN.rtn FIX(tempo, 1.6, 2, ev1, av2)
- endif
- IF tempo >= 2 & tempo < 2.5
- FN.rtn FIX(tempo, 2, 2.5, ev1, av2)
- endif
- IF tempo >= 2.5 & tempo < 3.2
- FN.rtn FIX(tempo, 2.5, 3.2, ev1, av2)
- endif
- IF tempo >= 3.2 & tempo < 4
- FN.rtn FIX(tempo, 3.2, 4, ev1, av2)
- endif
- IF tempo >= 4
- FN.rtn round(tempo)
- endif
- FN.END
- FN.DEF log2 (valore)
- result = LOG(valore) / LOG(2)
- FN.rtn result
- FN.END
- FN.DEF calculate(ev1, av2)
- pt = pow(av2,2)
- ev2 = log2(pt)
- rst = ev1- ev2
- IF rst < 0
- rst = ABS(rst)
- endif
- result = pow(2,rst)
- FN.rtn result
- FN.END
- FN.DEF check(strnumber$)
- c = 0
- FOR i = 1 TO LEN(strnumber$)
- car$ = MID$(strnumber$, i, 1)
- IF car$ = "0"
- c = c + 1
- endif
- IF car$ = "1"
- c = c + 1
- endif
- IF car$ = "2"
- c = c + 1
- endif
- IF car$ = "3"
- c = c + 1
- endif
- IF car$ = "4"
- c = c + 1
- endif
- IF car$ = "5"
- c = c + 1
- endif
- IF car$ = "6"
- c = c + 1
- endif
- IF car$ = "7"
- c = c + 1
- endif
- IF car$ = "8"
- c = c + 1
- endif
- IF car$ = "9"
- c = c + 1
- endif
- IF car$ = "."
- c = c + 1
- endif
- NEXT
- IF c = LEN(strnumber$)
- FN.rtn 1
- endif
- IF c <> LEN(strnumber$)
- FN.rtn 0
- endif
- FN.END
- start:
- array.load diaframmi[],1,1.2,1.4,1.7,1.8,2,2.4,2.8,3.3,3.4,4,4.8,5.6,6.7,8,9.5,11,13.0,16,19,22
- inizio:
- CLS
- switch = 0
- INPUT "Diaframma a tutta apertura: ", av1
- ripeti:
- INPUT "Tempo a tutta apertura: ", temp1$
- IF LEN(temp1$) < 1
- GOTO ripeti
- endif
- temp1$=replace$(temp1$,"//", "/")
- IF RIGHT$(temp1$, 1) = "/"
- temp1$ = LEFT$(temp1$, LEN(temp1$) - 1)
- endif
- IF RIGHT$(temp1$, 1) = "."
- temp1$ = LEFT$(temp1$, LEN(temp1$) - 1)
- endif
- IF LEFT$(temp1$, 1) = "/"
- temp1$ = RIGHT$(temp1$, LEN(temp1$) - 1)
- endif
- FOR i = 1 TO LEN(temp1$)
- IF MID$(temp1$, i, 1) = "/"
- switch = 1
- strnum$ = MID$(temp1$, 1, i-1)
- strden$ = MID$(temp1$, i + 1, LEN(temp1$) - i)
- IF RIGHT$(strnum$, 1) = "."
- strnum$ = LEFT$(strnum$, LEN(strnum$) - 1)
- endif
- IF RIGHT$(strden$, 1) = "."
- strden$ = LEFT$(strden$, LEN(strden$) - 1)
- endif
- IF check(strnum$) = 0
- GOTO ripeti
- endif
- IF check(strden$) = 0
- GOTO ripeti
- endif
- num = VAL(strnum$)
- den = VAL(strden$)
- numint = INT(num)
- denint = INT(den)
- tempo1 = numint / denint
- Endif
- NEXT
- PRINT "EV CALCULATOR PRO 2017"
- PRINT "Diaframma a TA: " + STR$(av1)
- PRINT "Tempo a TA: " + temp1$
- IF switch = 1
- ev1 = (pow(av1,2)) / tempo1
- ev1 = log2(ev1)
- ev1ai = round(ev1,2)
- array.length lngth, diaframmi[]
- PRINT "EV Rif: " + STR$(ev1)
- PRINT "-----------Output-----------"
- i = 1
- WHILE i <= lngth
- av2 = diaframmi[i]
- IF av2 <> av1
- tempo2 = calculate(ev1,av2)
- ev2a = (Pow(av2,2)) / tempo2
- ev2a = Log2(ev2a)
- ev2ai = round(ev2a,2)
- ev2b = (Pow(av2,2)) / (1/tempo2)
- ev2b = Log2(ev2b)
- ev2bi = round(ev2b,2)
- IF round(ev2a,2) = round(ev1,2)
- IF tempo2 < 60
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- ELSE
- PRINT converti$(tempo2) + " @" + STR$(av2)
- endif
- ELSE
- IF tempo2 < 2
- tempo2 = 1 / tempo2
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- ELSE
- tempo2 = Abx(tempo2)
- IF round(tempo2) = 3
- tempo2 = 1/tempo2
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- ELSE
- st$ = format$("########", round(tempo2))
- st$ = replace$(st$, " ","")
- PRINT "1/" + st$ + " sec @" +STR$(av2)
- endif
- ENDIF
- endif
- endif
- i = i + 1
- repeat
- GOTO mia
- ELSEIF switch = 0
- IF check(temp1$) = 0 THEN
- GOTO ripeti
- endif
- tempo1 = VAL(temp1$)
- ev1 = (av1 ^ 2) / tempo1
- ev1 = log2(ev1)
- ev1ai = round(ev1,2)
- array.length lngth, diaframmi[]
- PRINT "EV Rif: " + STR$(ev1)
- PRINT "-----------Output-----------"
- i = 1
- WHILE i <= lngth
- av2 = diaframmi[i]
- IF av2 <> av1
- tempo2 = calculate(ev1, av2)
- ev2a = (av2 ^ 2) / tempo2
- ev2a = log2(ev2a)
- ev2ai = round(ev2a,2)
- ev2b = (av2 ^ 2) / (1/tempo2)
- ev2b = log2(ev2b)
- ev2bi = round(ev2b,2)
- ev2ai = round(ev2a,2)
- IF ev2ai = ev1ai
- IF tempo2 < 60
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" +STR$(av2)
- ELSE
- PRINT Converti$(tempo2) + " @" +STR$(av2)
- endif
- ELSE
- IF (ev2bi = ev1ai) & (ev2bi = ev1ai)
- IF tempo2 < 2
- tempo2 = 1/tempo2
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" +STR$(av2)
- ELSE
- tempo2 = Abx(tempo2)
- IF round(tempo2) = 3
- tempo2 = 1/tempo2
- tempo2 = Abx2(tempo2, ev1, av2)
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- ELSE
- st$ = format$("########", round(tempo2))
- st$ = replace$(st$, " ","")
- PRINT "1/" + st$ + " sec @" +STR$(av2)
- endif
- endif
- endif
- endif
- endif
- endif
- i = i +1
- repeat
- GOTO mia
- mia:
- pause 20000
- INPUT "Exit? y/n", k$
- IF k$ = "y"
- END
- endif
- IF k$ = "Y"
- END
- endif
- GOTO inizio
Add Comment
Please, Sign In to add comment