Short to var - type conversion

Posted By: Zheka

Short to var - type conversion - 06/15/19 13:59

Why would :
Code
short t;

var s = pow( (var)t, 2.5);
generate a Syntax error: Wrong type CONV:SHORT::DOUBLE

?
Posted By: Grat

Re: Short to var - type conversion - 06/15/19 15:57

maybe not directly from the short

try this:
Code
var s = pow( (t*1.0), 2.5);
var s = pow( (var)(int)t, 2.5);
Posted By: Zheka

Re: Short to var - type conversion - 06/15/19 16:25

Thank you, but the question is not how to make it work.

pow(int,var) works as is, without any typecasting.

But why would pow( (var)short, var) not work?
Posted By: AndrewAMD

Re: Short to var - type conversion - 06/15/19 17:29

Because Lite C is not C. grin
Posted By: Zheka

Re: Short to var - type conversion - 06/16/19 13:34

Yeah,seems to be so as var z=(var) t would not work either.
Posted By: Grat

Re: Short to var - type conversion - 06/17/19 05:38

In the Lite C is no work typecasting from SHORT to VAR directly
© 2024 lite-C Forums