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

Convert variable type f into variable type p decimals 2

Former Member
0 Likes
2,413

Hi,

How can i convert a type f variable into a type p decimals 2 variable?

I'm trying to make this division:

var type f.

var1 type p decimals 2

var = 50 / 100.

the result is:

var = 5.0000000000000000E-01

if i do

move var to var1.

the result is:

var1 = 0.01 ???

can anyone tell me what i'm doing wrong?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,110

Hi,

I checked your sample below. var1 gave me 0.50 answer. which is also same as var1 = 50 / 100 (result 0.50). what result you are looking for based on your sample?

cheers,

4 REPLIES 4
Read only

Former Member
0 Likes
1,110

ry

Read only

Former Member
0 Likes
1,110

DATA: var type f,
      var1 type p decimals 2.

var = 50 / 100.

WRITE:/ var.

move var to var1.

WRITE:/ var1.

Result is: 0.50

I don't see what's your problem...

Greetings,

Blag.

Read only

Former Member
0 Likes
1,110

There is nothing wrong in the coding ..

I get 0.5 in var1

data : var type f,

var1 type p decimals 2 .

var = 50 / 100.

write 😕 var .

move var to var1.

write 😕 var1 .

Read only

Former Member
0 Likes
1,111

Hi,

I checked your sample below. var1 gave me 0.50 answer. which is also same as var1 = 50 / 100 (result 0.50). what result you are looking for based on your sample?

cheers,