
(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 10 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 97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ y (- y z)))))
(if (<= y -5.8e-9)
t_1
(if (<= y 3e-11)
(* (- x y) (/ t z))
(if (<= y 4.4e+25) (* t (/ (- y x) y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (y / (y - z));
double tmp;
if (y <= -5.8e-9) {
tmp = t_1;
} else if (y <= 3e-11) {
tmp = (x - y) * (t / z);
} else if (y <= 4.4e+25) {
tmp = t * ((y - x) / y);
} else {
tmp = t_1;
}
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 / (y - z))
if (y <= (-5.8d-9)) then
tmp = t_1
else if (y <= 3d-11) then
tmp = (x - y) * (t / z)
else if (y <= 4.4d+25) then
tmp = t * ((y - x) / y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y / (y - z));
double tmp;
if (y <= -5.8e-9) {
tmp = t_1;
} else if (y <= 3e-11) {
tmp = (x - y) * (t / z);
} else if (y <= 4.4e+25) {
tmp = t * ((y - x) / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (y / (y - z)) tmp = 0 if y <= -5.8e-9: tmp = t_1 elif y <= 3e-11: tmp = (x - y) * (t / z) elif y <= 4.4e+25: tmp = t * ((y - x) / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(y / Float64(y - z))) tmp = 0.0 if (y <= -5.8e-9) tmp = t_1; elseif (y <= 3e-11) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 4.4e+25) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (y / (y - z)); tmp = 0.0; if (y <= -5.8e-9) tmp = t_1; elseif (y <= 3e-11) tmp = (x - y) * (t / z); elseif (y <= 4.4e+25) tmp = t * ((y - x) / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e-9], t$95$1, If[LessEqual[y, 3e-11], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+25], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{y - z}\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-11}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+25}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.79999999999999982e-9 or 4.4000000000000001e25 < y Initial program 99.9%
Taylor expanded in x around 0 81.2%
neg-mul-181.2%
distribute-neg-frac281.2%
neg-sub081.2%
sub-neg81.2%
+-commutative81.2%
associate--r+81.2%
neg-sub081.2%
remove-double-neg81.2%
Simplified81.2%
if -5.79999999999999982e-9 < y < 3e-11Initial program 94.5%
associate-*l/94.4%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in z around inf 71.4%
if 3e-11 < y < 4.4000000000000001e25Initial program 100.0%
Taylor expanded in z around 0 82.7%
associate-*r/82.7%
neg-mul-182.7%
neg-sub082.7%
sub-neg82.7%
+-commutative82.7%
associate--r+82.7%
neg-sub082.7%
remove-double-neg82.7%
Simplified82.7%
Final simplification76.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ y (- y z)))))
(if (<= y -2.4e-12)
t_1
(if (<= y 54000.0)
(* (- x y) (/ t z))
(if (<= y 7.5e+25) (* t (/ (- x) y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (y / (y - z));
double tmp;
if (y <= -2.4e-12) {
tmp = t_1;
} else if (y <= 54000.0) {
tmp = (x - y) * (t / z);
} else if (y <= 7.5e+25) {
tmp = t * (-x / y);
} else {
tmp = t_1;
}
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 / (y - z))
if (y <= (-2.4d-12)) then
tmp = t_1
else if (y <= 54000.0d0) then
tmp = (x - y) * (t / z)
else if (y <= 7.5d+25) then
tmp = t * (-x / y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y / (y - z));
double tmp;
if (y <= -2.4e-12) {
tmp = t_1;
} else if (y <= 54000.0) {
tmp = (x - y) * (t / z);
} else if (y <= 7.5e+25) {
tmp = t * (-x / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (y / (y - z)) tmp = 0 if y <= -2.4e-12: tmp = t_1 elif y <= 54000.0: tmp = (x - y) * (t / z) elif y <= 7.5e+25: tmp = t * (-x / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(y / Float64(y - z))) tmp = 0.0 if (y <= -2.4e-12) tmp = t_1; elseif (y <= 54000.0) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 7.5e+25) tmp = Float64(t * Float64(Float64(-x) / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (y / (y - z)); tmp = 0.0; if (y <= -2.4e-12) tmp = t_1; elseif (y <= 54000.0) tmp = (x - y) * (t / z); elseif (y <= 7.5e+25) tmp = t * (-x / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e-12], t$95$1, If[LessEqual[y, 54000.0], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+25], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{y - z}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 54000:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+25}:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.39999999999999987e-12 or 7.49999999999999993e25 < y Initial program 99.9%
Taylor expanded in x around 0 81.2%
neg-mul-181.2%
distribute-neg-frac281.2%
neg-sub081.2%
sub-neg81.2%
+-commutative81.2%
associate--r+81.2%
neg-sub081.2%
remove-double-neg81.2%
Simplified81.2%
if -2.39999999999999987e-12 < y < 54000Initial program 94.6%
associate-*l/94.5%
associate-/l*92.3%
Simplified92.3%
Taylor expanded in z around inf 70.3%
if 54000 < y < 7.49999999999999993e25Initial program 100.0%
associate-*l/99.8%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in x around inf 89.2%
Taylor expanded in z around 0 78.7%
mul-1-neg78.7%
associate-/l*78.9%
distribute-lft-neg-in78.9%
Simplified78.9%
Final simplification75.7%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.4e+112)
t
(if (<= y 700000.0)
(* (- x y) (/ t z))
(if (<= y 3.9e+26) (* t (/ (- x) y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e+112) {
tmp = t;
} else if (y <= 700000.0) {
tmp = (x - y) * (t / z);
} else if (y <= 3.9e+26) {
tmp = t * (-x / 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 <= (-1.4d+112)) then
tmp = t
else if (y <= 700000.0d0) then
tmp = (x - y) * (t / z)
else if (y <= 3.9d+26) then
tmp = t * (-x / 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 <= -1.4e+112) {
tmp = t;
} else if (y <= 700000.0) {
tmp = (x - y) * (t / z);
} else if (y <= 3.9e+26) {
tmp = t * (-x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e+112: tmp = t elif y <= 700000.0: tmp = (x - y) * (t / z) elif y <= 3.9e+26: tmp = t * (-x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e+112) tmp = t; elseif (y <= 700000.0) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 3.9e+26) tmp = Float64(t * Float64(Float64(-x) / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.4e+112) tmp = t; elseif (y <= 700000.0) tmp = (x - y) * (t / z); elseif (y <= 3.9e+26) tmp = t * (-x / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e+112], t, If[LessEqual[y, 700000.0], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.9e+26], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+112}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 700000:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+26}:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.4000000000000001e112 or 3.9e26 < y Initial program 99.9%
associate-*l/73.3%
associate-/l*69.1%
Simplified69.1%
Taylor expanded in y around inf 72.2%
if -1.4000000000000001e112 < y < 7e5Initial program 95.6%
associate-*l/94.3%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in z around inf 66.2%
if 7e5 < y < 3.9e26Initial program 100.0%
associate-*l/99.9%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in x around inf 83.9%
Taylor expanded in z around 0 66.6%
mul-1-neg66.6%
associate-/l*66.7%
distribute-lft-neg-in66.7%
Simplified66.7%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.4e+197) (not (<= y 2.8e+119))) (* t (/ y (- y z))) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.4e+197) || !(y <= 2.8e+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 <= (-9.4d+197)) .or. (.not. (y <= 2.8d+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 <= -9.4e+197) || !(y <= 2.8e+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 <= -9.4e+197) or not (y <= 2.8e+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 <= -9.4e+197) || !(y <= 2.8e+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 <= -9.4e+197) || ~((y <= 2.8e+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, -9.4e+197], N[Not[LessEqual[y, 2.8e+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 -9.4 \cdot 10^{+197} \lor \neg \left(y \leq 2.8 \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 < -9.3999999999999999e197 or 2.80000000000000013e119 < y Initial program 100.0%
Taylor expanded in x around 0 90.9%
neg-mul-190.9%
distribute-neg-frac290.9%
neg-sub090.9%
sub-neg90.9%
+-commutative90.9%
associate--r+90.9%
neg-sub090.9%
remove-double-neg90.9%
Simplified90.9%
if -9.3999999999999999e197 < y < 2.80000000000000013e119Initial program 96.4%
associate-*l/93.3%
associate-/l*89.6%
Simplified89.6%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e+39) (not (<= x 1.4e-27))) (/ (* x t) (- z y)) (* t (/ y (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e+39) || !(x <= 1.4e-27)) {
tmp = (x * t) / (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 <= (-5d+39)) .or. (.not. (x <= 1.4d-27))) then
tmp = (x * t) / (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 <= -5e+39) || !(x <= 1.4e-27)) {
tmp = (x * t) / (z - y);
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e+39) or not (x <= 1.4e-27): tmp = (x * t) / (z - y) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e+39) || !(x <= 1.4e-27)) tmp = Float64(Float64(x * t) / 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 <= -5e+39) || ~((x <= 1.4e-27))) tmp = (x * t) / (z - y); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e+39], N[Not[LessEqual[x, 1.4e-27]], $MachinePrecision]], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+39} \lor \neg \left(x \leq 1.4 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if x < -5.00000000000000015e39 or 1.4e-27 < x Initial program 97.0%
associate-*l/90.4%
associate-/l*82.1%
Simplified82.1%
Taylor expanded in x around inf 75.6%
if -5.00000000000000015e39 < x < 1.4e-27Initial program 97.6%
Taylor expanded in x around 0 84.5%
neg-mul-184.5%
distribute-neg-frac284.5%
neg-sub084.5%
sub-neg84.5%
+-commutative84.5%
associate--r+84.5%
neg-sub084.5%
remove-double-neg84.5%
Simplified84.5%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.45e-13) (not (<= y 7.6e+25))) (* t (/ y (- y z))) (/ x (/ (- z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e-13) || !(y <= 7.6e+25)) {
tmp = t * (y / (y - z));
} else {
tmp = x / ((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 <= (-1.45d-13)) .or. (.not. (y <= 7.6d+25))) then
tmp = t * (y / (y - z))
else
tmp = x / ((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 <= -1.45e-13) || !(y <= 7.6e+25)) {
tmp = t * (y / (y - z));
} else {
tmp = x / ((z - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.45e-13) or not (y <= 7.6e+25): tmp = t * (y / (y - z)) else: tmp = x / ((z - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.45e-13) || !(y <= 7.6e+25)) tmp = Float64(t * Float64(y / Float64(y - z))); else tmp = Float64(x / Float64(Float64(z - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.45e-13) || ~((y <= 7.6e+25))) tmp = t * (y / (y - z)); else tmp = x / ((z - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.45e-13], N[Not[LessEqual[y, 7.6e+25]], $MachinePrecision]], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-13} \lor \neg \left(y \leq 7.6 \cdot 10^{+25}\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z - y}{t}}\\
\end{array}
\end{array}
if y < -1.4499999999999999e-13 or 7.6000000000000001e25 < y Initial program 99.9%
Taylor expanded in x around 0 81.2%
neg-mul-181.2%
distribute-neg-frac281.2%
neg-sub081.2%
sub-neg81.2%
+-commutative81.2%
associate--r+81.2%
neg-sub081.2%
remove-double-neg81.2%
Simplified81.2%
if -1.4499999999999999e-13 < y < 7.6000000000000001e25Initial program 95.0%
associate-*l/94.9%
associate-/l*92.2%
Simplified92.2%
clear-num92.0%
un-div-inv92.7%
Applied egg-rr92.7%
Taylor expanded in x around inf 74.5%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (<= y -3.1e+71) t (if (<= y 1.95e+26) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.1e+71) {
tmp = t;
} else if (y <= 1.95e+26) {
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 <= (-3.1d+71)) then
tmp = t
else if (y <= 1.95d+26) 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 <= -3.1e+71) {
tmp = t;
} else if (y <= 1.95e+26) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.1e+71: tmp = t elif y <= 1.95e+26: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.1e+71) tmp = t; elseif (y <= 1.95e+26) 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 <= -3.1e+71) tmp = t; elseif (y <= 1.95e+26) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.1e+71], t, If[LessEqual[y, 1.95e+26], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+71}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+26}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.10000000000000018e71 or 1.95e26 < y Initial program 99.9%
associate-*l/75.5%
associate-/l*70.9%
Simplified70.9%
Taylor expanded in y around inf 67.1%
if -3.10000000000000018e71 < y < 1.95e26Initial program 95.6%
Taylor expanded in y around 0 59.5%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (<= y -3.8e+70) t (if (<= y 2.85e-24) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.8e+70) {
tmp = t;
} else if (y <= 2.85e-24) {
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 <= (-3.8d+70)) then
tmp = t
else if (y <= 2.85d-24) 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 <= -3.8e+70) {
tmp = t;
} else if (y <= 2.85e-24) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.8e+70: tmp = t elif y <= 2.85e-24: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.8e+70) tmp = t; elseif (y <= 2.85e-24) 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 <= -3.8e+70) tmp = t; elseif (y <= 2.85e-24) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.8e+70], t, If[LessEqual[y, 2.85e-24], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+70}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{-24}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.7999999999999998e70 or 2.85000000000000001e-24 < y Initial program 99.9%
associate-*l/78.4%
associate-/l*71.8%
Simplified71.8%
Taylor expanded in y around inf 61.2%
if -3.7999999999999998e70 < y < 2.85000000000000001e-24Initial program 95.1%
associate-*l/94.4%
associate-/l*92.2%
Simplified92.2%
clear-num91.6%
associate-/r/92.1%
Applied egg-rr92.1%
Taylor expanded in y around 0 60.3%
*-commutative60.3%
associate-*r/58.8%
Simplified58.8%
(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 97.3%
associate-*l/87.2%
associate-/l*83.1%
Simplified83.1%
Taylor expanded in y around inf 35.1%
(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 2024151
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (/ t (/ (- z y) (- x y))))
(* (/ (- x y) (- z y)) t))