
(FPCore (x y) :precision binary64 :pre TRUE (* 2.0 (- (* x x) (* x y))))
double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 2.0d0 * ((x * x) - (x * y))
end function
public static double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
def code(x, y): return 2.0 * ((x * x) - (x * y))
function code(x, y) return Float64(2.0 * Float64(Float64(x * x) - Float64(x * y))) end
function tmp = code(x, y) tmp = 2.0 * ((x * x) - (x * y)); end
code[x_, y_] := N[(2.0 * N[(N[(x * x), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (2) * ((x * x) - (x * y)) END code
2 \cdot \left(x \cdot x - x \cdot y\right)
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 :pre TRUE (* 2.0 (- (* x x) (* x y))))
double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 2.0d0 * ((x * x) - (x * y))
end function
public static double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
def code(x, y): return 2.0 * ((x * x) - (x * y))
function code(x, y) return Float64(2.0 * Float64(Float64(x * x) - Float64(x * y))) end
function tmp = code(x, y) tmp = 2.0 * ((x * x) - (x * y)); end
code[x_, y_] := N[(2.0 * N[(N[(x * x), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (2) * ((x * x) - (x * y)) END code
2 \cdot \left(x \cdot x - x \cdot y\right)
(FPCore (x y) :precision binary64 :pre TRUE (* (+ x x) (- x y)))
double code(double x, double y) {
return (x + x) * (x - y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + x) * (x - y)
end function
public static double code(double x, double y) {
return (x + x) * (x - y);
}
def code(x, y): return (x + x) * (x - y)
function code(x, y) return Float64(Float64(x + x) * Float64(x - y)) end
function tmp = code(x, y) tmp = (x + x) * (x - y); end
code[x_, y_] := N[(N[(x + x), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (x + x) * (x - y) END code
\left(x + x\right) \cdot \left(x - y\right)
Initial program 95.0%
Applied rewrites100.0%
(FPCore (x y) :precision binary64 :pre TRUE (* (* -2.0 x) y))
double code(double x, double y) {
return (-2.0 * x) * y;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((-2.0d0) * x) * y
end function
public static double code(double x, double y) {
return (-2.0 * x) * y;
}
def code(x, y): return (-2.0 * x) * y
function code(x, y) return Float64(Float64(-2.0 * x) * y) end
function tmp = code(x, y) tmp = (-2.0 * x) * y; end
code[x_, y_] := N[(N[(-2.0 * x), $MachinePrecision] * y), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = ((-2) * x) * y END code
\left(-2 \cdot x\right) \cdot y
Initial program 95.0%
Taylor expanded in x around 0
Applied rewrites56.9%
Applied rewrites57.0%
(FPCore (x y) :precision binary64 :pre TRUE (* -2.0 (* x y)))
double code(double x, double y) {
return -2.0 * (x * y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (-2.0d0) * (x * y)
end function
public static double code(double x, double y) {
return -2.0 * (x * y);
}
def code(x, y): return -2.0 * (x * y)
function code(x, y) return Float64(-2.0 * Float64(x * y)) end
function tmp = code(x, y) tmp = -2.0 * (x * y); end
code[x_, y_] := N[(-2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (-2) * (x * y) END code
-2 \cdot \left(x \cdot y\right)
Initial program 95.0%
Taylor expanded in x around 0
Applied rewrites56.9%
herbie shell --seed 2026092
(FPCore (x y)
:name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, A"
:precision binary64
(* 2.0 (- (* x x) (* x y))))