
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Initial program 98.3%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ (- x y) z))) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= y -1.15e+41)
t_2
(if (<= y 8.2e-215)
t_1
(if (<= y 1.25e-74) (* t (/ x (- z y))) (if (<= y 3.2e+49) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t * ((x - y) / z);
double t_2 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.15e+41) {
tmp = t_2;
} else if (y <= 8.2e-215) {
tmp = t_1;
} else if (y <= 1.25e-74) {
tmp = t * (x / (z - y));
} else if (y <= 3.2e+49) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * ((x - y) / z)
t_2 = t * (1.0d0 - (x / y))
if (y <= (-1.15d+41)) then
tmp = t_2
else if (y <= 8.2d-215) then
tmp = t_1
else if (y <= 1.25d-74) then
tmp = t * (x / (z - y))
else if (y <= 3.2d+49) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * ((x - y) / z);
double t_2 = t * (1.0 - (x / y));
double tmp;
if (y <= -1.15e+41) {
tmp = t_2;
} else if (y <= 8.2e-215) {
tmp = t_1;
} else if (y <= 1.25e-74) {
tmp = t * (x / (z - y));
} else if (y <= 3.2e+49) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * ((x - y) / z) t_2 = t * (1.0 - (x / y)) tmp = 0 if y <= -1.15e+41: tmp = t_2 elif y <= 8.2e-215: tmp = t_1 elif y <= 1.25e-74: tmp = t * (x / (z - y)) elif y <= 3.2e+49: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(Float64(x - y) / z)) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (y <= -1.15e+41) tmp = t_2; elseif (y <= 8.2e-215) tmp = t_1; elseif (y <= 1.25e-74) tmp = Float64(t * Float64(x / Float64(z - y))); elseif (y <= 3.2e+49) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * ((x - y) / z); t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (y <= -1.15e+41) tmp = t_2; elseif (y <= 8.2e-215) tmp = t_1; elseif (y <= 1.25e-74) tmp = t * (x / (z - y)); elseif (y <= 3.2e+49) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e+41], t$95$2, If[LessEqual[y, 8.2e-215], t$95$1, If[LessEqual[y, 1.25e-74], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+49], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x - y}{z}\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+41}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-215}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-74}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+49}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -1.1499999999999999e41 or 3.20000000000000014e49 < y Initial program 99.9%
frac-2neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 83.4%
div-sub83.4%
*-inverses83.4%
Simplified83.4%
if -1.1499999999999999e41 < y < 8.1999999999999997e-215 or 1.25e-74 < y < 3.20000000000000014e49Initial program 96.5%
Taylor expanded in z around inf 78.5%
if 8.1999999999999997e-215 < y < 1.25e-74Initial program 99.7%
Taylor expanded in x around inf 93.6%
Final simplification82.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (/ (- y z) y))) (t_2 (* t (/ x (- z y)))))
(if (<= x -0.25)
t_2
(if (<= x 1.55e-106)
t_1
(if (<= x 5.8e-6) (* t (/ (- x y) z)) (if (<= x 4.5e+90) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t / ((y - z) / y);
double t_2 = t * (x / (z - y));
double tmp;
if (x <= -0.25) {
tmp = t_2;
} else if (x <= 1.55e-106) {
tmp = t_1;
} else if (x <= 5.8e-6) {
tmp = t * ((x - y) / z);
} else if (x <= 4.5e+90) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t / ((y - z) / y)
t_2 = t * (x / (z - y))
if (x <= (-0.25d0)) then
tmp = t_2
else if (x <= 1.55d-106) then
tmp = t_1
else if (x <= 5.8d-6) then
tmp = t * ((x - y) / z)
else if (x <= 4.5d+90) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t / ((y - z) / y);
double t_2 = t * (x / (z - y));
double tmp;
if (x <= -0.25) {
tmp = t_2;
} else if (x <= 1.55e-106) {
tmp = t_1;
} else if (x <= 5.8e-6) {
tmp = t * ((x - y) / z);
} else if (x <= 4.5e+90) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t / ((y - z) / y) t_2 = t * (x / (z - y)) tmp = 0 if x <= -0.25: tmp = t_2 elif x <= 1.55e-106: tmp = t_1 elif x <= 5.8e-6: tmp = t * ((x - y) / z) elif x <= 4.5e+90: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(Float64(y - z) / y)) t_2 = Float64(t * Float64(x / Float64(z - y))) tmp = 0.0 if (x <= -0.25) tmp = t_2; elseif (x <= 1.55e-106) tmp = t_1; elseif (x <= 5.8e-6) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (x <= 4.5e+90) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / ((y - z) / y); t_2 = t * (x / (z - y)); tmp = 0.0; if (x <= -0.25) tmp = t_2; elseif (x <= 1.55e-106) tmp = t_1; elseif (x <= 5.8e-6) tmp = t * ((x - y) / z); elseif (x <= 4.5e+90) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.25], t$95$2, If[LessEqual[x, 1.55e-106], t$95$1, If[LessEqual[x, 5.8e-6], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e+90], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y - z}{y}}\\
t_2 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;x \leq -0.25:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -0.25 or 4.5e90 < x Initial program 97.3%
Taylor expanded in x around inf 83.4%
if -0.25 < x < 1.54999999999999993e-106 or 5.8000000000000004e-6 < x < 4.5e90Initial program 99.1%
associate-*l/84.5%
*-commutative84.5%
associate-/l*98.2%
sub-neg98.2%
remove-double-neg98.2%
distribute-neg-in98.2%
+-commutative98.2%
sub-neg98.2%
mul-1-neg98.2%
associate-/r*98.2%
Simplified98.2%
Taylor expanded in x around 0 72.1%
associate-/l*86.3%
Simplified86.3%
if 1.54999999999999993e-106 < x < 5.8000000000000004e-6Initial program 99.8%
Taylor expanded in z around inf 77.0%
Final simplification84.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (/ (- y z) y))))
(if (<= x -5.8e-8)
(* t (/ x (- z y)))
(if (<= x 3.5e-106)
t_1
(if (<= x 2.75e-7)
(* t (/ (- x y) z))
(if (<= x 2.6e+94) t_1 (/ t (/ (- z y) x))))))))
double code(double x, double y, double z, double t) {
double t_1 = t / ((y - z) / y);
double tmp;
if (x <= -5.8e-8) {
tmp = t * (x / (z - y));
} else if (x <= 3.5e-106) {
tmp = t_1;
} else if (x <= 2.75e-7) {
tmp = t * ((x - y) / z);
} else if (x <= 2.6e+94) {
tmp = t_1;
} else {
tmp = t / ((z - y) / x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t / ((y - z) / y)
if (x <= (-5.8d-8)) then
tmp = t * (x / (z - y))
else if (x <= 3.5d-106) then
tmp = t_1
else if (x <= 2.75d-7) then
tmp = t * ((x - y) / z)
else if (x <= 2.6d+94) then
tmp = t_1
else
tmp = t / ((z - y) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t / ((y - z) / y);
double tmp;
if (x <= -5.8e-8) {
tmp = t * (x / (z - y));
} else if (x <= 3.5e-106) {
tmp = t_1;
} else if (x <= 2.75e-7) {
tmp = t * ((x - y) / z);
} else if (x <= 2.6e+94) {
tmp = t_1;
} else {
tmp = t / ((z - y) / x);
}
return tmp;
}
def code(x, y, z, t): t_1 = t / ((y - z) / y) tmp = 0 if x <= -5.8e-8: tmp = t * (x / (z - y)) elif x <= 3.5e-106: tmp = t_1 elif x <= 2.75e-7: tmp = t * ((x - y) / z) elif x <= 2.6e+94: tmp = t_1 else: tmp = t / ((z - y) / x) return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(Float64(y - z) / y)) tmp = 0.0 if (x <= -5.8e-8) tmp = Float64(t * Float64(x / Float64(z - y))); elseif (x <= 3.5e-106) tmp = t_1; elseif (x <= 2.75e-7) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (x <= 2.6e+94) tmp = t_1; else tmp = Float64(t / Float64(Float64(z - y) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / ((y - z) / y); tmp = 0.0; if (x <= -5.8e-8) tmp = t * (x / (z - y)); elseif (x <= 3.5e-106) tmp = t_1; elseif (x <= 2.75e-7) tmp = t * ((x - y) / z); elseif (x <= 2.6e+94) tmp = t_1; else tmp = t / ((z - y) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(N[(y - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.8e-8], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-106], t$95$1, If[LessEqual[x, 2.75e-7], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+94], t$95$1, N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y - z}{y}}\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{-8}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{-7}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+94}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\end{array}
\end{array}
if x < -5.8000000000000003e-8Initial program 97.2%
Taylor expanded in x around inf 80.9%
if -5.8000000000000003e-8 < x < 3.5e-106 or 2.7500000000000001e-7 < x < 2.5999999999999999e94Initial program 99.1%
associate-*l/84.5%
*-commutative84.5%
associate-/l*98.2%
sub-neg98.2%
remove-double-neg98.2%
distribute-neg-in98.2%
+-commutative98.2%
sub-neg98.2%
mul-1-neg98.2%
associate-/r*98.2%
Simplified98.2%
Taylor expanded in x around 0 72.1%
associate-/l*86.3%
Simplified86.3%
if 3.5e-106 < x < 2.7500000000000001e-7Initial program 99.8%
Taylor expanded in z around inf 77.0%
if 2.5999999999999999e94 < x Initial program 97.4%
Taylor expanded in x around inf 72.3%
associate-/l*87.8%
Simplified87.8%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (<= y -8e+111) (/ t (/ y (- y x))) (if (<= y 1.85e+202) (* (- x y) (/ t (- z y))) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e+111) {
tmp = t / (y / (y - x));
} else if (y <= 1.85e+202) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8d+111)) then
tmp = t / (y / (y - x))
else if (y <= 1.85d+202) then
tmp = (x - y) * (t / (z - y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e+111) {
tmp = t / (y / (y - x));
} else if (y <= 1.85e+202) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8e+111: tmp = t / (y / (y - x)) elif y <= 1.85e+202: tmp = (x - y) * (t / (z - y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8e+111) tmp = Float64(t / Float64(y / Float64(y - x))); elseif (y <= 1.85e+202) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8e+111) tmp = t / (y / (y - x)); elseif (y <= 1.85e+202) tmp = (x - y) * (t / (z - y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8e+111], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+202], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+111}:\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+202}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -7.99999999999999965e111Initial program 99.8%
associate-*l/73.3%
*-commutative73.3%
associate-/l*99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-neg-in99.8%
+-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in z around 0 63.5%
associate-/l*86.0%
Simplified86.0%
if -7.99999999999999965e111 < y < 1.8499999999999999e202Initial program 97.8%
associate-*l/89.8%
*-commutative89.8%
associate-/l*97.2%
sub-neg97.2%
remove-double-neg97.2%
distribute-neg-in97.2%
+-commutative97.2%
sub-neg97.2%
mul-1-neg97.2%
associate-/r*97.2%
Simplified97.2%
associate-/l*89.8%
*-commutative89.8%
sub-neg89.8%
+-commutative89.8%
neg-sub089.8%
associate-+l-89.8%
neg-sub089.8%
sub-neg89.8%
+-commutative89.8%
neg-sub089.8%
associate-+l-89.8%
neg-sub089.8%
associate-*l/97.8%
frac-2neg97.8%
associate-*l/89.8%
*-commutative89.8%
associate-*l/89.1%
Applied egg-rr89.1%
if 1.8499999999999999e202 < y Initial program 100.0%
frac-2neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 95.9%
div-sub95.9%
*-inverses95.9%
Simplified95.9%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3e+40) (not (<= y 1.25e+48))) (* t (- 1.0 (/ x y))) (* t (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e+40) || !(y <= 1.25e+48)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3d+40)) .or. (.not. (y <= 1.25d+48))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e+40) || !(y <= 1.25e+48)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3e+40) or not (y <= 1.25e+48): tmp = t * (1.0 - (x / y)) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3e+40) || !(y <= 1.25e+48)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3e+40) || ~((y <= 1.25e+48))) tmp = t * (1.0 - (x / y)); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3e+40], N[Not[LessEqual[y, 1.25e+48]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+40} \lor \neg \left(y \leq 1.25 \cdot 10^{+48}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.0000000000000002e40 or 1.24999999999999993e48 < y Initial program 99.9%
frac-2neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 83.4%
div-sub83.4%
*-inverses83.4%
Simplified83.4%
if -3.0000000000000002e40 < y < 1.24999999999999993e48Initial program 97.2%
Taylor expanded in y around 0 68.5%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.1e+43) (not (<= y 6.2e-34))) (* t (- 1.0 (/ x y))) (* x (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.1e+43) || !(y <= 6.2e-34)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.1d+43)) .or. (.not. (y <= 6.2d-34))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = x * (t / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.1e+43) || !(y <= 6.2e-34)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.1e+43) or not (y <= 6.2e-34): tmp = t * (1.0 - (x / y)) else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.1e+43) || !(y <= 6.2e-34)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(x * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.1e+43) || ~((y <= 6.2e-34))) tmp = t * (1.0 - (x / y)); else tmp = x * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.1e+43], N[Not[LessEqual[y, 6.2e-34]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+43} \lor \neg \left(y \leq 6.2 \cdot 10^{-34}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -1.1e43 or 6.1999999999999996e-34 < y Initial program 99.9%
frac-2neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
div-inv99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 77.6%
div-sub77.6%
*-inverses77.6%
Simplified77.6%
if -1.1e43 < y < 6.1999999999999996e-34Initial program 96.9%
Taylor expanded in x around inf 77.6%
associate-*l/73.4%
Applied egg-rr73.4%
Final simplification75.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.4e+45) (not (<= y 5.7e+48))) (* t (- 1.0 (/ x y))) (* t (/ x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.4e+45) || !(y <= 5.7e+48)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.4d+45)) .or. (.not. (y <= 5.7d+48))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t * (x / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.4e+45) || !(y <= 5.7e+48)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.4e+45) or not (y <= 5.7e+48): tmp = t * (1.0 - (x / y)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.4e+45) || !(y <= 5.7e+48)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t * Float64(x / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.4e+45) || ~((y <= 5.7e+48))) tmp = t * (1.0 - (x / y)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.4e+45], N[Not[LessEqual[y, 5.7e+48]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+45} \lor \neg \left(y \leq 5.7 \cdot 10^{+48}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if y < -7.39999999999999954e45 or 5.69999999999999968e48 < y Initial program 99.9%
frac-2neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 83.2%
div-sub83.2%
*-inverses83.2%
Simplified83.2%
if -7.39999999999999954e45 < y < 5.69999999999999968e48Initial program 97.2%
Taylor expanded in x around inf 76.2%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.2e+103) t (if (<= y 3.05e+41) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+103) {
tmp = t;
} else if (y <= 3.05e+41) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.2d+103)) then
tmp = t
else if (y <= 3.05d+41) then
tmp = x * (t / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+103) {
tmp = t;
} else if (y <= 3.05e+41) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.2e+103: tmp = t elif y <= 3.05e+41: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e+103) tmp = t; elseif (y <= 3.05e+41) tmp = Float64(x * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.2e+103) tmp = t; elseif (y <= 3.05e+41) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+103], t, If[LessEqual[y, 3.05e+41], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+103}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.1999999999999999e103 or 3.04999999999999999e41 < y Initial program 99.9%
Taylor expanded in y around inf 62.4%
if -1.1999999999999999e103 < y < 3.04999999999999999e41Initial program 97.4%
Taylor expanded in x around inf 72.8%
associate-*l/69.8%
Applied egg-rr69.8%
Taylor expanded in z around inf 58.8%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (if (<= y -1.2e+103) t (if (<= y 5.7e+49) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+103) {
tmp = t;
} else if (y <= 5.7e+49) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.2d+103)) then
tmp = t
else if (y <= 5.7d+49) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+103) {
tmp = t;
} else if (y <= 5.7e+49) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.2e+103: tmp = t elif y <= 5.7e+49: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e+103) tmp = t; elseif (y <= 5.7e+49) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.2e+103) tmp = t; elseif (y <= 5.7e+49) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+103], t, If[LessEqual[y, 5.7e+49], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+103}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+49}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.1999999999999999e103 or 5.6999999999999998e49 < y Initial program 99.9%
Taylor expanded in y around inf 63.5%
if -1.1999999999999999e103 < y < 5.6999999999999998e49Initial program 97.4%
Taylor expanded in y around 0 66.5%
Final simplification65.4%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 98.3%
Taylor expanded in y around inf 32.6%
Final simplification32.6%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t / ((z - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))