
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
double code(double x, double y) {
return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((1.0d0 - x) * (3.0d0 - x)) / (y * 3.0d0)
end function
public static double code(double x, double y) {
return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
def code(x, y): return ((1.0 - x) * (3.0 - x)) / (y * 3.0)
function code(x, y) return Float64(Float64(Float64(1.0 - x) * Float64(3.0 - x)) / Float64(y * 3.0)) end
function tmp = code(x, y) tmp = ((1.0 - x) * (3.0 - x)) / (y * 3.0); end
code[x_, y_] := N[(N[(N[(1.0 - x), $MachinePrecision] * N[(3.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
double code(double x, double y) {
return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((1.0d0 - x) * (3.0d0 - x)) / (y * 3.0d0)
end function
public static double code(double x, double y) {
return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
def code(x, y): return ((1.0 - x) * (3.0 - x)) / (y * 3.0)
function code(x, y) return Float64(Float64(Float64(1.0 - x) * Float64(3.0 - x)) / Float64(y * 3.0)) end
function tmp = code(x, y) tmp = ((1.0 - x) * (3.0 - x)) / (y * 3.0); end
code[x_, y_] := N[(N[(N[(1.0 - x), $MachinePrecision] * N[(3.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (- 3.0 x) 3.0) (/ (- 1.0 x) y)))
double code(double x, double y) {
return ((3.0 - x) / 3.0) * ((1.0 - x) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((3.0d0 - x) / 3.0d0) * ((1.0d0 - x) / y)
end function
public static double code(double x, double y) {
return ((3.0 - x) / 3.0) * ((1.0 - x) / y);
}
def code(x, y): return ((3.0 - x) / 3.0) * ((1.0 - x) / y)
function code(x, y) return Float64(Float64(Float64(3.0 - x) / 3.0) * Float64(Float64(1.0 - x) / y)) end
function tmp = code(x, y) tmp = ((3.0 - x) / 3.0) * ((1.0 - x) / y); end
code[x_, y_] := N[(N[(N[(3.0 - x), $MachinePrecision] / 3.0), $MachinePrecision] * N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{3 - x}{3} \cdot \frac{1 - x}{y}
\end{array}
Initial program 92.7%
times-fracN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.9%
Applied egg-rr99.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.7)
(/ (/ (+ x -4.0) 3.0) (/ y x))
(if (<= x 1.75)
(/ (+ 1.0 (* x -1.3333333333333333)) y)
(* (/ (/ x y) -3.0) (- 4.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.7) {
tmp = ((x + -4.0) / 3.0) / (y / x);
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = ((x / y) / -3.0) * (4.0 - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.7d0)) then
tmp = ((x + (-4.0d0)) / 3.0d0) / (y / x)
else if (x <= 1.75d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = ((x / y) / (-3.0d0)) * (4.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.7) {
tmp = ((x + -4.0) / 3.0) / (y / x);
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = ((x / y) / -3.0) * (4.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.7: tmp = ((x + -4.0) / 3.0) / (y / x) elif x <= 1.75: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = ((x / y) / -3.0) * (4.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.7) tmp = Float64(Float64(Float64(x + -4.0) / 3.0) / Float64(y / x)); elseif (x <= 1.75) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = Float64(Float64(Float64(x / y) / -3.0) * Float64(4.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.7) tmp = ((x + -4.0) / 3.0) / (y / x); elseif (x <= 1.75) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = ((x / y) / -3.0) * (4.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.7], N[(N[(N[(x + -4.0), $MachinePrecision] / 3.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] / -3.0), $MachinePrecision] * N[(4.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;\frac{\frac{x + -4}{3}}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq 1.75:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{-3} \cdot \left(4 - x\right)\\
\end{array}
\end{array}
if x < -1.69999999999999996Initial program 91.2%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
*-lft-identityN/A
unpow2N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6491.1%
Simplified91.1%
times-fracN/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6499.7%
Applied egg-rr99.7%
if -1.69999999999999996 < x < 1.75Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
if 1.75 < x Initial program 79.7%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
*-lft-identityN/A
unpow2N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6479.7%
Simplified79.7%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6479.7%
Applied egg-rr79.7%
associate-/l/N/A
associate-/r*N/A
frac-2negN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
--lowering--.f64N/A
metadata-eval99.7%
Applied egg-rr99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ (/ x y) -3.0) (- 4.0 x))))
(if (<= x -1.7)
t_0
(if (<= x 1.75) (/ (+ 1.0 (* x -1.3333333333333333)) y) t_0))))
double code(double x, double y) {
double t_0 = ((x / y) / -3.0) * (4.0 - x);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = ((x / y) / (-3.0d0)) * (4.0d0 - x)
if (x <= (-1.7d0)) then
tmp = t_0
else if (x <= 1.75d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x / y) / -3.0) * (4.0 - x);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x / y) / -3.0) * (4.0 - x) tmp = 0 if x <= -1.7: tmp = t_0 elif x <= 1.75: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x / y) / -3.0) * Float64(4.0 - x)) tmp = 0.0 if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x / y) / -3.0) * (4.0 - x); tmp = 0.0; if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x / y), $MachinePrecision] / -3.0), $MachinePrecision] * N[(4.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7], t$95$0, If[LessEqual[x, 1.75], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y}}{-3} \cdot \left(4 - x\right)\\
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.75:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.69999999999999996 or 1.75 < x Initial program 85.0%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
*-lft-identityN/A
unpow2N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6485.0%
Simplified85.0%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6485.0%
Applied egg-rr85.0%
associate-/l/N/A
associate-/r*N/A
frac-2negN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
--lowering--.f64N/A
metadata-eval99.7%
Applied egg-rr99.7%
if -1.69999999999999996 < x < 1.75Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ x y) (+ -1.3333333333333333 (* x 0.3333333333333333)))))
(if (<= x -1.7)
t_0
(if (<= x 1.75) (/ (+ 1.0 (* x -1.3333333333333333)) y) t_0))))
double code(double x, double y) {
double t_0 = (x / y) * (-1.3333333333333333 + (x * 0.3333333333333333));
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x / y) * ((-1.3333333333333333d0) + (x * 0.3333333333333333d0))
if (x <= (-1.7d0)) then
tmp = t_0
else if (x <= 1.75d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x / y) * (-1.3333333333333333 + (x * 0.3333333333333333));
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) * (-1.3333333333333333 + (x * 0.3333333333333333)) tmp = 0 if x <= -1.7: tmp = t_0 elif x <= 1.75: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) * Float64(-1.3333333333333333 + Float64(x * 0.3333333333333333))) tmp = 0.0 if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) * (-1.3333333333333333 + (x * 0.3333333333333333)); tmp = 0.0; if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] * N[(-1.3333333333333333 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7], t$95$0, If[LessEqual[x, 1.75], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(-1.3333333333333333 + x \cdot 0.3333333333333333\right)\\
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.75:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.69999999999999996 or 1.75 < x Initial program 85.0%
Taylor expanded in x around inf
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
associate-*l*N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
times-fracN/A
Simplified99.6%
if -1.69999999999999996 < x < 1.75Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
Final simplification98.9%
(FPCore (x y)
:precision binary64
(if (<= x -4.6)
(/ (/ x (/ y x)) 3.0)
(if (<= x 3.0)
(/ (+ 1.0 (* x -1.3333333333333333)) y)
(* (/ x y) (/ x 3.0)))))
double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / (y / x)) / 3.0;
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.6d0)) then
tmp = (x / (y / x)) / 3.0d0
else if (x <= 3.0d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = (x / y) * (x / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / (y / x)) / 3.0;
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.6: tmp = (x / (y / x)) / 3.0 elif x <= 3.0: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = (x / y) * (x / 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.6) tmp = Float64(Float64(x / Float64(y / x)) / 3.0); elseif (x <= 3.0) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = Float64(Float64(x / y) * Float64(x / 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.6) tmp = (x / (y / x)) / 3.0; elseif (x <= 3.0) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = (x / y) * (x / 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.6], N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[x, 3.0], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{x}}}{3}\\
\mathbf{elif}\;x \leq 3:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{3}\\
\end{array}
\end{array}
if x < -4.5999999999999996Initial program 91.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6488.6%
Simplified88.6%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
associate-*l/N/A
/-lowering-/.f64N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6497.3%
Applied egg-rr97.3%
if -4.5999999999999996 < x < 3Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
if 3 < x Initial program 79.7%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.2%
Simplified79.2%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (x y)
:precision binary64
(if (<= x -4.6)
(/ (/ x 3.0) (/ y x))
(if (<= x 3.0)
(/ (+ 1.0 (* x -1.3333333333333333)) y)
(* (/ x y) (/ x 3.0)))))
double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / 3.0) / (y / x);
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.6d0)) then
tmp = (x / 3.0d0) / (y / x)
else if (x <= 3.0d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = (x / y) * (x / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / 3.0) / (y / x);
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.6: tmp = (x / 3.0) / (y / x) elif x <= 3.0: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = (x / y) * (x / 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.6) tmp = Float64(Float64(x / 3.0) / Float64(y / x)); elseif (x <= 3.0) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = Float64(Float64(x / y) * Float64(x / 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.6) tmp = (x / 3.0) / (y / x); elseif (x <= 3.0) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = (x / y) * (x / 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.6], N[(N[(x / 3.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.0], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{\frac{x}{3}}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq 3:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{3}\\
\end{array}
\end{array}
if x < -4.5999999999999996Initial program 91.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6488.6%
Simplified88.6%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.3%
Applied egg-rr97.3%
if -4.5999999999999996 < x < 3Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
if 3 < x Initial program 79.7%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.2%
Simplified79.2%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (x y)
:precision binary64
(if (<= x -4.6)
(/ x (/ y (/ x 3.0)))
(if (<= x 3.0)
(/ (+ 1.0 (* x -1.3333333333333333)) y)
(* (/ x y) (/ x 3.0)))))
double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = x / (y / (x / 3.0));
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.6d0)) then
tmp = x / (y / (x / 3.0d0))
else if (x <= 3.0d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = (x / y) * (x / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = x / (y / (x / 3.0));
} else if (x <= 3.0) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.6: tmp = x / (y / (x / 3.0)) elif x <= 3.0: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = (x / y) * (x / 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.6) tmp = Float64(x / Float64(y / Float64(x / 3.0))); elseif (x <= 3.0) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = Float64(Float64(x / y) * Float64(x / 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.6) tmp = x / (y / (x / 3.0)); elseif (x <= 3.0) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = (x / y) * (x / 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.6], N[(x / N[(y / N[(x / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.0], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{x}{\frac{y}{\frac{x}{3}}}\\
\mathbf{elif}\;x \leq 3:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{3}\\
\end{array}
\end{array}
if x < -4.5999999999999996Initial program 91.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6488.6%
Simplified88.6%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
clear-numN/A
div-invN/A
associate-/l/N/A
/-lowering-/.f64N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
if -4.5999999999999996 < x < 3Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6498.4%
Simplified98.4%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.4%
Applied egg-rr98.4%
if 3 < x Initial program 79.7%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.2%
Simplified79.2%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
Final simplification98.4%
(FPCore (x y) :precision binary64 (if (<= x -1.7) (/ x (/ y (/ x 3.0))) (if (<= x 0.58) (/ 1.0 y) (* (/ x y) (/ x 3.0)))))
double code(double x, double y) {
double tmp;
if (x <= -1.7) {
tmp = x / (y / (x / 3.0));
} else if (x <= 0.58) {
tmp = 1.0 / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.7d0)) then
tmp = x / (y / (x / 3.0d0))
else if (x <= 0.58d0) then
tmp = 1.0d0 / y
else
tmp = (x / y) * (x / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.7) {
tmp = x / (y / (x / 3.0));
} else if (x <= 0.58) {
tmp = 1.0 / y;
} else {
tmp = (x / y) * (x / 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.7: tmp = x / (y / (x / 3.0)) elif x <= 0.58: tmp = 1.0 / y else: tmp = (x / y) * (x / 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.7) tmp = Float64(x / Float64(y / Float64(x / 3.0))); elseif (x <= 0.58) tmp = Float64(1.0 / y); else tmp = Float64(Float64(x / y) * Float64(x / 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.7) tmp = x / (y / (x / 3.0)); elseif (x <= 0.58) tmp = 1.0 / y; else tmp = (x / y) * (x / 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.7], N[(x / N[(y / N[(x / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.58], N[(1.0 / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;\frac{x}{\frac{y}{\frac{x}{3}}}\\
\mathbf{elif}\;x \leq 0.58:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{3}\\
\end{array}
\end{array}
if x < -1.69999999999999996Initial program 91.2%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6488.6%
Simplified88.6%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
clear-numN/A
div-invN/A
associate-/l/N/A
/-lowering-/.f64N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
if -1.69999999999999996 < x < 0.57999999999999996Initial program 99.5%
Taylor expanded in x around 0
/-lowering-/.f6497.7%
Simplified97.7%
if 0.57999999999999996 < x Initial program 79.7%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.2%
Simplified79.2%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
Final simplification98.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (/ x y) (/ x 3.0)))) (if (<= x -1.7) t_0 (if (<= x 0.58) (/ 1.0 y) t_0))))
double code(double x, double y) {
double t_0 = (x / y) * (x / 3.0);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 0.58) {
tmp = 1.0 / y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x / y) * (x / 3.0d0)
if (x <= (-1.7d0)) then
tmp = t_0
else if (x <= 0.58d0) then
tmp = 1.0d0 / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x / y) * (x / 3.0);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 0.58) {
tmp = 1.0 / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) * (x / 3.0) tmp = 0 if x <= -1.7: tmp = t_0 elif x <= 0.58: tmp = 1.0 / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) * Float64(x / 3.0)) tmp = 0.0 if (x <= -1.7) tmp = t_0; elseif (x <= 0.58) tmp = Float64(1.0 / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) * (x / 3.0); tmp = 0.0; if (x <= -1.7) tmp = t_0; elseif (x <= 0.58) tmp = 1.0 / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] * N[(x / 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7], t$95$0, If[LessEqual[x, 0.58], N[(1.0 / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \frac{x}{3}\\
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.58:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.69999999999999996 or 0.57999999999999996 < x Initial program 85.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6483.6%
Simplified83.6%
associate-*r*N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6498.3%
Applied egg-rr98.3%
if -1.69999999999999996 < x < 0.57999999999999996Initial program 99.5%
Taylor expanded in x around 0
/-lowering-/.f6497.7%
Simplified97.7%
Final simplification98.0%
(FPCore (x y) :precision binary64 (if (<= x -0.75) (/ x (* y -0.75)) (/ 1.0 y)))
double code(double x, double y) {
double tmp;
if (x <= -0.75) {
tmp = x / (y * -0.75);
} else {
tmp = 1.0 / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.75d0)) then
tmp = x / (y * (-0.75d0))
else
tmp = 1.0d0 / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.75) {
tmp = x / (y * -0.75);
} else {
tmp = 1.0 / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.75: tmp = x / (y * -0.75) else: tmp = 1.0 / y return tmp
function code(x, y) tmp = 0.0 if (x <= -0.75) tmp = Float64(x / Float64(y * -0.75)); else tmp = Float64(1.0 / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.75) tmp = x / (y * -0.75); else tmp = 1.0 / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.75], N[(x / N[(y * -0.75), $MachinePrecision]), $MachinePrecision], N[(1.0 / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.75:\\
\;\;\;\;\frac{x}{y \cdot -0.75}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y}\\
\end{array}
\end{array}
if x < -0.75Initial program 91.4%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
*-lft-identityN/A
unpow2N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
associate-*r/N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6489.9%
Simplified89.9%
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6489.9%
Applied egg-rr89.9%
Taylor expanded in x around 0
Simplified31.7%
associate-/l/N/A
/-lowering-/.f64N/A
*-lowering-*.f6431.7%
Applied egg-rr31.7%
if -0.75 < x Initial program 93.1%
Taylor expanded in x around 0
/-lowering-/.f6467.6%
Simplified67.6%
(FPCore (x y) :precision binary64 (/ 1.0 y))
double code(double x, double y) {
return 1.0 / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / y
end function
public static double code(double x, double y) {
return 1.0 / y;
}
def code(x, y): return 1.0 / y
function code(x, y) return Float64(1.0 / y) end
function tmp = code(x, y) tmp = 1.0 / y; end
code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{y}
\end{array}
Initial program 92.7%
Taylor expanded in x around 0
/-lowering-/.f6453.8%
Simplified53.8%
(FPCore (x y) :precision binary64 (* (/ (- 1.0 x) y) (/ (- 3.0 x) 3.0)))
double code(double x, double y) {
return ((1.0 - x) / y) * ((3.0 - x) / 3.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((1.0d0 - x) / y) * ((3.0d0 - x) / 3.0d0)
end function
public static double code(double x, double y) {
return ((1.0 - x) / y) * ((3.0 - x) / 3.0);
}
def code(x, y): return ((1.0 - x) / y) * ((3.0 - x) / 3.0)
function code(x, y) return Float64(Float64(Float64(1.0 - x) / y) * Float64(Float64(3.0 - x) / 3.0)) end
function tmp = code(x, y) tmp = ((1.0 - x) / y) * ((3.0 - x) / 3.0); end
code[x_, y_] := N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] * N[(N[(3.0 - x), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{y} \cdot \frac{3 - x}{3}
\end{array}
herbie shell --seed 2024145
(FPCore (x y)
:name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (* (/ (- 1 x) y) (/ (- 3 x) 3)))
(/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))