Buongiorno.
Scusate ho queste due stringhe:
A = 1.00
B = 5.00
Provo a sommarle A + B ma ottengo: 1.005.00 invece di 6.00... che sbaglio?
Buongiorno.
Scusate ho queste due stringhe:
A = 1.00
B = 5.00
Provo a sommarle A + B ma ottengo: 1.005.00 invece di 6.00... che sbaglio?
codice ?Originariamente inviato da ubbicom
Buongiorno.
Scusate ho queste due stringhe:
A = 1.00
B = 5.00
Provo a sommarle A + B ma ottengo: 1.005.00 invece di 6.00... che sbaglio?
Originariamente inviato da EmTmE
codice ?codice:A = 1.00 B = 5.00 strTot = A + B response.write strTot
Prova così:
codice:<% A = 1.20 B = 5.00 strTot =cint(A + B) response.write (FormatNumber(strTot,2)) %>![]()
Grazie, ma:
Tipo di errore:
Errore di run-time di Microsoft VBScript (0x800A0006)
Overflow: 'CInt'
Ciao prova ad usare il comando Cdbl
codice:<% A = 1.20 B = 5.00 strTot = Cdbl(A + B) response.write (FormatNumber(strTot,2)) %>![]()
Con cDbl = 100500
Ma forse il problema è altrove...
codice:Function mn2om(minuti) If minuti<0 Then segno="-" Else segno="" mn = abs(minuti) mn2om = segno&CStr(Int(mn/60))&"."&Right("0"&CStr(mn Mod 60),2) if minuti=0 then mn2om = " " ' " " End Function A = 1.00 B = 5.00 strTot = (mn2om(A) + mn2om(B)
cint(a)+cint(b), daje
Si grazie Optime, ho risolto così:
codice:strmnONLG = mn2om(mnONLG) if Trim(strmnONLG & "[]") = "[]" then strmnONLG = "0.00" else strmnONLG = strmnONLG end if strmnONLG2 = mn2om(mnONLG2) if Trim(strmnONLG2 & "[]") = "[]" then strmnONLG2 = "0.00" else strmnONLG2 = strmnONLG2 end if strTot = cdBl(strmnONLG) + cDbl(strmnONLG2)
inZomma, tutta robba mia![]()