
(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 95.4%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ (/ x y) -1.0) (- t))))
(if (<= y -5e+46)
t_1
(if (<= y -9.6e-255)
(/ t (/ (- z y) x))
(if (<= y 1.3e-153)
(/ (- x y) (/ z t))
(if (<= y 450.0)
(/ (* x t) (- z y))
(if (<= y 4.5e+87) (* t (/ y (- y z))) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) + -1.0) * -t;
double tmp;
if (y <= -5e+46) {
tmp = t_1;
} else if (y <= -9.6e-255) {
tmp = t / ((z - y) / x);
} else if (y <= 1.3e-153) {
tmp = (x - y) / (z / t);
} else if (y <= 450.0) {
tmp = (x * t) / (z - y);
} else if (y <= 4.5e+87) {
tmp = t * (y / (y - z));
} 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 = ((x / y) + (-1.0d0)) * -t
if (y <= (-5d+46)) then
tmp = t_1
else if (y <= (-9.6d-255)) then
tmp = t / ((z - y) / x)
else if (y <= 1.3d-153) then
tmp = (x - y) / (z / t)
else if (y <= 450.0d0) then
tmp = (x * t) / (z - y)
else if (y <= 4.5d+87) then
tmp = t * (y / (y - z))
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 = ((x / y) + -1.0) * -t;
double tmp;
if (y <= -5e+46) {
tmp = t_1;
} else if (y <= -9.6e-255) {
tmp = t / ((z - y) / x);
} else if (y <= 1.3e-153) {
tmp = (x - y) / (z / t);
} else if (y <= 450.0) {
tmp = (x * t) / (z - y);
} else if (y <= 4.5e+87) {
tmp = t * (y / (y - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) + -1.0) * -t tmp = 0 if y <= -5e+46: tmp = t_1 elif y <= -9.6e-255: tmp = t / ((z - y) / x) elif y <= 1.3e-153: tmp = (x - y) / (z / t) elif y <= 450.0: tmp = (x * t) / (z - y) elif y <= 4.5e+87: tmp = t * (y / (y - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) + -1.0) * Float64(-t)) tmp = 0.0 if (y <= -5e+46) tmp = t_1; elseif (y <= -9.6e-255) tmp = Float64(t / Float64(Float64(z - y) / x)); elseif (y <= 1.3e-153) tmp = Float64(Float64(x - y) / Float64(z / t)); elseif (y <= 450.0) tmp = Float64(Float64(x * t) / Float64(z - y)); elseif (y <= 4.5e+87) tmp = Float64(t * Float64(y / Float64(y - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) + -1.0) * -t; tmp = 0.0; if (y <= -5e+46) tmp = t_1; elseif (y <= -9.6e-255) tmp = t / ((z - y) / x); elseif (y <= 1.3e-153) tmp = (x - y) / (z / t); elseif (y <= 450.0) tmp = (x * t) / (z - y); elseif (y <= 4.5e+87) tmp = t * (y / (y - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] + -1.0), $MachinePrecision] * (-t)), $MachinePrecision]}, If[LessEqual[y, -5e+46], t$95$1, If[LessEqual[y, -9.6e-255], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-153], N[(N[(x - y), $MachinePrecision] / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 450.0], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+87], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{x}{y} + -1\right) \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{+46}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -9.6 \cdot 10^{-255}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-153}:\\
\;\;\;\;\frac{x - y}{\frac{z}{t}}\\
\mathbf{elif}\;y \leq 450:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+87}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.0000000000000002e46 or 4.5000000000000003e87 < y Initial program 99.8%
Taylor expanded in z around 0 88.5%
mul-1-neg88.5%
div-sub88.6%
sub-neg88.6%
*-inverses88.6%
metadata-eval88.6%
Simplified88.6%
if -5.0000000000000002e46 < y < -9.5999999999999993e-255Initial program 95.1%
associate-*l/94.2%
*-commutative94.2%
associate-*l/89.3%
Simplified89.3%
*-commutative89.3%
clear-num88.4%
div-inv89.2%
div-inv89.2%
associate-/r*95.1%
Applied egg-rr95.1%
Taylor expanded in x around inf 78.9%
associate-/l*80.3%
Simplified80.3%
if -9.5999999999999993e-255 < y < 1.3000000000000001e-153Initial program 88.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in z around inf 98.2%
if 1.3000000000000001e-153 < y < 450Initial program 91.1%
associate-*l/96.0%
*-commutative96.0%
associate-*l/94.5%
Simplified94.5%
Taylor expanded in x around inf 74.2%
if 450 < y < 4.5000000000000003e87Initial program 99.8%
Taylor expanded in x around 0 76.5%
neg-mul-176.5%
distribute-neg-frac76.5%
Simplified76.5%
frac-2neg76.5%
remove-double-neg76.5%
associate-*l/69.7%
sub-neg69.7%
distribute-neg-in69.7%
remove-double-neg69.7%
Applied egg-rr69.7%
associate-/l*76.3%
associate-/r/76.5%
+-commutative76.5%
unsub-neg76.5%
Simplified76.5%
Final simplification84.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- z y)))))
(if (<= y -1.42e+47)
t
(if (<= y 1100.0)
t_1
(if (<= y 1.02e+119) (* t (/ (- y) z)) (if (<= y 2.2e+157) t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -1.42e+47) {
tmp = t;
} else if (y <= 1100.0) {
tmp = t_1;
} else if (y <= 1.02e+119) {
tmp = t * (-y / z);
} else if (y <= 2.2e+157) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z - y))
if (y <= (-1.42d+47)) then
tmp = t
else if (y <= 1100.0d0) then
tmp = t_1
else if (y <= 1.02d+119) then
tmp = t * (-y / z)
else if (y <= 2.2d+157) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -1.42e+47) {
tmp = t;
} else if (y <= 1100.0) {
tmp = t_1;
} else if (y <= 1.02e+119) {
tmp = t * (-y / z);
} else if (y <= 2.2e+157) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z - y)) tmp = 0 if y <= -1.42e+47: tmp = t elif y <= 1100.0: tmp = t_1 elif y <= 1.02e+119: tmp = t * (-y / z) elif y <= 2.2e+157: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z - y))) tmp = 0.0 if (y <= -1.42e+47) tmp = t; elseif (y <= 1100.0) tmp = t_1; elseif (y <= 1.02e+119) tmp = Float64(t * Float64(Float64(-y) / z)); elseif (y <= 2.2e+157) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z - y)); tmp = 0.0; if (y <= -1.42e+47) tmp = t; elseif (y <= 1100.0) tmp = t_1; elseif (y <= 1.02e+119) tmp = t * (-y / z); elseif (y <= 2.2e+157) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.42e+47], t, If[LessEqual[y, 1100.0], t$95$1, If[LessEqual[y, 1.02e+119], N[(t * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+157], t$95$1, t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;y \leq -1.42 \cdot 10^{+47}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1100:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+119}:\\
\;\;\;\;t \cdot \frac{-y}{z}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+157}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.42e47 or 2.2000000000000001e157 < y Initial program 99.9%
associate-*l/68.8%
*-commutative68.8%
associate-*l/68.5%
Simplified68.5%
Taylor expanded in y around inf 76.1%
if -1.42e47 < y < 1100 or 1.02e119 < y < 2.2000000000000001e157Initial program 92.7%
Taylor expanded in x around inf 77.3%
if 1100 < y < 1.02e119Initial program 99.8%
Taylor expanded in x around 0 72.1%
neg-mul-172.1%
distribute-neg-frac72.1%
Simplified72.1%
Taylor expanded in y around 0 57.4%
mul-1-neg57.4%
distribute-neg-frac57.4%
Simplified57.4%
Final simplification75.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ y (- y z)))))
(if (<= y -2.25e+44)
t_1
(if (<= y -1.46e-255)
(/ t (/ (- z y) x))
(if (<= y 1.06e-153)
(/ (- x y) (/ z t))
(if (<= y 0.118) (/ (* x t) (- z 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.25e+44) {
tmp = t_1;
} else if (y <= -1.46e-255) {
tmp = t / ((z - y) / x);
} else if (y <= 1.06e-153) {
tmp = (x - y) / (z / t);
} else if (y <= 0.118) {
tmp = (x * t) / (z - 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.25d+44)) then
tmp = t_1
else if (y <= (-1.46d-255)) then
tmp = t / ((z - y) / x)
else if (y <= 1.06d-153) then
tmp = (x - y) / (z / t)
else if (y <= 0.118d0) then
tmp = (x * t) / (z - 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.25e+44) {
tmp = t_1;
} else if (y <= -1.46e-255) {
tmp = t / ((z - y) / x);
} else if (y <= 1.06e-153) {
tmp = (x - y) / (z / t);
} else if (y <= 0.118) {
tmp = (x * t) / (z - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (y / (y - z)) tmp = 0 if y <= -2.25e+44: tmp = t_1 elif y <= -1.46e-255: tmp = t / ((z - y) / x) elif y <= 1.06e-153: tmp = (x - y) / (z / t) elif y <= 0.118: tmp = (x * t) / (z - 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.25e+44) tmp = t_1; elseif (y <= -1.46e-255) tmp = Float64(t / Float64(Float64(z - y) / x)); elseif (y <= 1.06e-153) tmp = Float64(Float64(x - y) / Float64(z / t)); elseif (y <= 0.118) tmp = Float64(Float64(x * t) / Float64(z - 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.25e+44) tmp = t_1; elseif (y <= -1.46e-255) tmp = t / ((z - y) / x); elseif (y <= 1.06e-153) tmp = (x - y) / (z / t); elseif (y <= 0.118) tmp = (x * t) / (z - 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.25e+44], t$95$1, If[LessEqual[y, -1.46e-255], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e-153], N[(N[(x - y), $MachinePrecision] / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.118], N[(N[(x * t), $MachinePrecision] / N[(z - 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.25 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.46 \cdot 10^{-255}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-153}:\\
\;\;\;\;\frac{x - y}{\frac{z}{t}}\\
\mathbf{elif}\;y \leq 0.118:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2.25e44 or 0.11799999999999999 < y Initial program 99.8%
Taylor expanded in x around 0 78.9%
neg-mul-178.9%
distribute-neg-frac78.9%
Simplified78.9%
frac-2neg78.9%
remove-double-neg78.9%
associate-*l/57.6%
sub-neg57.6%
distribute-neg-in57.6%
remove-double-neg57.6%
Applied egg-rr57.6%
associate-/l*56.9%
associate-/r/78.9%
+-commutative78.9%
unsub-neg78.9%
Simplified78.9%
if -2.25e44 < y < -1.46e-255Initial program 95.1%
associate-*l/94.2%
*-commutative94.2%
associate-*l/89.2%
Simplified89.2%
*-commutative89.2%
clear-num88.2%
div-inv89.1%
div-inv89.1%
associate-/r*95.0%
Applied egg-rr95.0%
Taylor expanded in x around inf 80.0%
associate-/l*81.4%
Simplified81.4%
if -1.46e-255 < y < 1.06e-153Initial program 88.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in z around inf 98.2%
if 1.06e-153 < y < 0.11799999999999999Initial program 91.1%
associate-*l/96.0%
*-commutative96.0%
associate-*l/94.5%
Simplified94.5%
Taylor expanded in x around inf 74.2%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e+107) (not (<= y 2e+113))) (* (+ (/ x y) -1.0) (- t)) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+107) || !(y <= 2e+113)) {
tmp = ((x / y) + -1.0) * -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 <= (-1.3d+107)) .or. (.not. (y <= 2d+113))) then
tmp = ((x / y) + (-1.0d0)) * -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 <= -1.3e+107) || !(y <= 2e+113)) {
tmp = ((x / y) + -1.0) * -t;
} else {
tmp = (x - y) * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e+107) or not (y <= 2e+113): tmp = ((x / y) + -1.0) * -t else: tmp = (x - y) * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e+107) || !(y <= 2e+113)) tmp = Float64(Float64(Float64(x / y) + -1.0) * Float64(-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 <= -1.3e+107) || ~((y <= 2e+113))) tmp = ((x / y) + -1.0) * -t; else tmp = (x - y) * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e+107], N[Not[LessEqual[y, 2e+113]], $MachinePrecision]], N[(N[(N[(x / y), $MachinePrecision] + -1.0), $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 -1.3 \cdot 10^{+107} \lor \neg \left(y \leq 2 \cdot 10^{+113}\right):\\
\;\;\;\;\left(\frac{x}{y} + -1\right) \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -1.3000000000000001e107 or 2e113 < y Initial program 99.9%
Taylor expanded in z around 0 88.9%
mul-1-neg88.9%
div-sub88.9%
sub-neg88.9%
*-inverses88.9%
metadata-eval88.9%
Simplified88.9%
if -1.3000000000000001e107 < y < 2e113Initial program 93.5%
associate-*l/91.6%
*-commutative91.6%
associate-*l/94.4%
Simplified94.4%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (<= y -5.9e+46) t (if (<= y 82.0) (* t (/ x z)) (if (<= y 3.5e+108) (* y (- (/ t z))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.9e+46) {
tmp = t;
} else if (y <= 82.0) {
tmp = t * (x / z);
} else if (y <= 3.5e+108) {
tmp = y * -(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 <= (-5.9d+46)) then
tmp = t
else if (y <= 82.0d0) then
tmp = t * (x / z)
else if (y <= 3.5d+108) then
tmp = y * -(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 <= -5.9e+46) {
tmp = t;
} else if (y <= 82.0) {
tmp = t * (x / z);
} else if (y <= 3.5e+108) {
tmp = y * -(t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.9e+46: tmp = t elif y <= 82.0: tmp = t * (x / z) elif y <= 3.5e+108: tmp = y * -(t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.9e+46) tmp = t; elseif (y <= 82.0) tmp = Float64(t * Float64(x / z)); elseif (y <= 3.5e+108) tmp = Float64(y * Float64(-Float64(t / z))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.9e+46) tmp = t; elseif (y <= 82.0) tmp = t * (x / z); elseif (y <= 3.5e+108) tmp = y * -(t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.9e+46], t, If[LessEqual[y, 82.0], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e+108], N[(y * (-N[(t / z), $MachinePrecision])), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+46}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 82:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+108}:\\
\;\;\;\;y \cdot \left(-\frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.8999999999999999e46 or 3.5000000000000002e108 < y Initial program 99.9%
associate-*l/70.2%
*-commutative70.2%
associate-*l/70.3%
Simplified70.3%
Taylor expanded in y around inf 71.1%
if -5.8999999999999999e46 < y < 82Initial program 92.2%
Taylor expanded in y around 0 64.9%
if 82 < y < 3.5000000000000002e108Initial program 99.7%
Taylor expanded in x around 0 68.8%
neg-mul-168.8%
distribute-neg-frac68.8%
Simplified68.8%
Taylor expanded in y around 0 53.4%
mul-1-neg53.4%
associate-/l*57.9%
distribute-neg-frac57.9%
Simplified57.9%
Taylor expanded in t around 0 53.4%
mul-1-neg53.4%
associate-*l/57.9%
distribute-rgt-neg-out57.9%
Simplified57.9%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (<= y -5.6e+46) t (if (<= y 1.42) (* t (/ x z)) (if (<= y 3.5e+108) (* t (/ (- y) z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.6e+46) {
tmp = t;
} else if (y <= 1.42) {
tmp = t * (x / z);
} else if (y <= 3.5e+108) {
tmp = t * (-y / 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 <= (-5.6d+46)) then
tmp = t
else if (y <= 1.42d0) then
tmp = t * (x / z)
else if (y <= 3.5d+108) then
tmp = t * (-y / 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 <= -5.6e+46) {
tmp = t;
} else if (y <= 1.42) {
tmp = t * (x / z);
} else if (y <= 3.5e+108) {
tmp = t * (-y / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.6e+46: tmp = t elif y <= 1.42: tmp = t * (x / z) elif y <= 3.5e+108: tmp = t * (-y / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.6e+46) tmp = t; elseif (y <= 1.42) tmp = Float64(t * Float64(x / z)); elseif (y <= 3.5e+108) tmp = Float64(t * Float64(Float64(-y) / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.6e+46) tmp = t; elseif (y <= 1.42) tmp = t * (x / z); elseif (y <= 3.5e+108) tmp = t * (-y / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.6e+46], t, If[LessEqual[y, 1.42], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e+108], N[(t * N[((-y) / z), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+46}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.42:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+108}:\\
\;\;\;\;t \cdot \frac{-y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.60000000000000037e46 or 3.5000000000000002e108 < y Initial program 99.9%
associate-*l/70.2%
*-commutative70.2%
associate-*l/70.3%
Simplified70.3%
Taylor expanded in y around inf 71.1%
if -5.60000000000000037e46 < y < 1.4199999999999999Initial program 92.2%
Taylor expanded in y around 0 64.9%
if 1.4199999999999999 < y < 3.5000000000000002e108Initial program 99.7%
Taylor expanded in x around 0 68.8%
neg-mul-168.8%
distribute-neg-frac68.8%
Simplified68.8%
Taylor expanded in y around 0 58.1%
mul-1-neg58.1%
distribute-neg-frac58.1%
Simplified58.1%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.6e+45) (not (<= y 0.0265))) (* t (/ y (- y z))) (* t (/ x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e+45) || !(y <= 0.0265)) {
tmp = t * (y / (y - z));
} 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.6d+45)) .or. (.not. (y <= 0.0265d0))) then
tmp = t * (y / (y - z))
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.6e+45) || !(y <= 0.0265)) {
tmp = t * (y / (y - z));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.6e+45) or not (y <= 0.0265): tmp = t * (y / (y - z)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.6e+45) || !(y <= 0.0265)) tmp = Float64(t * Float64(y / Float64(y - z))); 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.6e+45) || ~((y <= 0.0265))) tmp = t * (y / (y - z)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.6e+45], N[Not[LessEqual[y, 0.0265]], $MachinePrecision]], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+45} \lor \neg \left(y \leq 0.0265\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if y < -7.6000000000000004e45 or 0.0264999999999999993 < y Initial program 99.8%
Taylor expanded in x around 0 78.9%
neg-mul-178.9%
distribute-neg-frac78.9%
Simplified78.9%
frac-2neg78.9%
remove-double-neg78.9%
associate-*l/57.6%
sub-neg57.6%
distribute-neg-in57.6%
remove-double-neg57.6%
Applied egg-rr57.6%
associate-/l*56.9%
associate-/r/78.9%
+-commutative78.9%
unsub-neg78.9%
Simplified78.9%
if -7.6000000000000004e45 < y < 0.0264999999999999993Initial program 92.2%
Taylor expanded in x around inf 79.3%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (<= y -2.8e-27) t (if (<= y 3.1e+26) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.8e-27) {
tmp = t;
} else if (y <= 3.1e+26) {
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 <= (-2.8d-27)) then
tmp = t
else if (y <= 3.1d+26) 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 <= -2.8e-27) {
tmp = t;
} else if (y <= 3.1e+26) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.8e-27: tmp = t elif y <= 3.1e+26: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.8e-27) tmp = t; elseif (y <= 3.1e+26) 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 <= -2.8e-27) tmp = t; elseif (y <= 3.1e+26) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.8e-27], t, If[LessEqual[y, 3.1e+26], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-27}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.8e-27 or 3.1e26 < y Initial program 99.8%
associate-*l/75.9%
*-commutative75.9%
associate-*l/74.3%
Simplified74.3%
Taylor expanded in y around inf 60.2%
if -2.8e-27 < y < 3.1e26Initial program 91.8%
associate-*l/92.0%
*-commutative92.0%
associate-*l/95.2%
Simplified95.2%
*-commutative95.2%
clear-num94.3%
div-inv94.8%
div-inv94.7%
associate-/r*91.7%
Applied egg-rr91.7%
Taylor expanded in y around 0 64.2%
associate-*l/67.0%
Simplified67.0%
Final simplification63.9%
(FPCore (x y z t) :precision binary64 (if (<= y -5.6e+46) t (if (<= y 4.9e+20) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.6e+46) {
tmp = t;
} else if (y <= 4.9e+20) {
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 <= (-5.6d+46)) then
tmp = t
else if (y <= 4.9d+20) 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 <= -5.6e+46) {
tmp = t;
} else if (y <= 4.9e+20) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.6e+46: tmp = t elif y <= 4.9e+20: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.6e+46) tmp = t; elseif (y <= 4.9e+20) 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 <= -5.6e+46) tmp = t; elseif (y <= 4.9e+20) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.6e+46], t, If[LessEqual[y, 4.9e+20], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+46}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+20}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.60000000000000037e46 or 4.9e20 < y Initial program 99.8%
associate-*l/72.8%
*-commutative72.8%
associate-*l/73.8%
Simplified73.8%
Taylor expanded in y around inf 65.4%
if -5.60000000000000037e46 < y < 4.9e20Initial program 92.5%
Taylor expanded in y around 0 63.5%
Final simplification64.3%
(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 95.4%
associate-*l/84.8%
*-commutative84.8%
associate-*l/85.9%
Simplified85.9%
Taylor expanded in y around inf 31.0%
Final simplification31.0%
(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 2023336
(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))