Error on atan() call

Having an issue, is this a bug? or am I doing something wrong?

function setup() {
  createCanvas(400, 400);
  background(128);
}

function draw() {
  let a = cos(0.5);
  text(a.toString(), 200,200);
  a = atan(0.5);
  text(a.toString(), 200,250);
}

I get an error on the atan call:

:cherry_blossom: p5.js says: It looks like you’ve called atan outside of a shader’s modify() function.

Thanks

Hello @Xero ,

I saw the same error with the 2.x versions.

This is a 1.x version:

:)

1 Like

As a work arround you can call the JS Math function e.g.
a = Math.atan(0.5);

1 Like