cancel
Showing results for 
Search instead for 
Did you mean: 

Why does BODS casting to int of value '.000' returns 1 and not 0?

former_member714425
Discoverer
0 Kudos

$i = cast('.0000', 'integer');

print('Int implicit conversion : ' || $i);
Returns 1

while

$i = cast('0.0000', 'integer');

print('Int implicit conversion : ' || $i);


Returns 0

Is there a reason or explanation as to why BODS assumes that no leading integer = 1?

Accepted Solutions (0)

Answers (3)

Answers (3)

aasavaribhave
Advisor
Advisor
0 Kudos

I see the odd behavior:

$i = cast('.0000', 'integer'); returning 1. Will investigate and update

,

$i = cast('.0000', 'integer'); return1 - I just noticed that. Will investigate further and update.

former_member714425
Discoverer
0 Kudos

$i is a global variable declared as int , bods version is 14.2.6

bipulsngh00
Discoverer
0 Kudos

There is no way it would give the above results.. please make sure to define the variables with the proper datatype.