ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# After Effects warning: invalid numeric result (divide by zero?) Expression disabled.

FAQ   •   VIEW ALL
 After Effects warning: invalid numeric result (divide by zero?) Expression disabled. on Apr 5, 2011 at 8:09:20 pm

I have been having a problem with an expression that is getting extremely frustrating. It is an expression that I have used on countless other projects with no problem, but for some reason, on this one specific project, it keeps giving me this error:

After Effects warning: invalid numeric result (divide by zero?)
Expression disabled.

The expression is being used on the scale property of about 50 or so layers. The expression that I am using is as follows:

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}

if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
amp = .05;
freq = 2.0;
decay = 10.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

I have tried changing the values of amp, freq, and decay to no avail. If anyone can offer any help or insight into this problem it would be greatly appreciated.

 Re: After Effects warning: invalid numeric result (divide by zero?) Expression disabled.on Apr 5, 2011 at 10:59:12 pm

I know very little to nothing about coding, but the only time I have gotten this error is when I literally just divide by zero (rocket science, I know). With that in mind I would bet that your error is in here:

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t)

because that is the only place that you divide, except earlier when you divide by 10...

instead of dividing by Math.exp(decay*1) try just sticking a random number in there and see what happens:

value + v*amp*Math.sin(freq*t*2*Math.PI)/5

- Spencer

 Re: After Effects warning: invalid numeric result (divide by zero?) Expression disabled.on Feb 21, 2013 at 2:25:07 am

this is so awful.. so i have to go back to CS5 to do some bouncy expressions.. :( if i put some random number in there, it wont stop.. does anyone have a solution?

 Re: After Effects warning: invalid numeric result (divide by zero?) Expression disabled.on Apr 22, 2013 at 1:38:23 am

Sorry, you've exceeded my high-school math abilities... Good luck! You might want to check out the release notes of CS6, because it is really weird that it works fine in 5.5. I think I remember some expression things may have changed since then though...

- Spencer

 Re: After Effects warning: invalid numeric result (divide by zero?) Expression disabled.on Jul 5, 2013 at 12:22:47 am

cheers,

I had the same problem before.
Try converting the expression to keyframes. It worked for me.

 Re: After Effects warning: invalid numeric result (divide by zero?) Expression disabled.on Aug 13, 2013 at 11:21:00 pm

i saw this in another thread:

via Dan Ebberts -

change

if (n>0){

to

if (n > 0 && t < 1){

and your bounce will work, even in CC.