
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (- y (* (/ x z) (+ y -1.0))))
double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y - ((x / z) * (y + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
def code(x, y, z): return y - ((x / z) * (y + -1.0))
function code(x, y, z) return Float64(y - Float64(Float64(x / z) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = y - ((x / z) * (y + -1.0)); end
code[x_, y_, z_] := N[(y - N[(N[(x / z), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - \frac{x}{z} \cdot \left(y + -1\right)
\end{array}
Initial program 90.4%
Taylor expanded in x around -inf 96.6%
mul-1-neg96.6%
unsub-neg96.6%
associate-/l*95.4%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y 7400000000.0)
(+ y (/ x z))
(if (or (<= y 9e+74) (and (not (<= y 2.26e+108)) (<= y 1.7e+209)))
(* (/ x z) (- y))
(- y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 7400000000.0) {
tmp = y + (x / z);
} else if ((y <= 9e+74) || (!(y <= 2.26e+108) && (y <= 1.7e+209))) {
tmp = (x / z) * -y;
} else {
tmp = y - (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 7400000000.0d0) then
tmp = y + (x / z)
else if ((y <= 9d+74) .or. (.not. (y <= 2.26d+108)) .and. (y <= 1.7d+209)) then
tmp = (x / z) * -y
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 7400000000.0) {
tmp = y + (x / z);
} else if ((y <= 9e+74) || (!(y <= 2.26e+108) && (y <= 1.7e+209))) {
tmp = (x / z) * -y;
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7400000000.0: tmp = y + (x / z) elif (y <= 9e+74) or (not (y <= 2.26e+108) and (y <= 1.7e+209)): tmp = (x / z) * -y else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7400000000.0) tmp = Float64(y + Float64(x / z)); elseif ((y <= 9e+74) || (!(y <= 2.26e+108) && (y <= 1.7e+209))) tmp = Float64(Float64(x / z) * Float64(-y)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 7400000000.0) tmp = y + (x / z); elseif ((y <= 9e+74) || (~((y <= 2.26e+108)) && (y <= 1.7e+209))) tmp = (x / z) * -y; else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7400000000.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 9e+74], And[N[Not[LessEqual[y, 2.26e+108]], $MachinePrecision], LessEqual[y, 1.7e+209]]], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7400000000:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+74} \lor \neg \left(y \leq 2.26 \cdot 10^{+108}\right) \land y \leq 1.7 \cdot 10^{+209}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 7.4e9Initial program 94.2%
Taylor expanded in x around -inf 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-/l*97.7%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.6%
mul-1-neg86.6%
distribute-frac-neg86.6%
Simplified86.6%
Taylor expanded in y around 0 86.6%
+-commutative86.6%
Simplified86.6%
if 7.4e9 < y < 8.9999999999999999e74 or 2.2599999999999999e108 < y < 1.6999999999999998e209Initial program 91.1%
Taylor expanded in y around inf 90.4%
associate-/l*99.1%
associate-/r/88.1%
Simplified88.1%
Taylor expanded in z around 0 67.4%
mul-1-neg67.4%
*-commutative67.4%
associate-*r/71.7%
distribute-rgt-neg-out71.7%
distribute-frac-neg71.7%
Simplified71.7%
if 8.9999999999999999e74 < y < 2.2599999999999999e108 or 1.6999999999999998e209 < y Initial program 68.1%
Taylor expanded in x around -inf 85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*91.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 61.5%
mul-1-neg61.5%
distribute-frac-neg61.5%
Simplified61.5%
add-log-exp10.5%
log1p-expm1-u4.1%
log1p-udef4.1%
diff-log4.1%
add-sqr-sqrt2.2%
sqrt-unprod13.2%
sqr-neg13.2%
sqrt-unprod11.3%
add-sqr-sqrt19.9%
Applied egg-rr19.9%
log-div19.9%
rem-log-exp89.6%
log1p-def89.6%
log1p-expm174.5%
Simplified74.5%
Final simplification82.6%
(FPCore (x y z)
:precision binary64
(if (<= y 780000000.0)
(+ y (/ x z))
(if (<= y 1.2e+75)
(/ (* y (- x)) z)
(if (or (<= y 5.2e+107) (not (<= y 1.05e+201)))
(- y (/ x z))
(* (/ x z) (- y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 780000000.0) {
tmp = y + (x / z);
} else if (y <= 1.2e+75) {
tmp = (y * -x) / z;
} else if ((y <= 5.2e+107) || !(y <= 1.05e+201)) {
tmp = y - (x / z);
} else {
tmp = (x / z) * -y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 780000000.0d0) then
tmp = y + (x / z)
else if (y <= 1.2d+75) then
tmp = (y * -x) / z
else if ((y <= 5.2d+107) .or. (.not. (y <= 1.05d+201))) then
tmp = y - (x / z)
else
tmp = (x / z) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 780000000.0) {
tmp = y + (x / z);
} else if (y <= 1.2e+75) {
tmp = (y * -x) / z;
} else if ((y <= 5.2e+107) || !(y <= 1.05e+201)) {
tmp = y - (x / z);
} else {
tmp = (x / z) * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 780000000.0: tmp = y + (x / z) elif y <= 1.2e+75: tmp = (y * -x) / z elif (y <= 5.2e+107) or not (y <= 1.05e+201): tmp = y - (x / z) else: tmp = (x / z) * -y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 780000000.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.2e+75) tmp = Float64(Float64(y * Float64(-x)) / z); elseif ((y <= 5.2e+107) || !(y <= 1.05e+201)) tmp = Float64(y - Float64(x / z)); else tmp = Float64(Float64(x / z) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 780000000.0) tmp = y + (x / z); elseif (y <= 1.2e+75) tmp = (y * -x) / z; elseif ((y <= 5.2e+107) || ~((y <= 1.05e+201))) tmp = y - (x / z); else tmp = (x / z) * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 780000000.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+75], N[(N[(y * (-x)), $MachinePrecision] / z), $MachinePrecision], If[Or[LessEqual[y, 5.2e+107], N[Not[LessEqual[y, 1.05e+201]], $MachinePrecision]], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 780000000:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+75}:\\
\;\;\;\;\frac{y \cdot \left(-x\right)}{z}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+107} \lor \neg \left(y \leq 1.05 \cdot 10^{+201}\right):\\
\;\;\;\;y - \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < 7.8e8Initial program 94.2%
Taylor expanded in x around -inf 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-/l*97.7%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.6%
mul-1-neg86.6%
distribute-frac-neg86.6%
Simplified86.6%
Taylor expanded in y around 0 86.6%
+-commutative86.6%
Simplified86.6%
if 7.8e8 < y < 1.2e75Initial program 99.8%
Taylor expanded in y around inf 97.9%
Taylor expanded in z around 0 78.9%
mul-1-neg78.9%
distribute-lft-neg-out78.9%
*-commutative78.9%
Simplified78.9%
if 1.2e75 < y < 5.2000000000000002e107 or 1.05e201 < y Initial program 68.1%
Taylor expanded in x around -inf 85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*91.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 61.5%
mul-1-neg61.5%
distribute-frac-neg61.5%
Simplified61.5%
add-log-exp10.5%
log1p-expm1-u4.1%
log1p-udef4.1%
diff-log4.1%
add-sqr-sqrt2.2%
sqrt-unprod13.2%
sqr-neg13.2%
sqrt-unprod11.3%
add-sqr-sqrt19.9%
Applied egg-rr19.9%
log-div19.9%
rem-log-exp89.6%
log1p-def89.6%
log1p-expm174.5%
Simplified74.5%
if 5.2000000000000002e107 < y < 1.05e201Initial program 85.9%
Taylor expanded in y around inf 85.9%
associate-/l*99.8%
associate-/r/85.8%
Simplified85.8%
Taylor expanded in z around 0 60.6%
mul-1-neg60.6%
*-commutative60.6%
associate-*r/67.5%
distribute-rgt-neg-out67.5%
distribute-frac-neg67.5%
Simplified67.5%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.2e-9) (not (<= x 6.4e+25))) (* (/ x z) (- 1.0 y)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.2e-9) || !(x <= 6.4e+25)) {
tmp = (x / z) * (1.0 - y);
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.2d-9)) .or. (.not. (x <= 6.4d+25))) then
tmp = (x / z) * (1.0d0 - y)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.2e-9) || !(x <= 6.4e+25)) {
tmp = (x / z) * (1.0 - y);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.2e-9) or not (x <= 6.4e+25): tmp = (x / z) * (1.0 - y) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.2e-9) || !(x <= 6.4e+25)) tmp = Float64(Float64(x / z) * Float64(1.0 - y)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.2e-9) || ~((x <= 6.4e+25))) tmp = (x / z) * (1.0 - y); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.2e-9], N[Not[LessEqual[x, 6.4e+25]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-9} \lor \neg \left(x \leq 6.4 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -2.1999999999999998e-9 or 6.3999999999999999e25 < x Initial program 93.4%
Taylor expanded in x around inf 86.7%
associate-/l*89.6%
associate-/r/89.6%
mul-1-neg89.6%
unsub-neg89.6%
Simplified89.6%
if -2.1999999999999998e-9 < x < 6.3999999999999999e25Initial program 87.4%
Taylor expanded in x around -inf 99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-/l*90.9%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 84.5%
mul-1-neg84.5%
distribute-frac-neg84.5%
Simplified84.5%
Taylor expanded in y around 0 84.5%
+-commutative84.5%
Simplified84.5%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -15000000.0) (not (<= y 2.2e-5))) (* (- z x) (/ y z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -15000000.0) || !(y <= 2.2e-5)) {
tmp = (z - x) * (y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-15000000.0d0)) .or. (.not. (y <= 2.2d-5))) then
tmp = (z - x) * (y / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -15000000.0) || !(y <= 2.2e-5)) {
tmp = (z - x) * (y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -15000000.0) or not (y <= 2.2e-5): tmp = (z - x) * (y / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -15000000.0) || !(y <= 2.2e-5)) tmp = Float64(Float64(z - x) * Float64(y / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -15000000.0) || ~((y <= 2.2e-5))) tmp = (z - x) * (y / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -15000000.0], N[Not[LessEqual[y, 2.2e-5]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15000000 \lor \neg \left(y \leq 2.2 \cdot 10^{-5}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.5e7 or 2.1999999999999999e-5 < y Initial program 82.1%
Taylor expanded in y around inf 81.9%
associate-/l*99.6%
associate-/r/90.7%
Simplified90.7%
if -1.5e7 < y < 2.1999999999999999e-5Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
distribute-frac-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification94.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -15000000.0) (not (<= y 2.2e-5))) (/ y (/ z (- z x))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -15000000.0) || !(y <= 2.2e-5)) {
tmp = y / (z / (z - x));
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-15000000.0d0)) .or. (.not. (y <= 2.2d-5))) then
tmp = y / (z / (z - x))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -15000000.0) || !(y <= 2.2e-5)) {
tmp = y / (z / (z - x));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -15000000.0) or not (y <= 2.2e-5): tmp = y / (z / (z - x)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -15000000.0) || !(y <= 2.2e-5)) tmp = Float64(y / Float64(z / Float64(z - x))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -15000000.0) || ~((y <= 2.2e-5))) tmp = y / (z / (z - x)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -15000000.0], N[Not[LessEqual[y, 2.2e-5]], $MachinePrecision]], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15000000 \lor \neg \left(y \leq 2.2 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.5e7 or 2.1999999999999999e-5 < y Initial program 82.1%
Taylor expanded in y around inf 81.9%
associate-/l*99.6%
Simplified99.6%
if -1.5e7 < y < 2.1999999999999999e-5Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
distribute-frac-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.4e-69) (not (<= y 3.4e-6))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e-69) || !(y <= 3.4e-6)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-4.4d-69)) .or. (.not. (y <= 3.4d-6))) then
tmp = z * (y / z)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e-69) || !(y <= 3.4e-6)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.4e-69) or not (y <= 3.4e-6): tmp = z * (y / z) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.4e-69) || !(y <= 3.4e-6)) tmp = Float64(z * Float64(y / z)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.4e-69) || ~((y <= 3.4e-6))) tmp = z * (y / z); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.4e-69], N[Not[LessEqual[y, 3.4e-6]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-69} \lor \neg \left(y \leq 3.4 \cdot 10^{-6}\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -4.4e-69 or 3.40000000000000006e-6 < y Initial program 84.0%
Taylor expanded in y around inf 83.2%
Taylor expanded in z around inf 36.3%
associate-/l*49.2%
associate-/r/52.5%
Applied egg-rr52.5%
if -4.4e-69 < y < 3.40000000000000006e-6Initial program 99.9%
Taylor expanded in y around 0 80.8%
Final simplification63.9%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e-69) y (if (<= y 7.4e-8) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e-69) {
tmp = y;
} else if (y <= 7.4e-8) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-6.5d-69)) then
tmp = y
else if (y <= 7.4d-8) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e-69) {
tmp = y;
} else if (y <= 7.4e-8) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e-69: tmp = y elif y <= 7.4e-8: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e-69) tmp = y; elseif (y <= 7.4e-8) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.5e-69) tmp = y; elseif (y <= 7.4e-8) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e-69], y, If[LessEqual[y, 7.4e-8], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-69}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -6.49999999999999951e-69 or 7.4000000000000001e-8 < y Initial program 84.0%
Taylor expanded in x around 0 49.2%
if -6.49999999999999951e-69 < y < 7.4000000000000001e-8Initial program 99.9%
Taylor expanded in y around 0 80.8%
Final simplification61.9%
(FPCore (x y z) :precision binary64 (if (<= y 2.2e-5) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e-5) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.2d-5) then
tmp = y + (x / z)
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e-5) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.2e-5: tmp = y + (x / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.2e-5) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.2e-5) tmp = y + (x / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.2e-5], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{-5}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 2.1999999999999999e-5Initial program 94.1%
Taylor expanded in x around -inf 98.8%
mul-1-neg98.8%
unsub-neg98.8%
associate-/l*97.6%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.4%
mul-1-neg86.4%
distribute-frac-neg86.4%
Simplified86.4%
Taylor expanded in y around 0 86.4%
+-commutative86.4%
Simplified86.4%
if 2.1999999999999999e-5 < y Initial program 81.9%
Taylor expanded in x around -inf 91.4%
mul-1-neg91.4%
unsub-neg91.4%
associate-/l*90.4%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 42.6%
mul-1-neg42.6%
distribute-frac-neg42.6%
Simplified42.6%
add-log-exp14.2%
log1p-expm1-u4.6%
log1p-udef4.6%
diff-log4.6%
add-sqr-sqrt1.2%
sqrt-unprod13.7%
sqr-neg13.7%
sqrt-unprod12.6%
add-sqr-sqrt19.3%
Applied egg-rr19.3%
log-div19.3%
rem-log-exp75.0%
log1p-def75.0%
log1p-expm158.0%
Simplified58.0%
Final simplification77.7%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return y + (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (x / z)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 90.4%
Taylor expanded in x around -inf 96.6%
mul-1-neg96.6%
unsub-neg96.6%
associate-/l*95.4%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 73.0%
mul-1-neg73.0%
distribute-frac-neg73.0%
Simplified73.0%
Taylor expanded in y around 0 73.0%
+-commutative73.0%
Simplified73.0%
Final simplification73.0%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 90.4%
Taylor expanded in x around 0 37.8%
Final simplification37.8%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2023271
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))