You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

elsardo

Beginner

  • "elsardo" started this thread

Posts: 10

Date of registration: Jun 10th 2011

  • Send private message

1

Wednesday, June 29th 2011, 4:54am

many decimal places - several decimal

this is a program that calculates the French system but many decimal stain result and I just want to go 2

'here comes one decimal
capital = CDbl(Text1)
'This full well because it gives
tiempo = -Text2

'here come several decimal
primervalor = CDbl((1 - (1 + interes) ^ tiempo) / interes)

segundovalor = CDbl(capital / primervalor)

interesapagar = CDbl(capital * interes)

'calculo la primera amortizacion
amortizacion = CDbl(segundovalor - interesapagar)
cuadro.Col = 0
cuadro.Row = 1
cuadro.DataMatrix (1,0) = "1"

'lleno la primera fila y todo sale con varios decimales

cuadro.DataMatrix (1,1) = CDbl(amortizacion)
sumacapital = CDbl (sumacapital + amortizacion)
cuadro.DataMatrix (1,2) = CDbl( interesapagar)
sumainteres = CDbl(sumainteres + interesapagar)
cuadro.DataMatrix (1,3) = CDbl(interesapagar * 21 / 100)
sumaiva = CDbl(sumaiva + (interesapagar * 21 / 100))
cuadro.DataMatrix (1,4) = CDbl(amortizacion + interesapagar * 21 / 100 + interesapagar)
sumacuota = CDbl(amortizacion + (interesapagar * 21 / 100) + interesapagar)

as I have to do to leave such 125.00
saludos

elsardo

Beginner

  • "elsardo" started this thread

Posts: 10

Date of registration: Jun 10th 2011

  • Send private message

2

Wednesday, July 6th 2011, 3:15am

asi funciona gracias a francoAA

usando Round



cuadro.DataMatrix (0,1) = Round(amortizacion,2)
sumacapital = Round(sumacapital + amortizacion,2)
cuadro.DataMatrix (0,2) = Round( interesapagar,2)
sumainteres = CDbl(sumainteres + interesapagar)
cuadro.DataMatrix (0,3) = Round(interesapagar * 21 / 100,2)
sumaiva = CDbl(sumaiva + (interesapagar * 21 / 100))

cuadro.DataMatrix (0,4) = Round(amortizacion + interesapagar * 21 / 100 + interesapagar,2)
sumacuota = CDbl(amortizacion + (interesapagar * 21 / 100) + interesapagar)


el unico problema es que cuando los decimales son .00 solo sale 1 decimal ejemplo, 123.00 sale 123.0 ya he probado algunas cosas pero sigue igual

Rate this thread
WoltLab Burning Board