
(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.5%
Final simplification97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- z y)))))
(if (<= y -5.4e+25)
t
(if (<= y -4.45e-150)
t_1
(if (<= y -1.28e-217)
(* (- x y) (/ t z))
(if (<= y 4.2e+34)
t_1
(if (<= y 1.65e+182) (* y (/ t (- y z))) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -5.4e+25) {
tmp = t;
} else if (y <= -4.45e-150) {
tmp = t_1;
} else if (y <= -1.28e-217) {
tmp = (x - y) * (t / z);
} else if (y <= 4.2e+34) {
tmp = t_1;
} else if (y <= 1.65e+182) {
tmp = y * (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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z - y))
if (y <= (-5.4d+25)) then
tmp = t
else if (y <= (-4.45d-150)) then
tmp = t_1
else if (y <= (-1.28d-217)) then
tmp = (x - y) * (t / z)
else if (y <= 4.2d+34) then
tmp = t_1
else if (y <= 1.65d+182) then
tmp = y * (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 t_1 = t * (x / (z - y));
double tmp;
if (y <= -5.4e+25) {
tmp = t;
} else if (y <= -4.45e-150) {
tmp = t_1;
} else if (y <= -1.28e-217) {
tmp = (x - y) * (t / z);
} else if (y <= 4.2e+34) {
tmp = t_1;
} else if (y <= 1.65e+182) {
tmp = y * (t / (y - z));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z - y)) tmp = 0 if y <= -5.4e+25: tmp = t elif y <= -4.45e-150: tmp = t_1 elif y <= -1.28e-217: tmp = (x - y) * (t / z) elif y <= 4.2e+34: tmp = t_1 elif y <= 1.65e+182: tmp = y * (t / (y - z)) 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 <= -5.4e+25) tmp = t; elseif (y <= -4.45e-150) tmp = t_1; elseif (y <= -1.28e-217) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 4.2e+34) tmp = t_1; elseif (y <= 1.65e+182) tmp = Float64(y * Float64(t / Float64(y - z))); 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 <= -5.4e+25) tmp = t; elseif (y <= -4.45e-150) tmp = t_1; elseif (y <= -1.28e-217) tmp = (x - y) * (t / z); elseif (y <= 4.2e+34) tmp = t_1; elseif (y <= 1.65e+182) tmp = y * (t / (y - z)); 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, -5.4e+25], t, If[LessEqual[y, -4.45e-150], t$95$1, If[LessEqual[y, -1.28e-217], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+34], t$95$1, If[LessEqual[y, 1.65e+182], N[(y * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{+25}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -4.45 \cdot 10^{-150}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.28 \cdot 10^{-217}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+182}:\\
\;\;\;\;y \cdot \frac{t}{y - z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.4e25 or 1.65e182 < y Initial program 99.9%
Taylor expanded in y around inf 75.5%
if -5.4e25 < y < -4.45000000000000005e-150 or -1.28e-217 < y < 4.20000000000000035e34Initial program 97.6%
Taylor expanded in x around inf 74.6%
*-commutative74.6%
associate-/l*74.6%
associate-/r/78.7%
Simplified78.7%
if -4.45000000000000005e-150 < y < -1.28e-217Initial program 83.3%
Taylor expanded in z around inf 94.3%
associate-/l*83.0%
associate-/r/99.6%
Simplified99.6%
if 4.20000000000000035e34 < y < 1.65e182Initial program 99.6%
associate-/r/92.0%
div-inv91.6%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 45.2%
*-commutative45.2%
associate-/l*69.7%
neg-mul-169.7%
distribute-neg-frac69.7%
Simplified69.7%
frac-2neg69.7%
div-inv69.4%
remove-double-neg69.4%
distribute-neg-frac69.4%
sub-neg69.4%
distribute-neg-in69.4%
remove-double-neg69.4%
Applied egg-rr69.4%
associate-/r/69.6%
associate-*l/69.6%
*-lft-identity69.6%
+-commutative69.6%
unsub-neg69.6%
Simplified69.6%
Final simplification78.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -4.6e+52)
t
(if (<= y -3.5)
(* (/ y z) (- t))
(if (<= y -2e-73)
t
(if (<= y 4e-308)
(/ x (/ z t))
(if (<= y 7.8e+108) (/ t (/ z x)) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.6e+52) {
tmp = t;
} else if (y <= -3.5) {
tmp = (y / z) * -t;
} else if (y <= -2e-73) {
tmp = t;
} else if (y <= 4e-308) {
tmp = x / (z / t);
} else if (y <= 7.8e+108) {
tmp = t / (z / x);
} 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 <= (-4.6d+52)) then
tmp = t
else if (y <= (-3.5d0)) then
tmp = (y / z) * -t
else if (y <= (-2d-73)) then
tmp = t
else if (y <= 4d-308) then
tmp = x / (z / t)
else if (y <= 7.8d+108) then
tmp = t / (z / x)
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 <= -4.6e+52) {
tmp = t;
} else if (y <= -3.5) {
tmp = (y / z) * -t;
} else if (y <= -2e-73) {
tmp = t;
} else if (y <= 4e-308) {
tmp = x / (z / t);
} else if (y <= 7.8e+108) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.6e+52: tmp = t elif y <= -3.5: tmp = (y / z) * -t elif y <= -2e-73: tmp = t elif y <= 4e-308: tmp = x / (z / t) elif y <= 7.8e+108: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.6e+52) tmp = t; elseif (y <= -3.5) tmp = Float64(Float64(y / z) * Float64(-t)); elseif (y <= -2e-73) tmp = t; elseif (y <= 4e-308) tmp = Float64(x / Float64(z / t)); elseif (y <= 7.8e+108) tmp = Float64(t / Float64(z / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.6e+52) tmp = t; elseif (y <= -3.5) tmp = (y / z) * -t; elseif (y <= -2e-73) tmp = t; elseif (y <= 4e-308) tmp = x / (z / t); elseif (y <= 7.8e+108) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.6e+52], t, If[LessEqual[y, -3.5], N[(N[(y / z), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[y, -2e-73], t, If[LessEqual[y, 4e-308], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e+108], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+52}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -3.5:\\
\;\;\;\;\frac{y}{z} \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-73}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-308}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+108}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -4.6e52 or -3.5 < y < -1.99999999999999999e-73 or 7.79999999999999969e108 < y Initial program 99.8%
Taylor expanded in y around inf 70.8%
if -4.6e52 < y < -3.5Initial program 100.0%
Taylor expanded in z around inf 89.4%
Taylor expanded in x around 0 68.3%
neg-mul-168.3%
distribute-neg-frac68.3%
Simplified68.3%
if -1.99999999999999999e-73 < y < 4.00000000000000013e-308Initial program 92.3%
associate-/r/97.8%
div-inv97.8%
associate-/r*92.3%
Applied egg-rr92.3%
Taylor expanded in y around 0 78.3%
*-commutative78.3%
associate-/l*81.7%
Simplified81.7%
if 4.00000000000000013e-308 < y < 7.79999999999999969e108Initial program 97.7%
Taylor expanded in y around 0 55.5%
associate-/l*60.6%
Simplified60.6%
Final simplification69.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ t (- y z)))))
(if (<= y -1.75e+229)
t
(if (<= y -1.55e-73)
t_1
(if (<= y 7.6e-19) (/ t (/ z x)) (if (<= y 1.15e+183) t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t / (y - z));
double tmp;
if (y <= -1.75e+229) {
tmp = t;
} else if (y <= -1.55e-73) {
tmp = t_1;
} else if (y <= 7.6e-19) {
tmp = t / (z / x);
} else if (y <= 1.15e+183) {
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 = y * (t / (y - z))
if (y <= (-1.75d+229)) then
tmp = t
else if (y <= (-1.55d-73)) then
tmp = t_1
else if (y <= 7.6d-19) then
tmp = t / (z / x)
else if (y <= 1.15d+183) 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 = y * (t / (y - z));
double tmp;
if (y <= -1.75e+229) {
tmp = t;
} else if (y <= -1.55e-73) {
tmp = t_1;
} else if (y <= 7.6e-19) {
tmp = t / (z / x);
} else if (y <= 1.15e+183) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t / (y - z)) tmp = 0 if y <= -1.75e+229: tmp = t elif y <= -1.55e-73: tmp = t_1 elif y <= 7.6e-19: tmp = t / (z / x) elif y <= 1.15e+183: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t / Float64(y - z))) tmp = 0.0 if (y <= -1.75e+229) tmp = t; elseif (y <= -1.55e-73) tmp = t_1; elseif (y <= 7.6e-19) tmp = Float64(t / Float64(z / x)); elseif (y <= 1.15e+183) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t / (y - z)); tmp = 0.0; if (y <= -1.75e+229) tmp = t; elseif (y <= -1.55e-73) tmp = t_1; elseif (y <= 7.6e-19) tmp = t / (z / x); elseif (y <= 1.15e+183) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.75e+229], t, If[LessEqual[y, -1.55e-73], t$95$1, If[LessEqual[y, 7.6e-19], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e+183], t$95$1, t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t}{y - z}\\
\mathbf{if}\;y \leq -1.75 \cdot 10^{+229}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+183}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.7500000000000001e229 or 1.1499999999999999e183 < y Initial program 99.9%
Taylor expanded in y around inf 86.4%
if -1.7500000000000001e229 < y < -1.54999999999999985e-73 or 7.6e-19 < y < 1.1499999999999999e183Initial program 99.8%
associate-/r/85.3%
div-inv85.1%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 53.8%
*-commutative53.8%
associate-/l*61.6%
neg-mul-161.6%
distribute-neg-frac61.6%
Simplified61.6%
frac-2neg61.6%
div-inv61.4%
remove-double-neg61.4%
distribute-neg-frac61.4%
sub-neg61.4%
distribute-neg-in61.4%
remove-double-neg61.4%
Applied egg-rr61.4%
associate-/r/63.0%
associate-*l/63.1%
*-lft-identity63.1%
+-commutative63.1%
unsub-neg63.1%
Simplified63.1%
if -1.54999999999999985e-73 < y < 7.6e-19Initial program 95.2%
Taylor expanded in y around 0 70.6%
associate-/l*72.2%
Simplified72.2%
Final simplification70.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.7e+229)
t
(if (<= y -1.42e-70)
(* y (/ t (- y z)))
(if (<= y -5.5e-129)
(/ t (/ y (- x)))
(if (<= y 9.4e+108) (* (- x y) (/ t z)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.7e+229) {
tmp = t;
} else if (y <= -1.42e-70) {
tmp = y * (t / (y - z));
} else if (y <= -5.5e-129) {
tmp = t / (y / -x);
} else if (y <= 9.4e+108) {
tmp = (x - 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 <= (-2.7d+229)) then
tmp = t
else if (y <= (-1.42d-70)) then
tmp = y * (t / (y - z))
else if (y <= (-5.5d-129)) then
tmp = t / (y / -x)
else if (y <= 9.4d+108) then
tmp = (x - 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 <= -2.7e+229) {
tmp = t;
} else if (y <= -1.42e-70) {
tmp = y * (t / (y - z));
} else if (y <= -5.5e-129) {
tmp = t / (y / -x);
} else if (y <= 9.4e+108) {
tmp = (x - y) * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.7e+229: tmp = t elif y <= -1.42e-70: tmp = y * (t / (y - z)) elif y <= -5.5e-129: tmp = t / (y / -x) elif y <= 9.4e+108: tmp = (x - y) * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.7e+229) tmp = t; elseif (y <= -1.42e-70) tmp = Float64(y * Float64(t / Float64(y - z))); elseif (y <= -5.5e-129) tmp = Float64(t / Float64(y / Float64(-x))); elseif (y <= 9.4e+108) tmp = Float64(Float64(x - y) * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.7e+229) tmp = t; elseif (y <= -1.42e-70) tmp = y * (t / (y - z)); elseif (y <= -5.5e-129) tmp = t / (y / -x); elseif (y <= 9.4e+108) tmp = (x - y) * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.7e+229], t, If[LessEqual[y, -1.42e-70], N[(y * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.5e-129], N[(t / N[(y / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.4e+108], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+229}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{-70}:\\
\;\;\;\;y \cdot \frac{t}{y - z}\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-129}:\\
\;\;\;\;\frac{t}{\frac{y}{-x}}\\
\mathbf{elif}\;y \leq 9.4 \cdot 10^{+108}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.7e229 or 9.3999999999999991e108 < y Initial program 99.8%
Taylor expanded in y around inf 78.8%
if -2.7e229 < y < -1.42000000000000002e-70Initial program 99.9%
associate-/r/78.4%
div-inv78.3%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 62.9%
*-commutative62.9%
associate-/l*60.8%
neg-mul-160.8%
distribute-neg-frac60.8%
Simplified60.8%
frac-2neg60.8%
div-inv60.6%
remove-double-neg60.6%
distribute-neg-frac60.6%
sub-neg60.6%
distribute-neg-in60.6%
remove-double-neg60.6%
Applied egg-rr60.6%
associate-/r/63.5%
associate-*l/63.6%
*-lft-identity63.6%
+-commutative63.6%
unsub-neg63.6%
Simplified63.6%
if -1.42000000000000002e-70 < y < -5.50000000000000023e-129Initial program 99.6%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
associate-/l*99.8%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in z around 0 71.9%
associate-*r/71.9%
*-commutative71.9%
neg-mul-171.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
associate-/l*71.9%
Simplified71.9%
if -5.50000000000000023e-129 < y < 9.3999999999999991e108Initial program 95.6%
Taylor expanded in z around inf 72.9%
associate-/l*76.4%
associate-/r/75.9%
Simplified75.9%
Final simplification73.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- z y)))) (t_2 (/ t (- 1.0 (/ z y)))))
(if (<= y -1.55e-21)
t_2
(if (<= y -3.9e-148)
t_1
(if (<= y -3.3e-218)
(* (- x y) (/ t z))
(if (<= y 9.8e+33) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double t_2 = t / (1.0 - (z / y));
double tmp;
if (y <= -1.55e-21) {
tmp = t_2;
} else if (y <= -3.9e-148) {
tmp = t_1;
} else if (y <= -3.3e-218) {
tmp = (x - y) * (t / z);
} else if (y <= 9.8e+33) {
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 / (z - y))
t_2 = t / (1.0d0 - (z / y))
if (y <= (-1.55d-21)) then
tmp = t_2
else if (y <= (-3.9d-148)) then
tmp = t_1
else if (y <= (-3.3d-218)) then
tmp = (x - y) * (t / z)
else if (y <= 9.8d+33) 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 / (z - y));
double t_2 = t / (1.0 - (z / y));
double tmp;
if (y <= -1.55e-21) {
tmp = t_2;
} else if (y <= -3.9e-148) {
tmp = t_1;
} else if (y <= -3.3e-218) {
tmp = (x - y) * (t / z);
} else if (y <= 9.8e+33) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z - y)) t_2 = t / (1.0 - (z / y)) tmp = 0 if y <= -1.55e-21: tmp = t_2 elif y <= -3.9e-148: tmp = t_1 elif y <= -3.3e-218: tmp = (x - y) * (t / z) elif y <= 9.8e+33: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z - y))) t_2 = Float64(t / Float64(1.0 - Float64(z / y))) tmp = 0.0 if (y <= -1.55e-21) tmp = t_2; elseif (y <= -3.9e-148) tmp = t_1; elseif (y <= -3.3e-218) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 9.8e+33) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z - y)); t_2 = t / (1.0 - (z / y)); tmp = 0.0; if (y <= -1.55e-21) tmp = t_2; elseif (y <= -3.9e-148) tmp = t_1; elseif (y <= -3.3e-218) tmp = (x - y) * (t / z); elseif (y <= 9.8e+33) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e-21], t$95$2, If[LessEqual[y, -3.9e-148], t$95$1, If[LessEqual[y, -3.3e-218], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e+33], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z - y}\\
t_2 := \frac{t}{1 - \frac{z}{y}}\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{-21}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{-148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-218}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.5499999999999999e-21 or 9.80000000000000027e33 < y Initial program 99.8%
Taylor expanded in x around 0 59.7%
mul-1-neg59.7%
associate-/l*81.5%
distribute-neg-frac81.5%
div-sub81.5%
*-inverses81.5%
Simplified81.5%
frac-2neg81.5%
div-inv81.4%
remove-double-neg81.4%
sub-neg81.4%
metadata-eval81.4%
distribute-neg-in81.4%
metadata-eval81.4%
Applied egg-rr81.4%
associate-*r/81.5%
*-rgt-identity81.5%
neg-mul-181.5%
+-commutative81.5%
neg-mul-181.5%
unsub-neg81.5%
Simplified81.5%
if -1.5499999999999999e-21 < y < -3.89999999999999994e-148 or -3.30000000000000023e-218 < y < 9.80000000000000027e33Initial program 97.4%
Taylor expanded in x around inf 78.2%
*-commutative78.2%
associate-/l*78.2%
associate-/r/82.0%
Simplified82.0%
if -3.89999999999999994e-148 < y < -3.30000000000000023e-218Initial program 83.3%
Taylor expanded in z around inf 94.3%
associate-/l*83.0%
associate-/r/99.6%
Simplified99.6%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (if (<= y -2e-73) t (if (<= y 1.85e+33) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2e-73) {
tmp = t;
} else if (y <= 1.85e+33) {
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 <= (-2d-73)) then
tmp = t
else if (y <= 1.85d+33) 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 <= -2e-73) {
tmp = t;
} else if (y <= 1.85e+33) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2e-73: tmp = t elif y <= 1.85e+33: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2e-73) tmp = t; elseif (y <= 1.85e+33) 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 <= -2e-73) tmp = t; elseif (y <= 1.85e+33) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2e-73], t, If[LessEqual[y, 1.85e+33], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-73}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.99999999999999999e-73 or 1.8499999999999999e33 < y Initial program 99.8%
Taylor expanded in y around inf 62.5%
if -1.99999999999999999e-73 < y < 1.8499999999999999e33Initial program 95.4%
Taylor expanded in y around 0 67.5%
associate-/l*69.7%
associate-/r/68.8%
Simplified68.8%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= y -3e+25) t (if (<= y 7.8e+108) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e+25) {
tmp = t;
} else if (y <= 7.8e+108) {
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 <= (-3d+25)) then
tmp = t
else if (y <= 7.8d+108) 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 <= -3e+25) {
tmp = t;
} else if (y <= 7.8e+108) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3e+25: tmp = t elif y <= 7.8e+108: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3e+25) tmp = t; elseif (y <= 7.8e+108) 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 <= -3e+25) tmp = t; elseif (y <= 7.8e+108) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3e+25], t, If[LessEqual[y, 7.8e+108], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+25}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+108}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.00000000000000006e25 or 7.79999999999999969e108 < y Initial program 99.8%
Taylor expanded in y around inf 73.3%
if -3.00000000000000006e25 < y < 7.79999999999999969e108Initial program 96.3%
Taylor expanded in y around 0 62.7%
Final simplification66.5%
(FPCore (x y z t) :precision binary64 (if (<= y -1.85e+25) t (if (<= y 7.8e+108) (/ t (/ z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.85e+25) {
tmp = t;
} else if (y <= 7.8e+108) {
tmp = t / (z / x);
} 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.85d+25)) then
tmp = t
else if (y <= 7.8d+108) then
tmp = t / (z / x)
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.85e+25) {
tmp = t;
} else if (y <= 7.8e+108) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.85e+25: tmp = t elif y <= 7.8e+108: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.85e+25) tmp = t; elseif (y <= 7.8e+108) tmp = Float64(t / Float64(z / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.85e+25) tmp = t; elseif (y <= 7.8e+108) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.85e+25], t, If[LessEqual[y, 7.8e+108], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{+25}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+108}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.8499999999999999e25 or 7.79999999999999969e108 < y Initial program 99.8%
Taylor expanded in y around inf 73.3%
if -1.8499999999999999e25 < y < 7.79999999999999969e108Initial program 96.3%
Taylor expanded in y around 0 60.2%
associate-/l*63.0%
Simplified63.0%
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 97.5%
Taylor expanded in y around inf 35.3%
Final simplification35.3%
(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 2024031
(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))