INNER CODE UNIT · TypeScript

y

margelo/react-native-graph · src/GetYForX.ts:17

  const y = Math.pow(Math.abs(x), 1 / 3);
  return x < 0 ? -y : y;
};

const solveCubic = (a: number, b: number, c: number, d: number): number[] => {
  'worklet';

  if (Math.abs(a) < 1e-8) {
    // Quadratic case, ax^2+bx+c=0
    a = b;
    b = c;
    c = d;
    if (Math.abs(a) < 1e-8) {
      // Linear case, ax+b=0
      a = b;
      b = c;
      if (Math.abs(a) < 1e-8) {
        // Degenerate case

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…