
(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 13 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 (- 1.0 z))) (t_1 (/ x (/ z t_0)))) (if (<= z -5e-14) t_1 (if (<= z 3e-35) (* t_0 (/ x z)) t_1))))
double code(double x, double y, double z) {
double t_0 = y + (1.0 - z);
double t_1 = x / (z / t_0);
double tmp;
if (z <= -5e-14) {
tmp = t_1;
} else if (z <= 3e-35) {
tmp = t_0 * (x / z);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y + (1.0d0 - z)
t_1 = x / (z / t_0)
if (z <= (-5d-14)) then
tmp = t_1
else if (z <= 3d-35) then
tmp = t_0 * (x / z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y + (1.0 - z);
double t_1 = x / (z / t_0);
double tmp;
if (z <= -5e-14) {
tmp = t_1;
} else if (z <= 3e-35) {
tmp = t_0 * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y + (1.0 - z) t_1 = x / (z / t_0) tmp = 0 if z <= -5e-14: tmp = t_1 elif z <= 3e-35: tmp = t_0 * (x / z) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y + Float64(1.0 - z)) t_1 = Float64(x / Float64(z / t_0)) tmp = 0.0 if (z <= -5e-14) tmp = t_1; elseif (z <= 3e-35) tmp = Float64(t_0 * Float64(x / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y + (1.0 - z); t_1 = x / (z / t_0); tmp = 0.0; if (z <= -5e-14) tmp = t_1; elseif (z <= 3e-35) tmp = t_0 * (x / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e-14], t$95$1, If[LessEqual[z, 3e-35], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(1 - z\right)\\
t_1 := \frac{x}{\frac{z}{t\_0}}\\
\mathbf{if}\;z \leq -5 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-35}:\\
\;\;\;\;t\_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.0000000000000002e-14 or 2.99999999999999989e-35 < z Initial program 78.8%
Applied egg-rr0
if -5.0000000000000002e-14 < z < 2.99999999999999989e-35Initial program 99.8%
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ x z) y)))
(if (<= z -7.2e+38)
(- x)
(if (<= z -1.15e-59)
(* x (/ y z))
(if (<= z 6.2e-262)
(/ x z)
(if (<= z 4.3e-202)
t_0
(if (<= z 2.3e-71)
(/ x z)
(if (<= z 6000000000000.0) t_0 (- x)))))))))
double code(double x, double y, double z) {
double t_0 = (x / z) * y;
double tmp;
if (z <= -7.2e+38) {
tmp = -x;
} else if (z <= -1.15e-59) {
tmp = x * (y / z);
} else if (z <= 6.2e-262) {
tmp = x / z;
} else if (z <= 4.3e-202) {
tmp = t_0;
} else if (z <= 2.3e-71) {
tmp = x / z;
} else if (z <= 6000000000000.0) {
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 / z) * y
if (z <= (-7.2d+38)) then
tmp = -x
else if (z <= (-1.15d-59)) then
tmp = x * (y / z)
else if (z <= 6.2d-262) then
tmp = x / z
else if (z <= 4.3d-202) then
tmp = t_0
else if (z <= 2.3d-71) then
tmp = x / z
else if (z <= 6000000000000.0d0) 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 / z) * y;
double tmp;
if (z <= -7.2e+38) {
tmp = -x;
} else if (z <= -1.15e-59) {
tmp = x * (y / z);
} else if (z <= 6.2e-262) {
tmp = x / z;
} else if (z <= 4.3e-202) {
tmp = t_0;
} else if (z <= 2.3e-71) {
tmp = x / z;
} else if (z <= 6000000000000.0) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = (x / z) * y tmp = 0 if z <= -7.2e+38: tmp = -x elif z <= -1.15e-59: tmp = x * (y / z) elif z <= 6.2e-262: tmp = x / z elif z <= 4.3e-202: tmp = t_0 elif z <= 2.3e-71: tmp = x / z elif z <= 6000000000000.0: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(Float64(x / z) * y) tmp = 0.0 if (z <= -7.2e+38) tmp = Float64(-x); elseif (z <= -1.15e-59) tmp = Float64(x * Float64(y / z)); elseif (z <= 6.2e-262) tmp = Float64(x / z); elseif (z <= 4.3e-202) tmp = t_0; elseif (z <= 2.3e-71) tmp = Float64(x / z); elseif (z <= 6000000000000.0) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / z) * y; tmp = 0.0; if (z <= -7.2e+38) tmp = -x; elseif (z <= -1.15e-59) tmp = x * (y / z); elseif (z <= 6.2e-262) tmp = x / z; elseif (z <= 4.3e-202) tmp = t_0; elseif (z <= 2.3e-71) tmp = x / z; elseif (z <= 6000000000000.0) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -7.2e+38], (-x), If[LessEqual[z, -1.15e-59], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e-262], N[(x / z), $MachinePrecision], If[LessEqual[z, 4.3e-202], t$95$0, If[LessEqual[z, 2.3e-71], N[(x / z), $MachinePrecision], If[LessEqual[z, 6000000000000.0], t$95$0, (-x)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{z} \cdot y\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+38}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-262}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 6000000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -7.19999999999999938e38 or 6e12 < z Initial program 74.7%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if -7.19999999999999938e38 < z < -1.1499999999999999e-59Initial program 99.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1.1499999999999999e-59 < z < 6.1999999999999997e-262 or 4.29999999999999993e-202 < z < 2.2999999999999998e-71Initial program 99.8%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in z around 0 0
Simplified0
if 6.1999999999999997e-262 < z < 4.29999999999999993e-202 or 2.2999999999999998e-71 < z < 6e12Initial program 99.8%
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= z -9.6e+38)
(- x)
(if (<= z -4.2e-59)
t_0
(if (<= z 2.1e-71) (/ x z) (if (<= z 3.8e+16) t_0 (- x)))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -9.6e+38) {
tmp = -x;
} else if (z <= -4.2e-59) {
tmp = t_0;
} else if (z <= 2.1e-71) {
tmp = x / z;
} else if (z <= 3.8e+16) {
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 <= (-9.6d+38)) then
tmp = -x
else if (z <= (-4.2d-59)) then
tmp = t_0
else if (z <= 2.1d-71) then
tmp = x / z
else if (z <= 3.8d+16) 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 <= -9.6e+38) {
tmp = -x;
} else if (z <= -4.2e-59) {
tmp = t_0;
} else if (z <= 2.1e-71) {
tmp = x / z;
} else if (z <= 3.8e+16) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if z <= -9.6e+38: tmp = -x elif z <= -4.2e-59: tmp = t_0 elif z <= 2.1e-71: tmp = x / z elif z <= 3.8e+16: 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 <= -9.6e+38) tmp = Float64(-x); elseif (z <= -4.2e-59) tmp = t_0; elseif (z <= 2.1e-71) tmp = Float64(x / z); elseif (z <= 3.8e+16) 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 <= -9.6e+38) tmp = -x; elseif (z <= -4.2e-59) tmp = t_0; elseif (z <= 2.1e-71) tmp = x / z; elseif (z <= 3.8e+16) 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, -9.6e+38], (-x), If[LessEqual[z, -4.2e-59], t$95$0, If[LessEqual[z, 2.1e-71], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.8e+16], t$95$0, (-x)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+38}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -9.60000000000000069e38 or 3.8e16 < z Initial program 74.7%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if -9.60000000000000069e38 < z < -4.19999999999999993e-59 or 2.1000000000000001e-71 < z < 3.8e16Initial program 99.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -4.19999999999999993e-59 < z < 2.1000000000000001e-71Initial program 99.8%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in z around 0 0
Simplified0
(FPCore (x y z)
:precision binary64
(if (<= z -3.6e-12)
(* x (+ -1.0 (/ (+ y 1.0) z)))
(if (<= z 6500000000.0)
(* (+ y (- 1.0 z)) (/ x z))
(* x (+ -1.0 (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.6e-12) {
tmp = x * (-1.0 + ((y + 1.0) / z));
} else if (z <= 6500000000.0) {
tmp = (y + (1.0 - z)) * (x / z);
} else {
tmp = x * (-1.0 + (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 <= (-3.6d-12)) then
tmp = x * ((-1.0d0) + ((y + 1.0d0) / z))
else if (z <= 6500000000.0d0) then
tmp = (y + (1.0d0 - z)) * (x / z)
else
tmp = x * ((-1.0d0) + (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.6e-12) {
tmp = x * (-1.0 + ((y + 1.0) / z));
} else if (z <= 6500000000.0) {
tmp = (y + (1.0 - z)) * (x / z);
} else {
tmp = x * (-1.0 + (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.6e-12: tmp = x * (-1.0 + ((y + 1.0) / z)) elif z <= 6500000000.0: tmp = (y + (1.0 - z)) * (x / z) else: tmp = x * (-1.0 + (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.6e-12) tmp = Float64(x * Float64(-1.0 + Float64(Float64(y + 1.0) / z))); elseif (z <= 6500000000.0) tmp = Float64(Float64(y + Float64(1.0 - z)) * Float64(x / z)); else tmp = Float64(x * Float64(-1.0 + Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.6e-12) tmp = x * (-1.0 + ((y + 1.0) / z)); elseif (z <= 6500000000.0) tmp = (y + (1.0 - z)) * (x / z); else tmp = x * (-1.0 + (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.6e-12], N[(x * N[(-1.0 + N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6500000000.0], N[(N[(y + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(-1 + \frac{y + 1}{z}\right)\\
\mathbf{elif}\;z \leq 6500000000:\\
\;\;\;\;\left(y + \left(1 - z\right)\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -3.6e-12Initial program 79.0%
Simplified0
if -3.6e-12 < z < 6.5e9Initial program 99.8%
Applied egg-rr0
if 6.5e9 < z Initial program 76.5%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (+ -1.0 (/ (+ y 1.0) z))))) (if (<= z -1.16e-15) t_0 (if (<= z 3e-47) (* (/ x z) (+ y 1.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + ((y + 1.0) / z));
double tmp;
if (z <= -1.16e-15) {
tmp = t_0;
} else if (z <= 3e-47) {
tmp = (x / z) * (y + 1.0);
} 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 = x * ((-1.0d0) + ((y + 1.0d0) / z))
if (z <= (-1.16d-15)) then
tmp = t_0
else if (z <= 3d-47) then
tmp = (x / z) * (y + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-1.0 + ((y + 1.0) / z));
double tmp;
if (z <= -1.16e-15) {
tmp = t_0;
} else if (z <= 3e-47) {
tmp = (x / z) * (y + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + ((y + 1.0) / z)) tmp = 0 if z <= -1.16e-15: tmp = t_0 elif z <= 3e-47: tmp = (x / z) * (y + 1.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(Float64(y + 1.0) / z))) tmp = 0.0 if (z <= -1.16e-15) tmp = t_0; elseif (z <= 3e-47) tmp = Float64(Float64(x / z) * Float64(y + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + ((y + 1.0) / z)); tmp = 0.0; if (z <= -1.16e-15) tmp = t_0; elseif (z <= 3e-47) tmp = (x / z) * (y + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-1.0 + N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.16e-15], t$95$0, If[LessEqual[z, 3e-47], N[(N[(x / z), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y + 1}{z}\right)\\
\mathbf{if}\;z \leq -1.16 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-47}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.1599999999999999e-15 or 3.00000000000000017e-47 < z Initial program 79.3%
Simplified0
if -1.1599999999999999e-15 < z < 3.00000000000000017e-47Initial program 99.8%
Simplified0
Taylor expanded in z around 0 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (+ -1.0 (/ y z))))) (if (<= z -1.0) t_0 (if (<= z 1e-20) (* (/ x z) (+ y 1.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1e-20) {
tmp = (x / z) * (y + 1.0);
} 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 = x * ((-1.0d0) + (y / z))
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= 1d-20) then
tmp = (x / z) * (y + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1e-20) {
tmp = (x / z) * (y + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + (y / z)) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= 1e-20: tmp = (x / z) * (y + 1.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= 1e-20) tmp = Float64(Float64(x / z) * Float64(y + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + (y / z)); tmp = 0.0; if (z <= -1.0) tmp = t_0; elseif (z <= 1e-20) tmp = (x / z) * (y + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, 1e-20], N[(N[(x / z), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 10^{-20}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1 or 9.99999999999999945e-21 < z Initial program 77.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1 < z < 9.99999999999999945e-21Initial program 99.8%
Simplified0
Taylor expanded in z around 0 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (+ -1.0 (/ y z))))) (if (<= z -1.0) t_0 (if (<= z 1e-20) (* x (/ (+ 1.0 y) z)) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1e-20) {
tmp = x * ((1.0 + y) / 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 = x * ((-1.0d0) + (y / z))
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= 1d-20) then
tmp = x * ((1.0d0 + y) / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 1e-20) {
tmp = x * ((1.0 + y) / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + (y / z)) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= 1e-20: tmp = x * ((1.0 + y) / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= 1e-20) tmp = Float64(x * Float64(Float64(1.0 + y) / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + (y / z)); tmp = 0.0; if (z <= -1.0) tmp = t_0; elseif (z <= 1e-20) tmp = x * ((1.0 + y) / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, 1e-20], N[(x * N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 10^{-20}:\\
\;\;\;\;x \cdot \frac{1 + y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1 or 9.99999999999999945e-21 < z Initial program 77.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1 < z < 9.99999999999999945e-21Initial program 99.8%
Simplified0
Taylor expanded in z around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (+ -1.0 (/ y z))))) (if (<= y -2020.0) t_0 (if (<= y 9.8e-13) (- (/ x z) x) t_0))))
double code(double x, double y, double z) {
double t_0 = x * (-1.0 + (y / z));
double tmp;
if (y <= -2020.0) {
tmp = t_0;
} else if (y <= 9.8e-13) {
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 = x * ((-1.0d0) + (y / z))
if (y <= (-2020.0d0)) then
tmp = t_0
else if (y <= 9.8d-13) 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 = x * (-1.0 + (y / z));
double tmp;
if (y <= -2020.0) {
tmp = t_0;
} else if (y <= 9.8e-13) {
tmp = (x / z) - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-1.0 + (y / z)) tmp = 0 if y <= -2020.0: tmp = t_0 elif y <= 9.8e-13: tmp = (x / z) - x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-1.0 + Float64(y / z))) tmp = 0.0 if (y <= -2020.0) tmp = t_0; elseif (y <= 9.8e-13) tmp = Float64(Float64(x / z) - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-1.0 + (y / z)); tmp = 0.0; if (y <= -2020.0) tmp = t_0; elseif (y <= 9.8e-13) tmp = (x / z) - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2020.0], t$95$0, If[LessEqual[y, 9.8e-13], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;y \leq -2020:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2020 or 9.80000000000000065e-13 < y Initial program 88.7%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -2020 < y < 9.80000000000000065e-13Initial program 89.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+47) (/ (* x y) z) (if (<= y 1.9e+29) (- (/ x z) x) (* (/ x z) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+47) {
tmp = (x * y) / z;
} else if (y <= 1.9e+29) {
tmp = (x / z) - x;
} 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 <= (-1.15d+47)) then
tmp = (x * y) / z
else if (y <= 1.9d+29) then
tmp = (x / z) - x
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 <= -1.15e+47) {
tmp = (x * y) / z;
} else if (y <= 1.9e+29) {
tmp = (x / z) - x;
} else {
tmp = (x / z) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+47: tmp = (x * y) / z elif y <= 1.9e+29: tmp = (x / z) - x else: tmp = (x / z) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+47) tmp = Float64(Float64(x * y) / z); elseif (y <= 1.9e+29) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x / z) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.15e+47) tmp = (x * y) / z; elseif (y <= 1.9e+29) tmp = (x / z) - x; else tmp = (x / z) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+47], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.9e+29], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+47}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array}
\end{array}
if y < -1.1499999999999999e47Initial program 91.1%
Simplified0
Taylor expanded in y around inf 0
Simplified0
if -1.1499999999999999e47 < y < 1.89999999999999985e29Initial program 88.3%
Simplified0
Taylor expanded in y around 0 0
Simplified0
if 1.89999999999999985e29 < y Initial program 87.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (/ x z) y))) (if (<= y -1620000.0) t_0 (if (<= y 1.05e+29) (- (/ x z) x) t_0))))
double code(double x, double y, double z) {
double t_0 = (x / z) * y;
double tmp;
if (y <= -1620000.0) {
tmp = t_0;
} else if (y <= 1.05e+29) {
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 = (x / z) * y
if (y <= (-1620000.0d0)) then
tmp = t_0
else if (y <= 1.05d+29) 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 = (x / z) * y;
double tmp;
if (y <= -1620000.0) {
tmp = t_0;
} else if (y <= 1.05e+29) {
tmp = (x / z) - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x / z) * y tmp = 0 if y <= -1620000.0: tmp = t_0 elif y <= 1.05e+29: tmp = (x / z) - x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x / z) * y) tmp = 0.0 if (y <= -1620000.0) tmp = t_0; elseif (y <= 1.05e+29) tmp = Float64(Float64(x / z) - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / z) * y; tmp = 0.0; if (y <= -1620000.0) tmp = t_0; elseif (y <= 1.05e+29) tmp = (x / z) - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1620000.0], t$95$0, If[LessEqual[y, 1.05e+29], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{z} \cdot y\\
\mathbf{if}\;y \leq -1620000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.62e6 or 1.0500000000000001e29 < y Initial program 88.9%
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
if -1.62e6 < y < 1.0500000000000001e29Initial program 88.8%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= x 2e-114) (/ (* x (+ (- y z) 1.0)) z) (/ x (/ z (+ y (- 1.0 z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e-114) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x / (z / (y + (1.0 - 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 <= 2d-114) then
tmp = (x * ((y - z) + 1.0d0)) / z
else
tmp = x / (z / (y + (1.0d0 - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e-114) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x / (z / (y + (1.0 - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2e-114: tmp = (x * ((y - z) + 1.0)) / z else: tmp = x / (z / (y + (1.0 - z))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2e-114) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(x / Float64(z / Float64(y + Float64(1.0 - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e-114) tmp = (x * ((y - z) + 1.0)) / z; else tmp = x / (z / (y + (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2e-114], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / N[(y + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-114}:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + \left(1 - z\right)}}\\
\end{array}
\end{array}
if x < 2.0000000000000001e-114Initial program 92.0%
if 2.0000000000000001e-114 < x Initial program 82.6%
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (- x) (if (<= z 200000000000.0) (/ x z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= 200000000000.0) {
tmp = x / 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.0d0)) then
tmp = -x
else if (z <= 200000000000.0d0) then
tmp = x / 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.0) {
tmp = -x;
} else if (z <= 200000000000.0) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = -x elif z <= 200000000000.0: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(-x); elseif (z <= 200000000000.0) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = -x; elseif (z <= 200000000000.0) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], (-x), If[LessEqual[z, 200000000000.0], N[(x / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 200000000000:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1 or 2e11 < z Initial program 76.8%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if -1 < z < 2e11Initial program 99.8%
Simplified0
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in z around 0 0
Simplified0
(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 88.8%
Simplified0
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
(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 2024110
(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))