
(FPCore (x y) :precision binary64 :pre TRUE (* (* x 27.0) y))
double code(double x, double y) {
return (x * 27.0) * y;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * 27.0d0) * y
end function
public static double code(double x, double y) {
return (x * 27.0) * y;
}
def code(x, y): return (x * 27.0) * y
function code(x, y) return Float64(Float64(x * 27.0) * y) end
function tmp = code(x, y) tmp = (x * 27.0) * y; end
code[x_, y_] := N[(N[(x * 27.0), $MachinePrecision] * y), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (x * (27)) * y END code
\left(x \cdot 27\right) \cdot y
Herbie found 2 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 :pre TRUE (* (* x 27.0) y))
double code(double x, double y) {
return (x * 27.0) * y;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * 27.0d0) * y
end function
public static double code(double x, double y) {
return (x * 27.0) * y;
}
def code(x, y): return (x * 27.0) * y
function code(x, y) return Float64(Float64(x * 27.0) * y) end
function tmp = code(x, y) tmp = (x * 27.0) * y; end
code[x_, y_] := N[(N[(x * 27.0), $MachinePrecision] * y), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = (x * (27)) * y END code
\left(x \cdot 27\right) \cdot y
(FPCore (x y) :precision binary64 :pre TRUE (* (* (fmin x y) 27.0) (fmax x y)))
double code(double x, double y) {
return (fmin(x, y) * 27.0) * fmax(x, y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (fmin(x, y) * 27.0d0) * fmax(x, y)
end function
public static double code(double x, double y) {
return (fmin(x, y) * 27.0) * fmax(x, y);
}
def code(x, y): return (fmin(x, y) * 27.0) * fmax(x, y)
function code(x, y) return Float64(Float64(fmin(x, y) * 27.0) * fmax(x, y)) end
function tmp = code(x, y) tmp = (min(x, y) * 27.0) * max(x, y); end
code[x_, y_] := N[(N[(N[Min[x, y], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = LET tmp = IF (x < y) THEN x ELSE y ENDIF IN LET tmp_1 = IF (x > y) THEN x ELSE y ENDIF IN (tmp * (27)) * tmp_1 END code
\left(\mathsf{min}\left(x, y\right) \cdot 27\right) \cdot \mathsf{max}\left(x, y\right)
Initial program 99.6%
(FPCore (x y) :precision binary64 :pre TRUE (* 27.0 (* x y)))
double code(double x, double y) {
return 27.0 * (x * y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 27.0d0 * (x * y)
end function
public static double code(double x, double y) {
return 27.0 * (x * y);
}
def code(x, y): return 27.0 * (x * y)
function code(x, y) return Float64(27.0 * Float64(x * y)) end
function tmp = code(x, y) tmp = 27.0 * (x * y); end
code[x_, y_] := N[(27.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 = (27) * (x * y) END code
27 \cdot \left(x \cdot y\right)
Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.6%
herbie shell --seed 2026092
(FPCore (x y)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, F"
:precision binary64
(* (* x 27.0) y))