Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

multiply by negative

Former Member
0 Kudos

hiiii

value = ( v_rate / v_qty ) * -1

it dont work when i do *-1 any idea what to use

15 REPLIES 15

Former Member
0 Kudos

Do like this

value = ( v_rate / v_qty ) * ( -1)

it will work

cheers

Former Member
0 Kudos

HI ,

vaule = (v_rate / v_qty ) * (-1)

amit_khare
Active Contributor
0 Kudos

declare a variable with type p,it can store a negative value and use it.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

value = ( v_rate / v_qty ) * ( -1 ).

observe the space before and after -1

former_member386202
Active Contributor
0 Kudos

Hi,

Do like this.

value = ( v_rate / v_qty ) * ( -1 )

Regards,

Prashant

former_member188829
Active Contributor
0 Kudos

Hi,

Do Try this..

DATA:X type i value '2'.

DATA:y type i Value '10'.

DATA:Value type i.

Value = ( Y / X ) * ( -1 ).

Write:/ Value.

0 Kudos

i though the problem is in the negative but when i break the formula

value = 20.10 / 100.000

return me 0

0 Kudos

hi,

take value type p decimals n

0 Kudos

do you think that because 100.000 is 3 decimal place that why it won't work

0 Kudos

check the "fixed point arithmetic" option for your program attributes...

and also check the data type of value

0 Kudos

hi, i tried like

DATA:value TYPE p decimals 3.

DATA:x TYPE i VALUE '20.10'.

DATA:y TYPE i VALUE '100.00'.

value = x / y .

WRITE:/ value.

and its giving me 0.200

and

DATA:value TYPE p decimals 3.

DATA:x TYPE i VALUE '20.10'.

DATA:y TYPE i VALUE '100.00'.

value = ( x / y ) * -1 .

WRITE:/ value.

giving me 0.200-

0 Kudos

one i 2 decimal place the other 3 decimal place

0 Kudos

thx . the problem was not to multiply by a negative

but the fix point . my program is an include . i went to the attributes but i can't find the check box help plzzz

grateful to u

former_member188829
Active Contributor
0 Kudos

Hi,

See Below Code..

DATA:X type P Decimals 2 value '12.12'.

DATA:y type P Decimals 2 Value '100.12'.

DATA:Value type p DECIMALS 3.

Value = ( Y / X ) * ( -1 ).

Write:/ VALUE.

Former Member
0 Kudos

solve