The year of the midwit
My favourite LLM interaction (I’d asked it to check my work):
ComplexRect.scalarDivide() — completely wrong logic #
ComplexRect scalarDivide(double s) {
double denominator = Math.pow(s, 2); // ❌ Why square it?
if (Math.abs(denominator) < 1e-10) {
return new ComplexRect(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
}
double real = (re * s) / denominator; // ❌ Multiplying by s then dividing?
double imaginary = (im * s) / denominator; // ❌ Same issue
return new ComplexRect(real, imaginary);
}
The issue being that it was the right logic. A scalar is a complex number. For example 17 = 17+0i.
My approach was just an inefficient implementation of the divide method for the case of other.im = 0:
ComplexRect divide(ComplexRect other) {
double denominator = Math.pow(other.re, 2) + Math.pow(other.im, 2);
if (Math.abs(denominator) < 1e-10) {
return new ComplexRect(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
}
double real = (re * other.re + im * other.im) / denominator;
double imaginary = (im * other.re - re * other.im) / denominator;
return new ComplexRect(real, imaginary);
}
The year of the agent #
LLM midwittery aside, I’m jumping on the OpenClaw bandwagon.