
(FPCore (x y) :precision binary64 :pre TRUE (* x (exp (* y y))))
double code(double x, double y) {
return x * exp((y * y));
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * exp((y * y))
end function
public static double code(double x, double y) {
return x * Math.exp((y * y));
}
def code(x, y): return x * math.exp((y * y))
function code(x, y) return Float64(x * exp(Float64(y * y))) end
function tmp = code(x, y) tmp = x * exp((y * y)); end
code[x_, y_] := N[(x * N[Exp[N[(y * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * (exp((y * y))) END code
x \cdot e^{y \cdot y}
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 :pre TRUE (* x (exp (* y y))))
double code(double x, double y) {
return x * exp((y * y));
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * exp((y * y))
end function
public static double code(double x, double y) {
return x * Math.exp((y * y));
}
def code(x, y): return x * math.exp((y * y))
function code(x, y) return Float64(x * exp(Float64(y * y))) end
function tmp = code(x, y) tmp = x * exp((y * y)); end
code[x_, y_] := N[(x * N[Exp[N[(y * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * (exp((y * y))) END code
x \cdot e^{y \cdot y}
(FPCore (x y) :precision binary64 :pre TRUE (* x (pow (sqrt (exp (fabs y))) (+ (fabs y) (fabs y)))))
double code(double x, double y) {
return x * pow(sqrt(exp(fabs(y))), (fabs(y) + fabs(y)));
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (sqrt(exp(abs(y))) ** (abs(y) + abs(y)))
end function
public static double code(double x, double y) {
return x * Math.pow(Math.sqrt(Math.exp(Math.abs(y))), (Math.abs(y) + Math.abs(y)));
}
def code(x, y): return x * math.pow(math.sqrt(math.exp(math.fabs(y))), (math.fabs(y) + math.fabs(y)))
function code(x, y) return Float64(x * (sqrt(exp(abs(y))) ^ Float64(abs(y) + abs(y)))) end
function tmp = code(x, y) tmp = x * (sqrt(exp(abs(y))) ^ (abs(y) + abs(y))); end
code[x_, y_] := N[(x * N[Power[N[Sqrt[N[Exp[N[Abs[y], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * ((sqrt((exp((abs(y)))))) ^ ((abs(y)) + (abs(y)))) END code
x \cdot {\left(\sqrt{e^{\left|y\right|}}\right)}^{\left(\left|y\right| + \left|y\right|\right)}
Initial program 100.0%
Applied rewrites100.0%
Applied rewrites100.0%
(FPCore (x y) :precision binary64 :pre TRUE (* x (pow (exp y) y)))
double code(double x, double y) {
return x * pow(exp(y), y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (exp(y) ** y)
end function
public static double code(double x, double y) {
return x * Math.pow(Math.exp(y), y);
}
def code(x, y): return x * math.pow(math.exp(y), y)
function code(x, y) return Float64(x * (exp(y) ^ y)) end
function tmp = code(x, y) tmp = x * (exp(y) ^ y); end
code[x_, y_] := N[(x * N[Power[N[Exp[y], $MachinePrecision], y], $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * ((exp(y)) ^ y) END code
x \cdot {\left(e^{y}\right)}^{y}
Initial program 100.0%
Applied rewrites100.0%
(FPCore (x y) :precision binary64 :pre TRUE (fma (sqrt (* (* y y) (* y y))) x x))
double code(double x, double y) {
return fma(sqrt(((y * y) * (y * y))), x, x);
}
function code(x, y) return fma(sqrt(Float64(Float64(y * y) * Float64(y * y))), x, x) end
code[x_, y_] := N[(N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x + x), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = ((sqrt(((y * y) * (y * y)))) * x) + x END code
\mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, x, x\right)
Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites81.8%
Applied rewrites81.8%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
lift-sqrt.f6489.5%
Applied rewrites89.5%
(FPCore (x y) :precision binary64 :pre TRUE (fma (* y y) x x))
double code(double x, double y) {
return fma((y * y), x, x);
}
function code(x, y) return fma(Float64(y * y), x, x) end
code[x_, y_] := N[(N[(y * y), $MachinePrecision] * x + x), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = ((y * y) * x) + x END code
\mathsf{fma}\left(y \cdot y, x, x\right)
Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites81.8%
Applied rewrites81.8%
(FPCore (x y) :precision binary64 :pre TRUE (* x 1.0))
double code(double x, double y) {
return x * 1.0;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * 1.0d0
end function
public static double code(double x, double y) {
return x * 1.0;
}
def code(x, y): return x * 1.0
function code(x, y) return Float64(x * 1.0) end
function tmp = code(x, y) tmp = x * 1.0; end
code[x_, y_] := N[(x * 1.0), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * (1) END code
x \cdot 1
Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites51.3%
herbie shell --seed 2026092
(FPCore (x y)
:name "Data.Number.Erf:$dmerfcx from erf-2.0.0.0"
:precision binary64
(* x (exp (* y y))))