Application Development and Automation 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: 
Read only

multiply by negative

Former Member
0 Likes
3,291

hiiii

value = ( v_rate / v_qty ) * -1

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

15 REPLIES 15
Read only

Former Member
0 Likes
1,944

Do like this

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

it will work

cheers

Read only

Former Member
0 Likes
1,944

HI ,

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

Read only

amit_khare
Active Contributor
0 Likes
1,944

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

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
1,944

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

observe the space before and after -1

Read only

former_member386202
Active Contributor
0 Likes
1,944

Hi,

Do like this.

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

Regards,

Prashant

Read only

former_member188829
Active Contributor
0 Likes
1,944

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.

Read only

0 Likes
1,944

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

value = 20.10 / 100.000

return me 0

Read only

0 Likes
1,944

hi,

take value type p decimals n

Read only

0 Likes
1,944

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

Read only

0 Likes
1,944

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

and also check the data type of value

Read only

0 Likes
1,944

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-

Read only

0 Likes
1,944

one i 2 decimal place the other 3 decimal place

Read only

0 Likes
1,944

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

Read only

former_member188829
Active Contributor
0 Likes
1,944

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.

Read only

Former Member
0 Likes
1,944

solve