Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM IT WORKS ONLY UNDER RFO BASIC! FOR ANDROID
- 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
- IF switch = 1
- ev1 = (pow(av1,2)) / tempo1
- ev1 = log2(ev1)
- array.length lngth, diaframmi[]
- FOR i = 1 TO lngth
- av2 = diaframmi[i]
- IF av2 <> av1
- tempo2 = calculate(ev1,av2)
- IF tempo2 < 2
- tempo2 = 1 / tempo2
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- ELSE
- PRINT "1/" + STR$(tempo2) + " sec @" + STR$(av2)
- Endif
- endif
- NEXT
- ELSEIF switch = 0
- IF check(temp1$) = 0 THEN
- GOTO ripeti
- endif
- tempo1 = VAL(temp1$)
- ev1 = (av1 ^ 2) / tempo1
- ev1 = log2(ev1)
- array.length lngth, diaframmi[]
- FOR i = 1 TO lngth
- av2 = diaframmi[i]
- IF av2 <> av1
- tempo2 = calculate(ev1, av2)
- PRINT STR$(tempo2) + " sec @" + STR$(av2)
- endif
- NEXT
- endif
- PRINT "by Andrea Verdi ©"
- pause 20000
- INPUT "Exit? y/n", k$
- IF k$ = "y"
- END
- endif
- IF k$ = "Y"
- END
- endif
- GOTO inizio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement