
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -2.8e-57) (not (<= z 6.1e-30))) (* x (/ (+ (- y z) 1.0) z)) (/ (+ x (* x y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-57) || !(z <= 6.1e-30)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x + (x * y)) / 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 ((z <= (-2.8d-57)) .or. (.not. (z <= 6.1d-30))) then
tmp = x * (((y - z) + 1.0d0) / z)
else
tmp = (x + (x * y)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-57) || !(z <= 6.1e-30)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.8e-57) or not (z <= 6.1e-30): tmp = x * (((y - z) + 1.0) / z) else: tmp = (x + (x * y)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.8e-57) || !(z <= 6.1e-30)) tmp = Float64(x * Float64(Float64(Float64(y - z) + 1.0) / z)); else tmp = Float64(Float64(x + Float64(x * y)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.8e-57) || ~((z <= 6.1e-30))) tmp = x * (((y - z) + 1.0) / z); else tmp = (x + (x * y)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.8e-57], N[Not[LessEqual[z, 6.1e-30]], $MachinePrecision]], N[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-57} \lor \neg \left(z \leq 6.1 \cdot 10^{-30}\right):\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\end{array}
\end{array}
if z < -2.7999999999999999e-57 or 6.09999999999999981e-30 < z Initial program 82.5%
associate-/l*99.9%
Simplified99.9%
if -2.7999999999999999e-57 < z < 6.09999999999999981e-30Initial program 99.8%
distribute-lft-in99.8%
fma-define99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x 2e-45) (/ (fma x (- y z) x) z) (/ x (/ z (+ (- y z) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e-45) {
tmp = fma(x, (y - z), x) / z;
} else {
tmp = x / (z / ((y - z) + 1.0));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2e-45) tmp = Float64(fma(x, Float64(y - z), x) / z); else tmp = Float64(x / Float64(z / Float64(Float64(y - z) + 1.0))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2e-45], N[(N[(x * N[(y - z), $MachinePrecision] + x), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-45}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y - z, x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\
\end{array}
\end{array}
if x < 1.99999999999999997e-45Initial program 94.0%
distribute-lft-in94.0%
fma-define94.0%
*-rgt-identity94.0%
Simplified94.0%
if 1.99999999999999997e-45 < x Initial program 77.5%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification95.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -820.0)
(- x)
(if (<= z -1.15e-168)
(/ x z)
(if (<= z -6.4e-263)
t_0
(if (<= z 1.1e-176)
(/ x z)
(if (<= z 5.9e-89)
t_0
(if (<= z 8.5e-42) (/ x z) (if (<= z 1.15e+18) t_0 (- x))))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -820.0) {
tmp = -x;
} else if (z <= -1.15e-168) {
tmp = x / z;
} else if (z <= -6.4e-263) {
tmp = t_0;
} else if (z <= 1.1e-176) {
tmp = x / z;
} else if (z <= 5.9e-89) {
tmp = t_0;
} else if (z <= 8.5e-42) {
tmp = x / z;
} else if (z <= 1.15e+18) {
tmp = t_0;
} else {
tmp = -x;
}
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) :: t_0
real(8) :: tmp
t_0 = y * (x / z)
if (z <= (-820.0d0)) then
tmp = -x
else if (z <= (-1.15d-168)) then
tmp = x / z
else if (z <= (-6.4d-263)) then
tmp = t_0
else if (z <= 1.1d-176) then
tmp = x / z
else if (z <= 5.9d-89) then
tmp = t_0
else if (z <= 8.5d-42) then
tmp = x / z
else if (z <= 1.15d+18) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -820.0) {
tmp = -x;
} else if (z <= -1.15e-168) {
tmp = x / z;
} else if (z <= -6.4e-263) {
tmp = t_0;
} else if (z <= 1.1e-176) {
tmp = x / z;
} else if (z <= 5.9e-89) {
tmp = t_0;
} else if (z <= 8.5e-42) {
tmp = x / z;
} else if (z <= 1.15e+18) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -820.0: tmp = -x elif z <= -1.15e-168: tmp = x / z elif z <= -6.4e-263: tmp = t_0 elif z <= 1.1e-176: tmp = x / z elif z <= 5.9e-89: tmp = t_0 elif z <= 8.5e-42: tmp = x / z elif z <= 1.15e+18: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -820.0) tmp = Float64(-x); elseif (z <= -1.15e-168) tmp = Float64(x / z); elseif (z <= -6.4e-263) tmp = t_0; elseif (z <= 1.1e-176) tmp = Float64(x / z); elseif (z <= 5.9e-89) tmp = t_0; elseif (z <= 8.5e-42) tmp = Float64(x / z); elseif (z <= 1.15e+18) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (z <= -820.0) tmp = -x; elseif (z <= -1.15e-168) tmp = x / z; elseif (z <= -6.4e-263) tmp = t_0; elseif (z <= 1.1e-176) tmp = x / z; elseif (z <= 5.9e-89) tmp = t_0; elseif (z <= 8.5e-42) tmp = x / z; elseif (z <= 1.15e+18) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -820.0], (-x), If[LessEqual[z, -1.15e-168], N[(x / z), $MachinePrecision], If[LessEqual[z, -6.4e-263], t$95$0, If[LessEqual[z, 1.1e-176], N[(x / z), $MachinePrecision], If[LessEqual[z, 5.9e-89], t$95$0, If[LessEqual[z, 8.5e-42], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.15e+18], t$95$0, (-x)]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -820:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-263}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-176}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-89}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-42}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+18}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -820 or 1.15e18 < z Initial program 79.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 74.8%
mul-1-neg74.8%
Simplified74.8%
if -820 < z < -1.14999999999999993e-168 or -6.4000000000000001e-263 < z < 1.0999999999999999e-176 or 5.90000000000000021e-89 < z < 8.4999999999999996e-42Initial program 99.8%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in y around 0 68.5%
associate-/l*68.4%
Simplified68.4%
Taylor expanded in z around 0 67.1%
if -1.14999999999999993e-168 < z < -6.4000000000000001e-263 or 1.0999999999999999e-176 < z < 5.90000000000000021e-89 or 8.4999999999999996e-42 < z < 1.15e18Initial program 99.7%
associate-/l*89.8%
Simplified89.8%
Taylor expanded in y around inf 73.1%
*-commutative73.1%
associate-*r/75.0%
Simplified75.0%
Final simplification72.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= z -820.0)
(- x)
(if (<= z -9e-169)
(/ x z)
(if (<= z -8.2e-262)
t_0
(if (<= z 4.4e-41) (/ x z) (if (<= z 3.5e+83) t_0 (- x))))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -820.0) {
tmp = -x;
} else if (z <= -9e-169) {
tmp = x / z;
} else if (z <= -8.2e-262) {
tmp = t_0;
} else if (z <= 4.4e-41) {
tmp = x / z;
} else if (z <= 3.5e+83) {
tmp = t_0;
} else {
tmp = -x;
}
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) :: t_0
real(8) :: tmp
t_0 = x * (y / z)
if (z <= (-820.0d0)) then
tmp = -x
else if (z <= (-9d-169)) then
tmp = x / z
else if (z <= (-8.2d-262)) then
tmp = t_0
else if (z <= 4.4d-41) then
tmp = x / z
else if (z <= 3.5d+83) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -820.0) {
tmp = -x;
} else if (z <= -9e-169) {
tmp = x / z;
} else if (z <= -8.2e-262) {
tmp = t_0;
} else if (z <= 4.4e-41) {
tmp = x / z;
} else if (z <= 3.5e+83) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if z <= -820.0: tmp = -x elif z <= -9e-169: tmp = x / z elif z <= -8.2e-262: tmp = t_0 elif z <= 4.4e-41: tmp = x / z elif z <= 3.5e+83: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -820.0) tmp = Float64(-x); elseif (z <= -9e-169) tmp = Float64(x / z); elseif (z <= -8.2e-262) tmp = t_0; elseif (z <= 4.4e-41) tmp = Float64(x / z); elseif (z <= 3.5e+83) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / z); tmp = 0.0; if (z <= -820.0) tmp = -x; elseif (z <= -9e-169) tmp = x / z; elseif (z <= -8.2e-262) tmp = t_0; elseif (z <= 4.4e-41) tmp = x / z; elseif (z <= 3.5e+83) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -820.0], (-x), If[LessEqual[z, -9e-169], N[(x / z), $MachinePrecision], If[LessEqual[z, -8.2e-262], t$95$0, If[LessEqual[z, 4.4e-41], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.5e+83], t$95$0, (-x)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -820:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-169}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-262}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+83}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -820 or 3.49999999999999977e83 < z Initial program 77.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 78.5%
mul-1-neg78.5%
Simplified78.5%
if -820 < z < -8.9999999999999997e-169 or -8.20000000000000052e-262 < z < 4.4e-41Initial program 99.9%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in y around 0 63.9%
associate-/l*63.8%
Simplified63.8%
Taylor expanded in z around 0 62.8%
if -8.9999999999999997e-169 < z < -8.20000000000000052e-262 or 4.4e-41 < z < 3.49999999999999977e83Initial program 97.6%
associate-/l*89.0%
Simplified89.0%
Taylor expanded in y around inf 68.6%
associate-/l*60.0%
Simplified60.0%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+32) (* x (/ y z)) (if (<= y 6.5e+37) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+32) {
tmp = x * (y / z);
} else if (y <= 6.5e+37) {
tmp = (x / 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 <= (-1.05d+32)) then
tmp = x * (y / z)
else if (y <= 6.5d+37) then
tmp = (x / 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 <= -1.05e+32) {
tmp = x * (y / z);
} else if (y <= 6.5e+37) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+32: tmp = x * (y / z) elif y <= 6.5e+37: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+32) tmp = Float64(x * Float64(y / z)); elseif (y <= 6.5e+37) tmp = Float64(Float64(x / 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 <= -1.05e+32) tmp = x * (y / z); elseif (y <= 6.5e+37) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+32], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+37], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+32}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.05e32Initial program 86.7%
associate-/l*95.1%
Simplified95.1%
Taylor expanded in y around inf 78.4%
associate-/l*75.4%
Simplified75.4%
if -1.05e32 < y < 6.4999999999999998e37Initial program 90.8%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 85.9%
associate-/l*95.0%
div-sub95.0%
*-rgt-identity95.0%
associate-*r/94.9%
rgt-mult-inverse95.0%
sub-neg95.0%
metadata-eval95.0%
distribute-rgt-in95.0%
associate-*l/95.1%
*-lft-identity95.1%
neg-mul-195.1%
unsub-neg95.1%
Simplified95.1%
if 6.4999999999999998e37 < y Initial program 91.1%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in y around inf 82.2%
*-commutative82.2%
associate-*r/83.7%
Simplified83.7%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (<= y -5.5e+27) (/ x (/ z y)) (if (<= y 8.8e+36) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+27) {
tmp = x / (z / y);
} else if (y <= 8.8e+36) {
tmp = (x / 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 <= (-5.5d+27)) then
tmp = x / (z / y)
else if (y <= 8.8d+36) then
tmp = (x / 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 <= -5.5e+27) {
tmp = x / (z / y);
} else if (y <= 8.8e+36) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.5e+27: tmp = x / (z / y) elif y <= 8.8e+36: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.5e+27) tmp = Float64(x / Float64(z / y)); elseif (y <= 8.8e+36) tmp = Float64(Float64(x / 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 <= -5.5e+27) tmp = x / (z / y); elseif (y <= 8.8e+36) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+27], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.8e+36], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+36}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -5.49999999999999966e27Initial program 86.7%
associate-/l*95.1%
Simplified95.1%
clear-num95.1%
un-div-inv96.8%
Applied egg-rr96.8%
Taylor expanded in y around inf 77.0%
if -5.49999999999999966e27 < y < 8.80000000000000002e36Initial program 90.8%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 85.9%
associate-/l*95.0%
div-sub95.0%
*-rgt-identity95.0%
associate-*r/94.9%
rgt-mult-inverse95.0%
sub-neg95.0%
metadata-eval95.0%
distribute-rgt-in95.0%
associate-*l/95.1%
*-lft-identity95.1%
neg-mul-195.1%
unsub-neg95.1%
Simplified95.1%
if 8.80000000000000002e36 < y Initial program 91.1%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in y around inf 82.2%
*-commutative82.2%
associate-*r/83.7%
Simplified83.7%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.2e+26) (/ (* x y) z) (if (<= y 2.3e+37) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.2e+26) {
tmp = (x * y) / z;
} else if (y <= 2.3e+37) {
tmp = (x / 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 <= (-2.2d+26)) then
tmp = (x * y) / z
else if (y <= 2.3d+37) then
tmp = (x / 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 <= -2.2e+26) {
tmp = (x * y) / z;
} else if (y <= 2.3e+37) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.2e+26: tmp = (x * y) / z elif y <= 2.3e+37: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.2e+26) tmp = Float64(Float64(x * y) / z); elseif (y <= 2.3e+37) tmp = Float64(Float64(x / 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 <= -2.2e+26) tmp = (x * y) / z; elseif (y <= 2.3e+37) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.2e+26], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 2.3e+37], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.20000000000000007e26Initial program 86.7%
associate-/l*95.1%
Simplified95.1%
Taylor expanded in y around inf 78.4%
if -2.20000000000000007e26 < y < 2.30000000000000002e37Initial program 90.8%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 85.9%
associate-/l*95.0%
div-sub95.0%
*-rgt-identity95.0%
associate-*r/94.9%
rgt-mult-inverse95.0%
sub-neg95.0%
metadata-eval95.0%
distribute-rgt-in95.0%
associate-*l/95.1%
*-lft-identity95.1%
neg-mul-195.1%
unsub-neg95.1%
Simplified95.1%
if 2.30000000000000002e37 < y Initial program 91.1%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in y around inf 82.2%
*-commutative82.2%
associate-*r/83.7%
Simplified83.7%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= x 1.6e-44) (/ (* x t_0) z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 1.6e-44) {
tmp = (x * t_0) / z;
} else {
tmp = x / (z / t_0);
}
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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if (x <= 1.6d-44) then
tmp = (x * t_0) / z
else
tmp = x / (z / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 1.6e-44) {
tmp = (x * t_0) / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if x <= 1.6e-44: tmp = (x * t_0) / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (x <= 1.6e-44) tmp = Float64(Float64(x * t_0) / z); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (x <= 1.6e-44) tmp = (x * t_0) / z; else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, 1.6e-44], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;x \leq 1.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{x \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t\_0}}\\
\end{array}
\end{array}
if x < 1.59999999999999997e-44Initial program 94.0%
if 1.59999999999999997e-44 < x Initial program 77.5%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification95.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -820.0) (not (<= z 0.045))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -820.0) || !(z <= 0.045)) {
tmp = -x;
} 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 ((z <= (-820.0d0)) .or. (.not. (z <= 0.045d0))) then
tmp = -x
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -820.0) || !(z <= 0.045)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -820.0) or not (z <= 0.045): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -820.0) || !(z <= 0.045)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -820.0) || ~((z <= 0.045))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -820.0], N[Not[LessEqual[z, 0.045]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -820 \lor \neg \left(z \leq 0.045\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -820 or 0.044999999999999998 < z Initial program 80.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 71.7%
mul-1-neg71.7%
Simplified71.7%
if -820 < z < 0.044999999999999998Initial program 99.8%
associate-/l*92.4%
Simplified92.4%
Taylor expanded in y around 0 58.0%
associate-/l*57.9%
Simplified57.9%
Taylor expanded in z around 0 57.0%
Final simplification64.4%
(FPCore (x y z) :precision binary64 (/ x (/ z (+ (- y z) 1.0))))
double code(double x, double y, double z) {
return x / (z / ((y - z) + 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 = x / (z / ((y - z) + 1.0d0))
end function
public static double code(double x, double y, double z) {
return x / (z / ((y - z) + 1.0));
}
def code(x, y, z): return x / (z / ((y - z) + 1.0))
function code(x, y, z) return Float64(x / Float64(z / Float64(Float64(y - z) + 1.0))) end
function tmp = code(x, y, z) tmp = x / (z / ((y - z) + 1.0)); end
code[x_, y_, z_] := N[(x / N[(z / N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{\left(y - z\right) + 1}}
\end{array}
Initial program 89.9%
associate-/l*96.1%
Simplified96.1%
clear-num96.1%
un-div-inv97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -x
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 89.9%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around inf 37.8%
mul-1-neg37.8%
Simplified37.8%
Final simplification37.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 89.9%
Taylor expanded in z around inf 30.4%
associate-*r*30.4%
mul-1-neg30.4%
Simplified30.4%
associate-/l*37.8%
*-inverses37.8%
*-commutative37.8%
neg-sub037.8%
*-un-lft-identity37.8%
sub-neg37.8%
add-sqr-sqrt16.9%
sqrt-unprod15.7%
sqr-neg15.7%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
+-lft-identity3.1%
Simplified3.1%
Final simplification3.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024067
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))