
(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 (/ (- 1.0 x) (/ (* 3.0 y) (- 3.0 x))))
double code(double x, double y) {
return (1.0 - x) / ((3.0 * y) / (3.0 - x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - x) / ((3.0d0 * y) / (3.0d0 - x))
end function
public static double code(double x, double y) {
return (1.0 - x) / ((3.0 * y) / (3.0 - x));
}
def code(x, y): return (1.0 - x) / ((3.0 * y) / (3.0 - x))
function code(x, y) return Float64(Float64(1.0 - x) / Float64(Float64(3.0 * y) / Float64(3.0 - x))) end
function tmp = code(x, y) tmp = (1.0 - x) / ((3.0 * y) / (3.0 - x)); end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] / N[(N[(3.0 * y), $MachinePrecision] / N[(3.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{\frac{3 \cdot y}{3 - x}}
\end{array}
Initial program 94.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (- 1.0 x) (- 3.0 x)))) (if (<= t_0 5e+32) (/ t_0 (* 3.0 y)) (/ x (/ (* 3.0 y) x)))))
double code(double x, double y) {
double t_0 = (1.0 - x) * (3.0 - x);
double tmp;
if (t_0 <= 5e+32) {
tmp = t_0 / (3.0 * y);
} else {
tmp = x / ((3.0 * y) / x);
}
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 = (1.0d0 - x) * (3.0d0 - x)
if (t_0 <= 5d+32) then
tmp = t_0 / (3.0d0 * y)
else
tmp = x / ((3.0d0 * y) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (1.0 - x) * (3.0 - x);
double tmp;
if (t_0 <= 5e+32) {
tmp = t_0 / (3.0 * y);
} else {
tmp = x / ((3.0 * y) / x);
}
return tmp;
}
def code(x, y): t_0 = (1.0 - x) * (3.0 - x) tmp = 0 if t_0 <= 5e+32: tmp = t_0 / (3.0 * y) else: tmp = x / ((3.0 * y) / x) return tmp
function code(x, y) t_0 = Float64(Float64(1.0 - x) * Float64(3.0 - x)) tmp = 0.0 if (t_0 <= 5e+32) tmp = Float64(t_0 / Float64(3.0 * y)); else tmp = Float64(x / Float64(Float64(3.0 * y) / x)); end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 - x) * (3.0 - x); tmp = 0.0; if (t_0 <= 5e+32) tmp = t_0 / (3.0 * y); else tmp = x / ((3.0 * y) / x); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] * N[(3.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+32], N[(t$95$0 / N[(3.0 * y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - x\right) \cdot \left(3 - x\right)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+32}:\\
\;\;\;\;\frac{t\_0}{3 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{3 \cdot y}{x}}\\
\end{array}
\end{array}
if (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 3 binary64) x)) < 4.9999999999999997e32Initial program 99.6%
if 4.9999999999999997e32 < (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 3 binary64) x)) Initial program 88.2%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6488.2%
Simplified88.2%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Applied egg-rr99.8%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ x y) (+ (* x 0.3333333333333333) -1.3333333333333333))))
(if (<= x -1.7)
t_0
(if (<= x 1.75) (* (+ 1.0 (* x -1.3333333333333333)) (/ 1.0 y)) t_0))))
double code(double x, double y) {
double t_0 = (x / y) * ((x * 0.3333333333333333) + -1.3333333333333333);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) * (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 * 0.3333333333333333d0) + (-1.3333333333333333d0))
if (x <= (-1.7d0)) then
tmp = t_0
else if (x <= 1.75d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) * (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 * 0.3333333333333333) + -1.3333333333333333);
double tmp;
if (x <= -1.7) {
tmp = t_0;
} else if (x <= 1.75) {
tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) * ((x * 0.3333333333333333) + -1.3333333333333333) tmp = 0 if x <= -1.7: tmp = t_0 elif x <= 1.75: tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) * Float64(Float64(x * 0.3333333333333333) + -1.3333333333333333)) tmp = 0.0 if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) * Float64(1.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) * ((x * 0.3333333333333333) + -1.3333333333333333); tmp = 0.0; if (x <= -1.7) tmp = t_0; elseif (x <= 1.75) tmp = (1.0 + (x * -1.3333333333333333)) * (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[(N[(x * 0.3333333333333333), $MachinePrecision] + -1.3333333333333333), $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] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} \cdot \left(x \cdot 0.3333333333333333 + -1.3333333333333333\right)\\
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.75:\\
\;\;\;\;\left(1 + x \cdot -1.3333333333333333\right) \cdot \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.69999999999999996 or 1.75 < x Initial program 89.0%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unpow2N/A
associate-/l*N/A
associate-*r*N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
unpow2N/A
associate-/l*N/A
*-rgt-identityN/A
Simplified98.2%
if -1.69999999999999996 < x < 1.75Initial program 99.7%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/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.5%
Simplified98.5%
Final simplification98.3%
(FPCore (x y)
:precision binary64
(if (<= x -4.6)
(/ (/ x y) (/ 3.0 x))
(if (<= x 0.65)
(* (+ 1.0 (* x -1.3333333333333333)) (/ 1.0 y))
(/ x (/ (* 3.0 y) x)))))
double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / y) / (3.0 / x);
} else if (x <= 0.65) {
tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y);
} else {
tmp = x / ((3.0 * y) / x);
}
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) / (3.0d0 / x)
else if (x <= 0.65d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) * (1.0d0 / y)
else
tmp = x / ((3.0d0 * y) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / y) / (3.0 / x);
} else if (x <= 0.65) {
tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y);
} else {
tmp = x / ((3.0 * y) / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.6: tmp = (x / y) / (3.0 / x) elif x <= 0.65: tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y) else: tmp = x / ((3.0 * y) / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.6) tmp = Float64(Float64(x / y) / Float64(3.0 / x)); elseif (x <= 0.65) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) * Float64(1.0 / y)); else tmp = Float64(x / Float64(Float64(3.0 * y) / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.6) tmp = (x / y) / (3.0 / x); elseif (x <= 0.65) tmp = (1.0 + (x * -1.3333333333333333)) * (1.0 / y); else tmp = x / ((3.0 * y) / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.6], N[(N[(x / y), $MachinePrecision] / N[(3.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.65], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{3}{x}}\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;\left(1 + x \cdot -1.3333333333333333\right) \cdot \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{3 \cdot y}{x}}\\
\end{array}
\end{array}
if x < -4.5999999999999996Initial program 86.9%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6486.4%
Simplified86.4%
times-fracN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
if -4.5999999999999996 < x < 0.650000000000000022Initial program 99.7%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/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.5%
Simplified98.5%
if 0.650000000000000022 < x Initial program 90.5%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6485.3%
Simplified85.3%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6494.5%
Applied egg-rr94.5%
Final simplification97.5%
(FPCore (x y)
:precision binary64
(if (<= x -4.6)
(/ (/ x y) (/ 3.0 x))
(if (<= x 0.65)
(/ (+ 1.0 (* x -1.3333333333333333)) y)
(/ x (/ (* 3.0 y) x)))))
double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / y) / (3.0 / x);
} else if (x <= 0.65) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = x / ((3.0 * y) / x);
}
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) / (3.0d0 / x)
else if (x <= 0.65d0) then
tmp = (1.0d0 + (x * (-1.3333333333333333d0))) / y
else
tmp = x / ((3.0d0 * y) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.6) {
tmp = (x / y) / (3.0 / x);
} else if (x <= 0.65) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = x / ((3.0 * y) / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.6: tmp = (x / y) / (3.0 / x) elif x <= 0.65: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = x / ((3.0 * y) / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.6) tmp = Float64(Float64(x / y) / Float64(3.0 / x)); elseif (x <= 0.65) tmp = Float64(Float64(1.0 + Float64(x * -1.3333333333333333)) / y); else tmp = Float64(x / Float64(Float64(3.0 * y) / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.6) tmp = (x / y) / (3.0 / x); elseif (x <= 0.65) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = x / ((3.0 * y) / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.6], N[(N[(x / y), $MachinePrecision] / N[(3.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.65], N[(N[(1.0 + N[(x * -1.3333333333333333), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{3}{x}}\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{3 \cdot y}{x}}\\
\end{array}
\end{array}
if x < -4.5999999999999996Initial program 86.9%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6486.4%
Simplified86.4%
times-fracN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6499.3%
Applied egg-rr99.3%
if -4.5999999999999996 < x < 0.650000000000000022Initial program 99.7%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/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.5%
Simplified98.5%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.5%
Applied egg-rr98.5%
if 0.650000000000000022 < x Initial program 90.5%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6485.3%
Simplified85.3%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6494.5%
Applied egg-rr94.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (/ (* 3.0 y) x))))
(if (<= x -4.6)
t_0
(if (<= x 0.65) (/ (+ 1.0 (* x -1.3333333333333333)) y) t_0))))
double code(double x, double y) {
double t_0 = x / ((3.0 * y) / x);
double tmp;
if (x <= -4.6) {
tmp = t_0;
} else if (x <= 0.65) {
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 / ((3.0d0 * y) / x)
if (x <= (-4.6d0)) then
tmp = t_0
else if (x <= 0.65d0) 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 / ((3.0 * y) / x);
double tmp;
if (x <= -4.6) {
tmp = t_0;
} else if (x <= 0.65) {
tmp = (1.0 + (x * -1.3333333333333333)) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / ((3.0 * y) / x) tmp = 0 if x <= -4.6: tmp = t_0 elif x <= 0.65: tmp = (1.0 + (x * -1.3333333333333333)) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(Float64(3.0 * y) / x)) tmp = 0.0 if (x <= -4.6) tmp = t_0; elseif (x <= 0.65) 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 / ((3.0 * y) / x); tmp = 0.0; if (x <= -4.6) tmp = t_0; elseif (x <= 0.65) tmp = (1.0 + (x * -1.3333333333333333)) / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.6], t$95$0, If[LessEqual[x, 0.65], 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}{\frac{3 \cdot y}{x}}\\
\mathbf{if}\;x \leq -4.6:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.5999999999999996 or 0.650000000000000022 < x Initial program 89.0%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6485.7%
Simplified85.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6496.5%
Applied egg-rr96.5%
if -4.5999999999999996 < x < 0.650000000000000022Initial program 99.7%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/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.5%
Simplified98.5%
un-div-invN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6498.5%
Applied egg-rr98.5%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (/ (* 3.0 y) x)))) (if (<= x -3.8) t_0 (if (<= x 0.7) (/ (- 1.0 x) y) t_0))))
double code(double x, double y) {
double t_0 = x / ((3.0 * y) / x);
double tmp;
if (x <= -3.8) {
tmp = t_0;
} else if (x <= 0.7) {
tmp = (1.0 - x) / 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 / ((3.0d0 * y) / x)
if (x <= (-3.8d0)) then
tmp = t_0
else if (x <= 0.7d0) then
tmp = (1.0d0 - x) / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / ((3.0 * y) / x);
double tmp;
if (x <= -3.8) {
tmp = t_0;
} else if (x <= 0.7) {
tmp = (1.0 - x) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / ((3.0 * y) / x) tmp = 0 if x <= -3.8: tmp = t_0 elif x <= 0.7: tmp = (1.0 - x) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(Float64(3.0 * y) / x)) tmp = 0.0 if (x <= -3.8) tmp = t_0; elseif (x <= 0.7) tmp = Float64(Float64(1.0 - x) / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / ((3.0 * y) / x); tmp = 0.0; if (x <= -3.8) tmp = t_0; elseif (x <= 0.7) tmp = (1.0 - x) / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(N[(3.0 * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.8], t$95$0, If[LessEqual[x, 0.7], N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\frac{3 \cdot y}{x}}\\
\mathbf{if}\;x \leq -3.8:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;\frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.7999999999999998 or 0.69999999999999996 < x Initial program 89.0%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6485.7%
Simplified85.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6496.5%
Applied egg-rr96.5%
if -3.7999999999999998 < x < 0.69999999999999996Initial program 99.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.7%
Applied egg-rr99.7%
Taylor expanded in x around 0
Simplified97.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (* x (* x (/ 0.3333333333333333 y))))) (if (<= x -3.8) t_0 (if (<= x 0.7) (/ (- 1.0 x) y) t_0))))
double code(double x, double y) {
double t_0 = x * (x * (0.3333333333333333 / y));
double tmp;
if (x <= -3.8) {
tmp = t_0;
} else if (x <= 0.7) {
tmp = (1.0 - x) / 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 * (x * (0.3333333333333333d0 / y))
if (x <= (-3.8d0)) then
tmp = t_0
else if (x <= 0.7d0) then
tmp = (1.0d0 - x) / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (x * (0.3333333333333333 / y));
double tmp;
if (x <= -3.8) {
tmp = t_0;
} else if (x <= 0.7) {
tmp = (1.0 - x) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (x * (0.3333333333333333 / y)) tmp = 0 if x <= -3.8: tmp = t_0 elif x <= 0.7: tmp = (1.0 - x) / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x * Float64(x * Float64(0.3333333333333333 / y))) tmp = 0.0 if (x <= -3.8) tmp = t_0; elseif (x <= 0.7) tmp = Float64(Float64(1.0 - x) / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (x * (0.3333333333333333 / y)); tmp = 0.0; if (x <= -3.8) tmp = t_0; elseif (x <= 0.7) tmp = (1.0 - x) / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(x * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.8], t$95$0, If[LessEqual[x, 0.7], N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \frac{0.3333333333333333}{y}\right)\\
\mathbf{if}\;x \leq -3.8:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;\frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.7999999999999998 or 0.69999999999999996 < x Initial program 89.0%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6485.7%
Simplified85.7%
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-eval96.5%
Applied egg-rr96.5%
if -3.7999999999999998 < x < 0.69999999999999996Initial program 99.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.7%
Applied egg-rr99.7%
Taylor expanded in x around 0
Simplified97.2%
Final simplification96.9%
(FPCore (x y) :precision binary64 (if (<= x -0.75) (/ (* x -1.3333333333333333) y) (/ 1.0 y)))
double code(double x, double y) {
double tmp;
if (x <= -0.75) {
tmp = (x * -1.3333333333333333) / y;
} 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 * (-1.3333333333333333d0)) / y
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 * -1.3333333333333333) / y;
} else {
tmp = 1.0 / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.75: tmp = (x * -1.3333333333333333) / y else: tmp = 1.0 / y return tmp
function code(x, y) tmp = 0.0 if (x <= -0.75) tmp = Float64(Float64(x * -1.3333333333333333) / y); 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 * -1.3333333333333333) / y; else tmp = 1.0 / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.75], N[(N[(x * -1.3333333333333333), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.75:\\
\;\;\;\;\frac{x \cdot -1.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y}\\
\end{array}
\end{array}
if x < -0.75Initial program 86.9%
Taylor expanded in x around 0
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/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-/.f6426.7%
Simplified26.7%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6426.7%
Simplified26.7%
if -0.75 < x Initial program 96.5%
Taylor expanded in x around 0
/-lowering-/.f6465.5%
Simplified65.5%
Final simplification57.9%
(FPCore (x y) :precision binary64 (/ (- 1.0 x) y))
double code(double x, double y) {
return (1.0 - x) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - x) / y
end function
public static double code(double x, double y) {
return (1.0 - x) / y;
}
def code(x, y): return (1.0 - x) / y
function code(x, y) return Float64(Float64(1.0 - x) / y) end
function tmp = code(x, y) tmp = (1.0 - x) / y; end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - x}{y}
\end{array}
Initial program 94.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
Taylor expanded in x around 0
Simplified56.7%
(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 94.6%
Taylor expanded in x around 0
/-lowering-/.f6453.6%
Simplified53.6%
(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 2024161
(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)))