Skip to main content
Participant
June 15, 2024
Answered

[BUG] With the expression "time <= outPoint-0.04"

  • June 15, 2024
  • 2 replies
  • 357 views

I'm quite experienced with AE. I've encountered a strange bug on a AE expression. I had to use a hack to solve it. I'm almost sure that such a hack wasn't necessary in the past.

 

=> Can someone try to reproduce the bug?

 

Faulty AE version = 24.4.1 (Build 2).

 

You'll find the AE project here:

project1---bug-and-hack.aep

https://drive.google.com/file/d/1i57JibETwyXtdY-zNZ-ZXJqTZRxkIz-h/view?usp=sharing

 

--- --- ---

The project contains two basic "1920x1080x25fps compositions". One with the bug (called 1---Bug), and one with the hack (2---Hack).

 

BUGGY EXPRESSION

 

FRM = 0.04;
if (time < outPoint-FRM) { RESULT = 22; }
else { RESULT = 88; }

 

 

HACK EXPRESSION

 

FRM = 0.04 + 0.0001; // This +0.0001 is the solving hack.
if (time < outPoint-FRM) { RESULT = 22; }
else { RESULT = 88; }

 

 

ANALYSE OF THE PROBLEM

It seems that an operation such "time-(outPoint-0.04)" return a number with lots of decimals (something like -0.040000000000000924).

 

More precisely:

"time-(outPoint-0.04)" = Negative number.

"time-(outPoint-0.040001)" = Positive number.

 

This probably explains the bug. The negative number disturbs the calculation. If it's the case, it's quite a big bug because it may potentially break all expressions using time & outPoint.

 

=> Is it such a decimal problem already known/managed?

 

It's not the first time I had to use this kind of hack, but it's the first time on an expression that basic.

 

Thank you a lot for your help.

This topic has been closed for replies.
Correct answer Dan Ebberts

I think I would take all the roundoff-error-prone math out of it and let AE calcualte frame numbers with something like this:

timeToFrames(time) >= (timeToFrames(outPoint) - 1) ? 88 : 22

2 replies

Asyx RedsAuthor
Participant
June 16, 2024

Thank you a lot.

 

Your proposition indeed solve the problem. I didn't know such function existed. I still think the bug is strange, and should be considered by Adobe. But your solution seems the right way to work with "time and outPoint".

 

Here is the code that solves the problem (without hack).

 

Again, thank you a lot for the attention given to my post.
All the best.

 

// Function "timeToFrames" convert "the time expressed in second" into "the index of the frame".
FRM = 0.04;
if (timeToFrames(time) < timeToFrames(outPoint)-1) { RESULT = 22; }
else { RESULT = 88; }

 

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
June 16, 2024

I think I would take all the roundoff-error-prone math out of it and let AE calcualte frame numbers with something like this:

timeToFrames(time) >= (timeToFrames(outPoint) - 1) ? 88 : 22