
(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 12 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 (if (or (<= y -3.1e-134) (not (<= y 1.22e-32))) (* (/ (- x y) (- z y)) t) (/ (- x y) (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.1e-134) || !(y <= 1.22e-32)) {
tmp = ((x - y) / (z - y)) * t;
} else {
tmp = (x - y) / ((z - y) / 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 <= (-3.1d-134)) .or. (.not. (y <= 1.22d-32))) then
tmp = ((x - y) / (z - y)) * t
else
tmp = (x - y) / ((z - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.1e-134) || !(y <= 1.22e-32)) {
tmp = ((x - y) / (z - y)) * t;
} else {
tmp = (x - y) / ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.1e-134) or not (y <= 1.22e-32): tmp = ((x - y) / (z - y)) * t else: tmp = (x - y) / ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.1e-134) || !(y <= 1.22e-32)) tmp = Float64(Float64(Float64(x - y) / Float64(z - y)) * t); else tmp = Float64(Float64(x - y) / Float64(Float64(z - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.1e-134) || ~((y <= 1.22e-32))) tmp = ((x - y) / (z - y)) * t; else tmp = (x - y) / ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.1e-134], N[Not[LessEqual[y, 1.22e-32]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-134} \lor \neg \left(y \leq 1.22 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\
\end{array}
\end{array}
if y < -3.10000000000000006e-134 or 1.22e-32 < y Initial program 99.9%
if -3.10000000000000006e-134 < y < 1.22e-32Initial program 91.1%
associate-*l/95.5%
associate-/l*98.9%
Simplified98.9%
clear-num98.9%
un-div-inv99.0%
Applied egg-rr99.0%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -5.6e+45)
t
(if (<= y -14500000000.0)
(* t (/ x (- y)))
(if (<= y -9.5) t (if (<= y 2.85e+29) (/ x (/ z t)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.6e+45) {
tmp = t;
} else if (y <= -14500000000.0) {
tmp = t * (x / -y);
} else if (y <= -9.5) {
tmp = t;
} else if (y <= 2.85e+29) {
tmp = x / (z / t);
} 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 <= (-5.6d+45)) then
tmp = t
else if (y <= (-14500000000.0d0)) then
tmp = t * (x / -y)
else if (y <= (-9.5d0)) then
tmp = t
else if (y <= 2.85d+29) then
tmp = x / (z / t)
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 <= -5.6e+45) {
tmp = t;
} else if (y <= -14500000000.0) {
tmp = t * (x / -y);
} else if (y <= -9.5) {
tmp = t;
} else if (y <= 2.85e+29) {
tmp = x / (z / t);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.6e+45: tmp = t elif y <= -14500000000.0: tmp = t * (x / -y) elif y <= -9.5: tmp = t elif y <= 2.85e+29: tmp = x / (z / t) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.6e+45) tmp = t; elseif (y <= -14500000000.0) tmp = Float64(t * Float64(x / Float64(-y))); elseif (y <= -9.5) tmp = t; elseif (y <= 2.85e+29) tmp = Float64(x / Float64(z / t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.6e+45) tmp = t; elseif (y <= -14500000000.0) tmp = t * (x / -y); elseif (y <= -9.5) tmp = t; elseif (y <= 2.85e+29) tmp = x / (z / t); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.6e+45], t, If[LessEqual[y, -14500000000.0], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -9.5], t, If[LessEqual[y, 2.85e+29], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+45}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -14500000000:\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{elif}\;y \leq -9.5:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.5999999999999999e45 or -1.45e10 < y < -9.5 or 2.85e29 < y Initial program 99.9%
associate-*l/68.8%
associate-/l*70.1%
Simplified70.1%
Taylor expanded in y around inf 67.6%
if -5.5999999999999999e45 < y < -1.45e10Initial program 99.8%
associate-*l/91.4%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in x around inf 74.1%
Taylor expanded in z around 0 54.6%
mul-1-neg54.6%
associate-/l*63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
if -9.5 < y < 2.85e29Initial program 93.2%
associate-*l/95.9%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 67.7%
*-commutative67.7%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in x around 0 67.7%
*-commutative67.7%
associate-*l/67.4%
associate-/r/70.4%
Simplified70.4%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.46e+51)
t
(if (<= y -23500000000.0)
(* x (/ t (- y)))
(if (<= y -10.6) t (if (<= y 6.2e+29) (/ x (/ z t)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.46e+51) {
tmp = t;
} else if (y <= -23500000000.0) {
tmp = x * (t / -y);
} else if (y <= -10.6) {
tmp = t;
} else if (y <= 6.2e+29) {
tmp = x / (z / t);
} 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.46d+51)) then
tmp = t
else if (y <= (-23500000000.0d0)) then
tmp = x * (t / -y)
else if (y <= (-10.6d0)) then
tmp = t
else if (y <= 6.2d+29) then
tmp = x / (z / t)
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.46e+51) {
tmp = t;
} else if (y <= -23500000000.0) {
tmp = x * (t / -y);
} else if (y <= -10.6) {
tmp = t;
} else if (y <= 6.2e+29) {
tmp = x / (z / t);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.46e+51: tmp = t elif y <= -23500000000.0: tmp = x * (t / -y) elif y <= -10.6: tmp = t elif y <= 6.2e+29: tmp = x / (z / t) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.46e+51) tmp = t; elseif (y <= -23500000000.0) tmp = Float64(x * Float64(t / Float64(-y))); elseif (y <= -10.6) tmp = t; elseif (y <= 6.2e+29) tmp = Float64(x / Float64(z / t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.46e+51) tmp = t; elseif (y <= -23500000000.0) tmp = x * (t / -y); elseif (y <= -10.6) tmp = t; elseif (y <= 6.2e+29) tmp = x / (z / t); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.46e+51], t, If[LessEqual[y, -23500000000.0], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -10.6], t, If[LessEqual[y, 6.2e+29], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.46 \cdot 10^{+51}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -23500000000:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{elif}\;y \leq -10.6:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.4600000000000001e51 or -2.35e10 < y < -10.5999999999999996 or 6.1999999999999998e29 < y Initial program 99.9%
associate-*l/68.5%
associate-/l*69.8%
Simplified69.8%
Taylor expanded in y around inf 68.1%
if -1.4600000000000001e51 < y < -2.35e10Initial program 99.9%
associate-*l/92.2%
associate-/l*95.0%
Simplified95.0%
Taylor expanded in x around inf 76.5%
Taylor expanded in z around 0 50.0%
mul-1-neg50.0%
associate-/l*57.8%
distribute-rgt-neg-in57.8%
Simplified57.8%
Taylor expanded in t around 0 50.0%
associate-*r/50.0%
associate-*r*50.0%
neg-mul-150.0%
*-commutative50.0%
associate-/l*66.6%
Simplified66.6%
if -10.5999999999999996 < y < 6.1999999999999998e29Initial program 93.2%
associate-*l/95.9%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 67.7%
*-commutative67.7%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in x around 0 67.7%
*-commutative67.7%
associate-*l/67.4%
associate-/r/70.4%
Simplified70.4%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.7e+170) (not (<= y 2.7e+119))) (* t (/ y (- y z))) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.7e+170) || !(y <= 2.7e+119)) {
tmp = t * (y / (y - z));
} else {
tmp = (x - y) * (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 <= (-2.7d+170)) .or. (.not. (y <= 2.7d+119))) then
tmp = t * (y / (y - z))
else
tmp = (x - y) * (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 <= -2.7e+170) || !(y <= 2.7e+119)) {
tmp = t * (y / (y - z));
} else {
tmp = (x - y) * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.7e+170) or not (y <= 2.7e+119): tmp = t * (y / (y - z)) else: tmp = (x - y) * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.7e+170) || !(y <= 2.7e+119)) tmp = Float64(t * Float64(y / Float64(y - z))); else tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.7e+170) || ~((y <= 2.7e+119))) tmp = t * (y / (y - z)); else tmp = (x - y) * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.7e+170], N[Not[LessEqual[y, 2.7e+119]], $MachinePrecision]], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+170} \lor \neg \left(y \leq 2.7 \cdot 10^{+119}\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -2.7000000000000002e170 or 2.6999999999999998e119 < y Initial program 100.0%
Taylor expanded in x around 0 93.8%
neg-mul-193.8%
distribute-neg-frac93.8%
Simplified93.8%
frac-2neg93.8%
div-inv93.7%
remove-double-neg93.7%
sub-neg93.7%
distribute-neg-in93.7%
remove-double-neg93.7%
Applied egg-rr93.7%
associate-*r/93.8%
*-rgt-identity93.8%
+-commutative93.8%
unsub-neg93.8%
Simplified93.8%
if -2.7000000000000002e170 < y < 2.6999999999999998e119Initial program 94.9%
associate-*l/91.0%
associate-/l*94.6%
Simplified94.6%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e-138) (not (<= y 4.4e-33))) (* (/ (- x y) (- z y)) t) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e-138) || !(y <= 4.4e-33)) {
tmp = ((x - y) / (z - y)) * t;
} else {
tmp = (x - y) * (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 <= (-3.4d-138)) .or. (.not. (y <= 4.4d-33))) then
tmp = ((x - y) / (z - y)) * t
else
tmp = (x - y) * (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 <= -3.4e-138) || !(y <= 4.4e-33)) {
tmp = ((x - y) / (z - y)) * t;
} else {
tmp = (x - y) * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e-138) or not (y <= 4.4e-33): tmp = ((x - y) / (z - y)) * t else: tmp = (x - y) * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e-138) || !(y <= 4.4e-33)) tmp = Float64(Float64(Float64(x - y) / Float64(z - y)) * t); else tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.4e-138) || ~((y <= 4.4e-33))) tmp = ((x - y) / (z - y)) * t; else tmp = (x - y) * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e-138], N[Not[LessEqual[y, 4.4e-33]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-138} \lor \neg \left(y \leq 4.4 \cdot 10^{-33}\right):\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -3.4000000000000001e-138 or 4.40000000000000011e-33 < y Initial program 99.9%
if -3.4000000000000001e-138 < y < 4.40000000000000011e-33Initial program 91.0%
associate-*l/96.3%
associate-/l*98.9%
Simplified98.9%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.4e+98) (not (<= x 2.4e-12))) (* t (/ x (- z y))) (* t (/ y (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.4e+98) || !(x <= 2.4e-12)) {
tmp = t * (x / (z - y));
} else {
tmp = t * (y / (y - 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 ((x <= (-8.4d+98)) .or. (.not. (x <= 2.4d-12))) then
tmp = t * (x / (z - y))
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.4e+98) || !(x <= 2.4e-12)) {
tmp = t * (x / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.4e+98) or not (x <= 2.4e-12): tmp = t * (x / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.4e+98) || !(x <= 2.4e-12)) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -8.4e+98) || ~((x <= 2.4e-12))) tmp = t * (x / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.4e+98], N[Not[LessEqual[x, 2.4e-12]], $MachinePrecision]], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.4 \cdot 10^{+98} \lor \neg \left(x \leq 2.4 \cdot 10^{-12}\right):\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if x < -8.40000000000000016e98 or 2.39999999999999987e-12 < x Initial program 94.7%
Taylor expanded in x around inf 76.8%
if -8.40000000000000016e98 < x < 2.39999999999999987e-12Initial program 97.3%
Taylor expanded in x around 0 83.5%
neg-mul-183.5%
distribute-neg-frac83.5%
Simplified83.5%
frac-2neg83.5%
div-inv83.4%
remove-double-neg83.4%
sub-neg83.4%
distribute-neg-in83.4%
remove-double-neg83.4%
Applied egg-rr83.4%
associate-*r/83.5%
*-rgt-identity83.5%
+-commutative83.5%
unsub-neg83.5%
Simplified83.5%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e-16) (not (<= z 2.6e-12))) (* t (/ (- x y) z)) (- t (* t (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-16) || !(z <= 2.6e-12)) {
tmp = t * ((x - y) / z);
} else {
tmp = t - (t * (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 ((z <= (-7.8d-16)) .or. (.not. (z <= 2.6d-12))) then
tmp = t * ((x - y) / z)
else
tmp = t - (t * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e-16) || !(z <= 2.6e-12)) {
tmp = t * ((x - y) / z);
} else {
tmp = t - (t * (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e-16) or not (z <= 2.6e-12): tmp = t * ((x - y) / z) else: tmp = t - (t * (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e-16) || !(z <= 2.6e-12)) tmp = Float64(t * Float64(Float64(x - y) / z)); else tmp = Float64(t - Float64(t * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.8e-16) || ~((z <= 2.6e-12))) tmp = t * ((x - y) / z); else tmp = t - (t * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e-16], N[Not[LessEqual[z, 2.6e-12]], $MachinePrecision]], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-16} \lor \neg \left(z \leq 2.6 \cdot 10^{-12}\right):\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -7.79999999999999954e-16 or 2.59999999999999983e-12 < z Initial program 96.8%
Taylor expanded in z around inf 79.8%
if -7.79999999999999954e-16 < z < 2.59999999999999983e-12Initial program 95.7%
associate-*l/87.4%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in z around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
Taylor expanded in x around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-/l*83.2%
Simplified83.2%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (<= y -8.2e+51) t (if (<= y 1.7e+35) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e+51) {
tmp = t;
} else if (y <= 1.7e+35) {
tmp = x * (t / (z - y));
} 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 <= (-8.2d+51)) then
tmp = t
else if (y <= 1.7d+35) then
tmp = x * (t / (z - y))
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 <= -8.2e+51) {
tmp = t;
} else if (y <= 1.7e+35) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.2e+51: tmp = t elif y <= 1.7e+35: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.2e+51) tmp = t; elseif (y <= 1.7e+35) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.2e+51) tmp = t; elseif (y <= 1.7e+35) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.2e+51], t, If[LessEqual[y, 1.7e+35], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+51}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -8.20000000000000021e51 or 1.7000000000000001e35 < y Initial program 99.9%
associate-*l/67.3%
associate-/l*68.6%
Simplified68.6%
Taylor expanded in y around inf 66.9%
if -8.20000000000000021e51 < y < 1.7000000000000001e35Initial program 93.8%
associate-*l/95.7%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in x around inf 76.0%
*-commutative76.0%
associate-/l*78.6%
Applied egg-rr78.6%
Final simplification74.0%
(FPCore (x y z t) :precision binary64 (if (<= z -4.5e-15) (* t (/ (- x y) z)) (if (<= z 2.1e-12) (- t (* t (/ x y))) (/ (- x y) (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e-15) {
tmp = t * ((x - y) / z);
} else if (z <= 2.1e-12) {
tmp = t - (t * (x / y));
} else {
tmp = (x - y) / (z / 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 (z <= (-4.5d-15)) then
tmp = t * ((x - y) / z)
else if (z <= 2.1d-12) then
tmp = t - (t * (x / y))
else
tmp = (x - y) / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e-15) {
tmp = t * ((x - y) / z);
} else if (z <= 2.1e-12) {
tmp = t - (t * (x / y));
} else {
tmp = (x - y) / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e-15: tmp = t * ((x - y) / z) elif z <= 2.1e-12: tmp = t - (t * (x / y)) else: tmp = (x - y) / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e-15) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (z <= 2.1e-12) tmp = Float64(t - Float64(t * Float64(x / y))); else tmp = Float64(Float64(x - y) / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e-15) tmp = t * ((x - y) / z); elseif (z <= 2.1e-12) tmp = t - (t * (x / y)); else tmp = (x - y) / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e-15], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e-12], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-15}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-12}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{\frac{z}{t}}\\
\end{array}
\end{array}
if z < -4.4999999999999998e-15Initial program 96.2%
Taylor expanded in z around inf 76.3%
if -4.4999999999999998e-15 < z < 2.09999999999999994e-12Initial program 95.7%
associate-*l/87.4%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in z around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
Taylor expanded in x around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-/l*83.2%
Simplified83.2%
if 2.09999999999999994e-12 < z Initial program 97.7%
associate-*l/80.6%
associate-/l*94.6%
Simplified94.6%
clear-num94.6%
un-div-inv94.7%
Applied egg-rr94.7%
Taylor expanded in z around inf 86.0%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.45) t (if (<= y 2.2e+30) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.45) {
tmp = t;
} else if (y <= 2.2e+30) {
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.45d0)) then
tmp = t
else if (y <= 2.2d+30) 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.45) {
tmp = t;
} else if (y <= 2.2e+30) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.45: tmp = t elif y <= 2.2e+30: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.45) tmp = t; elseif (y <= 2.2e+30) 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.45) tmp = t; elseif (y <= 2.2e+30) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.45], t, If[LessEqual[y, 2.2e+30], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.44999999999999996 or 2.2e30 < y Initial program 99.9%
associate-*l/70.8%
associate-/l*72.2%
Simplified72.2%
Taylor expanded in y around inf 62.3%
if -1.44999999999999996 < y < 2.2e30Initial program 93.2%
associate-*l/95.9%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 67.7%
*-commutative67.7%
associate-/l*70.3%
Simplified70.3%
Final simplification66.7%
(FPCore (x y z t) :precision binary64 (if (<= y -3.8) t (if (<= y 9.6e+29) (/ x (/ z t)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.8) {
tmp = t;
} else if (y <= 9.6e+29) {
tmp = x / (z / t);
} 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 <= (-3.8d0)) then
tmp = t
else if (y <= 9.6d+29) then
tmp = x / (z / t)
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 <= -3.8) {
tmp = t;
} else if (y <= 9.6e+29) {
tmp = x / (z / t);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.8: tmp = t elif y <= 9.6e+29: tmp = x / (z / t) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.8) tmp = t; elseif (y <= 9.6e+29) tmp = Float64(x / Float64(z / t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.8) tmp = t; elseif (y <= 9.6e+29) tmp = x / (z / t); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.8], t, If[LessEqual[y, 9.6e+29], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.7999999999999998 or 9.6000000000000003e29 < y Initial program 99.9%
associate-*l/70.8%
associate-/l*72.2%
Simplified72.2%
Taylor expanded in y around inf 62.3%
if -3.7999999999999998 < y < 9.6000000000000003e29Initial program 93.2%
associate-*l/95.9%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in y around 0 67.7%
*-commutative67.7%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in x around 0 67.7%
*-commutative67.7%
associate-*l/67.4%
associate-/r/70.4%
Simplified70.4%
Final simplification66.7%
(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 96.2%
associate-*l/84.5%
associate-/l*85.8%
Simplified85.8%
Taylor expanded in y around inf 34.8%
Final simplification34.8%
(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 2024062
(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))