How will the MCU deal with the internal negative variables?

Hi,

If I did this calculation inside the MCU:
float x=-5;
float y=5;
float z=x+y; //z=-10
analogWrite(35,z);

How will the MCU send this big negative number to the output pin, what kind of processing I should apply on it.

Thank you

Scale the value.

Clamp the value.

Ignore the problem.

Some combination of the three.

float x=-5;
float y=5;
float z=x+y; //z=-10

Back to grade school / primary school for you.

faisally:
float x=-5;
float y=5;
float z=x+y; //z=-10
analogWrite(35,z);

In the above, z = 0 so you'd get a zero duty cycle PWM, that is, nominally 0 volts out.

Your comment suggests that you intended z to be -10 which the compiler would convert to an int and probably write the lower 8 bits of the twos complement which, if I've done correctly, is 251 decimal, so you'd get about 98% duty cycle or about 4.8 volts out.

Of course the real take away should be to write code that explicitly produces whatever it is that you desire instead of doing something silly like providing out of range parameters to a function.