
(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
(let* ((t_0 (+ (- y z) 1.0)))
(if (or (<= z -4.8e+25) (not (<= z 3400.0)))
(* x (/ t_0 z))
(* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if ((z <= -4.8e+25) || !(z <= 3400.0)) {
tmp = x * (t_0 / z);
} else {
tmp = t_0 * (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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if ((z <= (-4.8d+25)) .or. (.not. (z <= 3400.0d0))) then
tmp = x * (t_0 / z)
else
tmp = t_0 * (x / z)
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 ((z <= -4.8e+25) || !(z <= 3400.0)) {
tmp = x * (t_0 / z);
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if (z <= -4.8e+25) or not (z <= 3400.0): tmp = x * (t_0 / z) else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if ((z <= -4.8e+25) || !(z <= 3400.0)) tmp = Float64(x * Float64(t_0 / z)); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if ((z <= -4.8e+25) || ~((z <= 3400.0))) tmp = x * (t_0 / z); else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[Or[LessEqual[z, -4.8e+25], N[Not[LessEqual[z, 3400.0]], $MachinePrecision]], N[(x * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+25} \lor \neg \left(z \leq 3400\right):\\
\;\;\;\;x \cdot \frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -4.79999999999999992e25 or 3400 < z Initial program 76.8%
associate-/l*99.9%
Simplified99.9%
if -4.79999999999999992e25 < z < 3400Initial program 99.2%
*-commutative99.2%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.4e+32)
(- x)
(if (<= z 8e-65)
(* y (/ x z))
(if (<= z 1.9e-13) (/ x z) (if (<= z 1.9e+51) (* x (/ y z)) (- x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.4e+32) {
tmp = -x;
} else if (z <= 8e-65) {
tmp = y * (x / z);
} else if (z <= 1.9e-13) {
tmp = x / z;
} else if (z <= 1.9e+51) {
tmp = x * (y / z);
} 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) :: tmp
if (z <= (-1.4d+32)) then
tmp = -x
else if (z <= 8d-65) then
tmp = y * (x / z)
else if (z <= 1.9d-13) then
tmp = x / z
else if (z <= 1.9d+51) then
tmp = x * (y / z)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.4e+32) {
tmp = -x;
} else if (z <= 8e-65) {
tmp = y * (x / z);
} else if (z <= 1.9e-13) {
tmp = x / z;
} else if (z <= 1.9e+51) {
tmp = x * (y / z);
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.4e+32: tmp = -x elif z <= 8e-65: tmp = y * (x / z) elif z <= 1.9e-13: tmp = x / z elif z <= 1.9e+51: tmp = x * (y / z) else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.4e+32) tmp = Float64(-x); elseif (z <= 8e-65) tmp = Float64(y * Float64(x / z)); elseif (z <= 1.9e-13) tmp = Float64(x / z); elseif (z <= 1.9e+51) tmp = Float64(x * Float64(y / z)); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.4e+32) tmp = -x; elseif (z <= 8e-65) tmp = y * (x / z); elseif (z <= 1.9e-13) tmp = x / z; elseif (z <= 1.9e+51) tmp = x * (y / z); else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.4e+32], (-x), If[LessEqual[z, 8e-65], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e-13], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.9e+51], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+32}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-65}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1.4e32 or 1.8999999999999999e51 < z Initial program 75.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
neg-mul-180.7%
Simplified80.7%
if -1.4e32 < z < 7.99999999999999939e-65Initial program 98.3%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
associate-/l*63.4%
Applied egg-rr63.4%
if 7.99999999999999939e-65 < z < 1.9e-13Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in z around 0 99.4%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in y around 0 74.0%
if 1.9e-13 < z < 1.8999999999999999e51Initial program 99.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 60.6%
associate-/l*60.7%
Simplified60.7%
Final simplification71.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -1.62e+78)
t_0
(if (<= y -2.9e+42)
(- x)
(if (<= y -225000.0)
(* x (/ y z))
(if (<= y 1.15e+50) (- (/ x z) x) t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -1.62e+78) {
tmp = t_0;
} else if (y <= -2.9e+42) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = x * (y / z);
} else if (y <= 1.15e+50) {
tmp = (x / z) - x;
} 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 = y * (x / z)
if (y <= (-1.62d+78)) then
tmp = t_0
else if (y <= (-2.9d+42)) then
tmp = -x
else if (y <= (-225000.0d0)) then
tmp = x * (y / z)
else if (y <= 1.15d+50) then
tmp = (x / z) - x
else
tmp = t_0
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 (y <= -1.62e+78) {
tmp = t_0;
} else if (y <= -2.9e+42) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = x * (y / z);
} else if (y <= 1.15e+50) {
tmp = (x / z) - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -1.62e+78: tmp = t_0 elif y <= -2.9e+42: tmp = -x elif y <= -225000.0: tmp = x * (y / z) elif y <= 1.15e+50: tmp = (x / z) - x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -1.62e+78) tmp = t_0; elseif (y <= -2.9e+42) tmp = Float64(-x); elseif (y <= -225000.0) tmp = Float64(x * Float64(y / z)); elseif (y <= 1.15e+50) tmp = Float64(Float64(x / z) - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -1.62e+78) tmp = t_0; elseif (y <= -2.9e+42) tmp = -x; elseif (y <= -225000.0) tmp = x * (y / z); elseif (y <= 1.15e+50) tmp = (x / z) - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.62e+78], t$95$0, If[LessEqual[y, -2.9e+42], (-x), If[LessEqual[y, -225000.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e+50], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -1.62 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{+42}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -225000:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.6199999999999999e78 or 1.14999999999999998e50 < y Initial program 88.1%
associate-/l*92.5%
Simplified92.5%
Taylor expanded in y around inf 74.9%
*-commutative74.9%
associate-/l*77.7%
Applied egg-rr77.7%
if -1.6199999999999999e78 < y < -2.89999999999999981e42Initial program 72.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -2.89999999999999981e42 < y < -225000Initial program 99.5%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 70.8%
associate-/l*70.8%
Simplified70.8%
if -225000 < y < 1.14999999999999998e50Initial program 87.8%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 84.6%
Taylor expanded in z around 0 96.8%
neg-mul-196.8%
+-commutative96.8%
unsub-neg96.8%
Simplified96.8%
Final simplification88.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -1.7e+78)
t_0
(if (<= y -1.05e+42)
(- x)
(if (<= y -225000.0)
(/ y (/ z x))
(if (<= y 1.14e+49) (- (/ x z) x) t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -1.7e+78) {
tmp = t_0;
} else if (y <= -1.05e+42) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = y / (z / x);
} else if (y <= 1.14e+49) {
tmp = (x / z) - x;
} 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 = y * (x / z)
if (y <= (-1.7d+78)) then
tmp = t_0
else if (y <= (-1.05d+42)) then
tmp = -x
else if (y <= (-225000.0d0)) then
tmp = y / (z / x)
else if (y <= 1.14d+49) then
tmp = (x / z) - x
else
tmp = t_0
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 (y <= -1.7e+78) {
tmp = t_0;
} else if (y <= -1.05e+42) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = y / (z / x);
} else if (y <= 1.14e+49) {
tmp = (x / z) - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -1.7e+78: tmp = t_0 elif y <= -1.05e+42: tmp = -x elif y <= -225000.0: tmp = y / (z / x) elif y <= 1.14e+49: tmp = (x / z) - x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -1.7e+78) tmp = t_0; elseif (y <= -1.05e+42) tmp = Float64(-x); elseif (y <= -225000.0) tmp = Float64(y / Float64(z / x)); elseif (y <= 1.14e+49) tmp = Float64(Float64(x / z) - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -1.7e+78) tmp = t_0; elseif (y <= -1.05e+42) tmp = -x; elseif (y <= -225000.0) tmp = y / (z / x); elseif (y <= 1.14e+49) tmp = (x / z) - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+78], t$95$0, If[LessEqual[y, -1.05e+42], (-x), If[LessEqual[y, -225000.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.14e+49], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{+42}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -225000:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 1.14 \cdot 10^{+49}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.70000000000000004e78 or 1.13999999999999994e49 < y Initial program 88.1%
associate-/l*92.5%
Simplified92.5%
Taylor expanded in y around inf 74.9%
*-commutative74.9%
associate-/l*77.7%
Applied egg-rr77.7%
if -1.70000000000000004e78 < y < -1.04999999999999998e42Initial program 72.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -1.04999999999999998e42 < y < -225000Initial program 99.5%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 70.8%
*-commutative70.8%
associate-/l*70.8%
Applied egg-rr70.8%
clear-num70.8%
un-div-inv70.8%
Applied egg-rr70.8%
if -225000 < y < 1.13999999999999994e49Initial program 87.8%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 84.6%
Taylor expanded in z around 0 96.8%
neg-mul-196.8%
+-commutative96.8%
unsub-neg96.8%
Simplified96.8%
Final simplification88.5%
(FPCore (x y z)
:precision binary64
(if (<= y -4.5e+79)
(/ (* x y) z)
(if (<= y -4.6e+41)
(- x)
(if (<= y -225000.0)
(/ y (/ z x))
(if (<= y 2.65e+45) (- (/ x z) x) (* y (/ x z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+79) {
tmp = (x * y) / z;
} else if (y <= -4.6e+41) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = y / (z / x);
} else if (y <= 2.65e+45) {
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 <= (-4.5d+79)) then
tmp = (x * y) / z
else if (y <= (-4.6d+41)) then
tmp = -x
else if (y <= (-225000.0d0)) then
tmp = y / (z / x)
else if (y <= 2.65d+45) 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 <= -4.5e+79) {
tmp = (x * y) / z;
} else if (y <= -4.6e+41) {
tmp = -x;
} else if (y <= -225000.0) {
tmp = y / (z / x);
} else if (y <= 2.65e+45) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.5e+79: tmp = (x * y) / z elif y <= -4.6e+41: tmp = -x elif y <= -225000.0: tmp = y / (z / x) elif y <= 2.65e+45: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.5e+79) tmp = Float64(Float64(x * y) / z); elseif (y <= -4.6e+41) tmp = Float64(-x); elseif (y <= -225000.0) tmp = Float64(y / Float64(z / x)); elseif (y <= 2.65e+45) 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 <= -4.5e+79) tmp = (x * y) / z; elseif (y <= -4.6e+41) tmp = -x; elseif (y <= -225000.0) tmp = y / (z / x); elseif (y <= 2.65e+45) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+79], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, -4.6e+41], (-x), If[LessEqual[y, -225000.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+45], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+79}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{+41}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -225000:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -4.49999999999999994e79Initial program 91.5%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in y around inf 79.9%
if -4.49999999999999994e79 < y < -4.5999999999999997e41Initial program 72.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -4.5999999999999997e41 < y < -225000Initial program 99.5%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 70.8%
*-commutative70.8%
associate-/l*70.8%
Applied egg-rr70.8%
clear-num70.8%
un-div-inv70.8%
Applied egg-rr70.8%
if -225000 < y < 2.64999999999999996e45Initial program 87.8%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 84.6%
Taylor expanded in z around 0 96.8%
neg-mul-196.8%
+-commutative96.8%
unsub-neg96.8%
Simplified96.8%
if 2.64999999999999996e45 < y Initial program 84.1%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in y around inf 68.8%
*-commutative68.8%
associate-/l*76.7%
Applied egg-rr76.7%
Final simplification88.8%
(FPCore (x y z)
:precision binary64
(if (<= y -8.6e+78)
(/ (* x y) z)
(if (<= y -6.2e+42)
(- x)
(if (<= y -320.0)
(* x (/ (+ y 1.0) z))
(if (<= y 1.05e+45) (- (/ x z) x) (* y (/ x z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.6e+78) {
tmp = (x * y) / z;
} else if (y <= -6.2e+42) {
tmp = -x;
} else if (y <= -320.0) {
tmp = x * ((y + 1.0) / z);
} else if (y <= 1.05e+45) {
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 <= (-8.6d+78)) then
tmp = (x * y) / z
else if (y <= (-6.2d+42)) then
tmp = -x
else if (y <= (-320.0d0)) then
tmp = x * ((y + 1.0d0) / z)
else if (y <= 1.05d+45) 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 <= -8.6e+78) {
tmp = (x * y) / z;
} else if (y <= -6.2e+42) {
tmp = -x;
} else if (y <= -320.0) {
tmp = x * ((y + 1.0) / z);
} else if (y <= 1.05e+45) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.6e+78: tmp = (x * y) / z elif y <= -6.2e+42: tmp = -x elif y <= -320.0: tmp = x * ((y + 1.0) / z) elif y <= 1.05e+45: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.6e+78) tmp = Float64(Float64(x * y) / z); elseif (y <= -6.2e+42) tmp = Float64(-x); elseif (y <= -320.0) tmp = Float64(x * Float64(Float64(y + 1.0) / z)); elseif (y <= 1.05e+45) 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 <= -8.6e+78) tmp = (x * y) / z; elseif (y <= -6.2e+42) tmp = -x; elseif (y <= -320.0) tmp = x * ((y + 1.0) / z); elseif (y <= 1.05e+45) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.6e+78], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, -6.2e+42], (-x), If[LessEqual[y, -320.0], N[(x * N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+45], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+78}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{+42}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -320:\\
\;\;\;\;x \cdot \frac{y + 1}{z}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -8.59999999999999962e78Initial program 91.5%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in y around inf 79.9%
if -8.59999999999999962e78 < y < -6.2000000000000003e42Initial program 72.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -6.2000000000000003e42 < y < -320Initial program 99.4%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around 0 80.9%
associate-/l*81.5%
Simplified81.5%
if -320 < y < 1.04999999999999997e45Initial program 87.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 85.1%
Taylor expanded in z around 0 97.4%
neg-mul-197.4%
+-commutative97.4%
unsub-neg97.4%
Simplified97.4%
if 1.04999999999999997e45 < y Initial program 84.1%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in y around inf 68.8%
*-commutative68.8%
associate-/l*76.7%
Applied egg-rr76.7%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= z -880000.0) (- x) (if (<= z 1.25e-14) (/ x z) (if (<= z 1.25e+50) (* x (/ y z)) (- x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -880000.0) {
tmp = -x;
} else if (z <= 1.25e-14) {
tmp = x / z;
} else if (z <= 1.25e+50) {
tmp = x * (y / z);
} 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) :: tmp
if (z <= (-880000.0d0)) then
tmp = -x
else if (z <= 1.25d-14) then
tmp = x / z
else if (z <= 1.25d+50) then
tmp = x * (y / z)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -880000.0) {
tmp = -x;
} else if (z <= 1.25e-14) {
tmp = x / z;
} else if (z <= 1.25e+50) {
tmp = x * (y / z);
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -880000.0: tmp = -x elif z <= 1.25e-14: tmp = x / z elif z <= 1.25e+50: tmp = x * (y / z) else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -880000.0) tmp = Float64(-x); elseif (z <= 1.25e-14) tmp = Float64(x / z); elseif (z <= 1.25e+50) tmp = Float64(x * Float64(y / z)); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -880000.0) tmp = -x; elseif (z <= 1.25e-14) tmp = x / z; elseif (z <= 1.25e+50) tmp = x * (y / z); else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -880000.0], (-x), If[LessEqual[z, 1.25e-14], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.25e+50], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], (-x)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -880000:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+50}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -8.8e5 or 1.25e50 < z Initial program 75.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 77.7%
neg-mul-177.7%
Simplified77.7%
if -8.8e5 < z < 1.25e-14Initial program 99.9%
associate-/l*92.4%
Simplified92.4%
Taylor expanded in z around 0 99.7%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in y around 0 53.2%
if 1.25e-14 < z < 1.25e50Initial program 99.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 60.6%
associate-/l*60.7%
Simplified60.7%
Final simplification65.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= x 5.4e-49) (/ (* x t_0) z) (* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 5.4e-49) {
tmp = (x * t_0) / z;
} else {
tmp = t_0 * (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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if (x <= 5.4d-49) then
tmp = (x * t_0) / z
else
tmp = t_0 * (x / z)
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 <= 5.4e-49) {
tmp = (x * t_0) / z;
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if x <= 5.4e-49: tmp = (x * t_0) / z else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (x <= 5.4e-49) tmp = Float64(Float64(x * t_0) / z); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (x <= 5.4e-49) tmp = (x * t_0) / z; else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, 5.4e-49], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;x \leq 5.4 \cdot 10^{-49}:\\
\;\;\;\;\frac{x \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if x < 5.3999999999999999e-49Initial program 91.9%
if 5.3999999999999999e-49 < x Initial program 78.6%
*-commutative78.6%
associate-/l*99.9%
Simplified99.9%
Final simplification94.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -880000.0) (not (<= z 1.04e-10))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -880000.0) || !(z <= 1.04e-10)) {
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 <= (-880000.0d0)) .or. (.not. (z <= 1.04d-10))) 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 <= -880000.0) || !(z <= 1.04e-10)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -880000.0) or not (z <= 1.04e-10): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -880000.0) || !(z <= 1.04e-10)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -880000.0) || ~((z <= 1.04e-10))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -880000.0], N[Not[LessEqual[z, 1.04e-10]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -880000 \lor \neg \left(z \leq 1.04 \cdot 10^{-10}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -8.8e5 or 1.04e-10 < z Initial program 77.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 73.5%
neg-mul-173.5%
Simplified73.5%
if -8.8e5 < z < 1.04e-10Initial program 99.9%
associate-/l*92.5%
Simplified92.5%
Taylor expanded in z around 0 99.7%
associate-/l*92.4%
Simplified92.4%
Taylor expanded in y around 0 52.3%
Final simplification63.9%
(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(x * Float64(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[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{\left(y - z\right) + 1}{z}
\end{array}
Initial program 87.8%
associate-/l*96.6%
Simplified96.6%
Final simplification96.6%
(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 87.8%
associate-/l*96.6%
Simplified96.6%
clear-num96.5%
un-div-inv96.8%
Applied egg-rr96.8%
Final simplification96.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 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 87.8%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in z around inf 41.6%
neg-mul-141.6%
Simplified41.6%
Final simplification41.6%
(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 2024048
(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))