Dudas con Operadores

Dudas con Operadores

Postby ricardog » Sat Nov 24, 2007 6:32 am

Alguien me puede hechar una mano con lo siguiente :

En VB :
Dim resultValue As Integer
resultValue = 11 \ 4
resultValue = 9 \ 3
resultValue = 100 \ 3
resultValue = 67 \ -3

!! OJO CON EL OPERADOR " \ "
Divide dos números y devuelve un resultado de número entero.
en el ejemplo anterior devuelven valores de 2, 3, 33 y -22

Cual seria su equivalente en XHarbour ?.

Por su atencion Gracias.

Ricardo E. Guardado Flores.
ricardog
 
Posts: 158
Joined: Tue Oct 11, 2005 3:10 pm

Postby Antonio Linares » Sat Nov 24, 2007 7:51 am

resultValue = Int( 11 \ 4 )
resultValue = Int( 9 \ 3 )
resultValue = Int( 100 \ 3 )
resultValue = Int( 67 \ -3 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41949
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Armando » Sat Nov 24, 2007 5:14 pm

Maestro:

No debería ser así ?

resultValue = Int( 11 / 4 )
resultValue = Int( 9 / 3 )
resultValue = Int( 100 / 3 )
resultValue = Int( 67 / -3 )

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3184
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Antonio Linares » Sat Nov 24, 2007 5:17 pm

Si, asi es. Me limite a copiar y pegar las lineas de Ricardo :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41949
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Armando » Sat Nov 24, 2007 8:37 pm

:D
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3184
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby ricardog » Sat Nov 24, 2007 9:13 pm

Asi es, Estaba aplicando la funcion INT(x/i......)
Pero el resultado no era el mismo que VB asi que por eso mi pregunta.


Entonces:

VB

xNumber = (((37 + _
((512 - 448) \ 8)) \ _
(512 \ 8) + 1) * _
(512 \ 32))

EL valor de xNumber es 16 (Segun el Debugger de VB )

XHB

xNumber := Int( ((( 37 + ;
( Int( ( 512 - 448) / 8)) ) / ;
( Int( 512 / 8)) ) + 1) * ;
( Int( 512 / 32)) )

EL valor de xNumber es 27

Estoy aplicando mal la funcion INT(.....) ????????????????????????'

Ricardo E. Guardado Flores
ricardog
 
Posts: 158
Joined: Tue Oct 11, 2005 3:10 pm

Postby ADBLANCO » Fri Nov 30, 2007 3:31 pm

De hecho, el resultado de ambas formulas es 27, estoy tratando de ver como debe ser para que te de 16
:shock:
User avatar
ADBLANCO
 
Posts: 299
Joined: Mon Oct 22, 2007 3:03 pm
Location: Valencia - Venezuela

Postby ADBLANCO » Fri Nov 30, 2007 3:45 pm

(int((37 +((512 - 448) / 8)) /(512 / 8) + 1) *(512 / 32))




esto si da 16, revisa, que es lo que quieres hacer


Felicidad!!!
User avatar
ADBLANCO
 
Posts: 299
Joined: Mon Oct 22, 2007 3:03 pm
Location: Valencia - Venezuela


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: albeiroval, cmsoft and 48 guests