question

Mischa Spelt avatar image
0 Likes"
Mischa Spelt asked Mischa Spelt commented

Double treated as int

Here's a question: what do you expect that

double a = 2443816867;
return a;

returns?

  1. The literal constant on the first line
  2. MAX_INT

Hint: the answer is different when you write

double a = 2443816867.0;
FlexSim 18.0.3
flexscriptdata typecast
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Mischa Spelt commented

In C++, that returns 2443816867.0 as it should. In FlexScript, it is returning 2147483647.0 (MAX_INT).

I'll add a note to the dev list to look into fixing this.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image Mischa Spelt commented ·

Thanks.

0 Likes 0 ·