Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions toFixed bug? More decimals than wanted

  • toFixed bug? More decimals than wanted

    Posted by Axel Rogge on November 26, 2025 at 2:21 pm

    Dear forum,

    This simple expression in an empty text layer does not always delivers as expected:

    posterizeTime(5);

    x = random()+2;

    y = x.toFixed(4);

    z = 24+y*8;

    z;
    Sometimes the result looks like this. Restarting or cleaning database and cache did not help.
    Ae version is 24.6.4. Is this a known bug?

    Best regards

    Axel

    Brie Clayton replied 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 26, 2025 at 3:37 pm

    toFixed() converts your numeric result to a string. Then your next operation has to convert it back to a number. You’d have a more predictable result if you only use toFixed() on the final step, like this maybe:

    posterizeTime(5);
    x = random()+2;
    y = x;
    z = (24+y*8).toFixed(4);
  • Axel Rogge

    November 27, 2025 at 5:34 pm

    Thank you very much, Dan! That solves it.

    Best to you

    Axel

  • Brie Clayton

    November 27, 2025 at 5:59 pm

    Thanks for this handy solve, Dan! And happy Thanksgiving!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy