
(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 96.8%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ (- y x) y))))
(if (<= y -1.8e+68)
t_1
(if (<= y -5200000.0)
(* t (/ (- x y) z))
(if (or (<= y -1.25e-85) (not (<= y 1.9e-16)))
t_1
(* t (/ x (- z y))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * ((y - x) / y);
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -5200000.0) {
tmp = t * ((x - y) / z);
} else if ((y <= -1.25e-85) || !(y <= 1.9e-16)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * ((y - x) / y)
if (y <= (-1.8d+68)) then
tmp = t_1
else if (y <= (-5200000.0d0)) then
tmp = t * ((x - y) / z)
else if ((y <= (-1.25d-85)) .or. (.not. (y <= 1.9d-16))) then
tmp = t_1
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 t_1 = t * ((y - x) / y);
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -5200000.0) {
tmp = t * ((x - y) / z);
} else if ((y <= -1.25e-85) || !(y <= 1.9e-16)) {
tmp = t_1;
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): t_1 = t * ((y - x) / y) tmp = 0 if y <= -1.8e+68: tmp = t_1 elif y <= -5200000.0: tmp = t * ((x - y) / z) elif (y <= -1.25e-85) or not (y <= 1.9e-16): tmp = t_1 else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(Float64(y - x) / y)) tmp = 0.0 if (y <= -1.8e+68) tmp = t_1; elseif (y <= -5200000.0) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif ((y <= -1.25e-85) || !(y <= 1.9e-16)) tmp = t_1; else tmp = Float64(t * Float64(x / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * ((y - x) / y); tmp = 0.0; if (y <= -1.8e+68) tmp = t_1; elseif (y <= -5200000.0) tmp = t * ((x - y) / z); elseif ((y <= -1.25e-85) || ~((y <= 1.9e-16))) tmp = t_1; else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+68], t$95$1, If[LessEqual[y, -5200000.0], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.25e-85], N[Not[LessEqual[y, 1.9e-16]], $MachinePrecision]], t$95$1, N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - x}{y}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5200000:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{-85} \lor \neg \left(y \leq 1.9 \cdot 10^{-16}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if y < -1.7999999999999999e68 or -5.2e6 < y < -1.25e-85 or 1.90000000000000006e-16 < y Initial program 99.9%
associate-*l/79.1%
*-commutative79.1%
associate-*l/74.9%
Simplified74.9%
Taylor expanded in z around 0 66.2%
associate-*r/66.2%
neg-mul-166.2%
distribute-rgt-neg-in66.2%
associate-/l*84.3%
neg-sub084.3%
associate--r-84.3%
neg-sub084.3%
Simplified84.3%
Taylor expanded in t around 0 66.2%
associate-/l*84.3%
Simplified84.3%
clear-num84.2%
associate-/r/84.3%
clear-num84.3%
Applied egg-rr84.3%
if -1.7999999999999999e68 < y < -5.2e6Initial program 99.9%
Taylor expanded in z around inf 85.2%
if -1.25e-85 < y < 1.90000000000000006e-16Initial program 92.4%
Taylor expanded in x around inf 86.0%
Final simplification85.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (/ y (- y x)))))
(if (<= y -1.8e+68)
t_1
(if (<= y -1300000.0)
(* t (/ (- x y) z))
(if (<= y -1.16e-85)
t_1
(if (<= y 4.5e-16) (* t (/ x (- z y))) (* t (/ (- y x) y))))))))
double code(double x, double y, double z, double t) {
double t_1 = t / (y / (y - x));
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -1300000.0) {
tmp = t * ((x - y) / z);
} else if (y <= -1.16e-85) {
tmp = t_1;
} else if (y <= 4.5e-16) {
tmp = t * (x / (z - y));
} else {
tmp = t * ((y - 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) :: t_1
real(8) :: tmp
t_1 = t / (y / (y - x))
if (y <= (-1.8d+68)) then
tmp = t_1
else if (y <= (-1300000.0d0)) then
tmp = t * ((x - y) / z)
else if (y <= (-1.16d-85)) then
tmp = t_1
else if (y <= 4.5d-16) then
tmp = t * (x / (z - y))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t / (y / (y - x));
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -1300000.0) {
tmp = t * ((x - y) / z);
} else if (y <= -1.16e-85) {
tmp = t_1;
} else if (y <= 4.5e-16) {
tmp = t * (x / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (y / (y - x)) tmp = 0 if y <= -1.8e+68: tmp = t_1 elif y <= -1300000.0: tmp = t * ((x - y) / z) elif y <= -1.16e-85: tmp = t_1 elif y <= 4.5e-16: tmp = t * (x / (z - y)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(y / Float64(y - x))) tmp = 0.0 if (y <= -1.8e+68) tmp = t_1; elseif (y <= -1300000.0) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (y <= -1.16e-85) tmp = t_1; elseif (y <= 4.5e-16) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (y / (y - x)); tmp = 0.0; if (y <= -1.8e+68) tmp = t_1; elseif (y <= -1300000.0) tmp = t * ((x - y) / z); elseif (y <= -1.16e-85) tmp = t_1; elseif (y <= 4.5e-16) tmp = t * (x / (z - y)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+68], t$95$1, If[LessEqual[y, -1300000.0], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.16e-85], t$95$1, If[LessEqual[y, 4.5e-16], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y}{y - x}}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1300000:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;y \leq -1.16 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-16}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if y < -1.7999999999999999e68 or -1.3e6 < y < -1.16e-85Initial program 99.9%
associate-*l/73.8%
*-commutative73.8%
associate-*l/76.2%
Simplified76.2%
Taylor expanded in z around 0 63.7%
associate-*r/63.7%
neg-mul-163.7%
distribute-rgt-neg-in63.7%
associate-/l*87.2%
neg-sub087.2%
associate--r-87.2%
neg-sub087.2%
Simplified87.2%
Taylor expanded in t around 0 63.7%
associate-/l*87.2%
Simplified87.2%
if -1.7999999999999999e68 < y < -1.3e6Initial program 99.9%
Taylor expanded in z around inf 85.2%
if -1.16e-85 < y < 4.5000000000000002e-16Initial program 92.4%
Taylor expanded in x around inf 86.0%
if 4.5000000000000002e-16 < y Initial program 99.9%
associate-*l/84.6%
*-commutative84.6%
associate-*l/73.5%
Simplified73.5%
Taylor expanded in z around 0 68.8%
associate-*r/68.8%
neg-mul-168.8%
distribute-rgt-neg-in68.8%
associate-/l*81.3%
neg-sub081.3%
associate--r-81.3%
neg-sub081.3%
Simplified81.3%
Taylor expanded in t around 0 68.8%
associate-/l*81.3%
Simplified81.3%
clear-num81.1%
associate-/r/81.3%
clear-num81.3%
Applied egg-rr81.3%
Final simplification85.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (/ y (- y x)))))
(if (<= y -1.8e+68)
t_1
(if (<= y -0.0013)
(/ t (/ z (- x y)))
(if (<= y -1.25e-85)
t_1
(if (<= y 4.6e-17) (* t (/ x (- z y))) (* t (/ (- y x) y))))))))
double code(double x, double y, double z, double t) {
double t_1 = t / (y / (y - x));
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -0.0013) {
tmp = t / (z / (x - y));
} else if (y <= -1.25e-85) {
tmp = t_1;
} else if (y <= 4.6e-17) {
tmp = t * (x / (z - y));
} else {
tmp = t * ((y - 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) :: t_1
real(8) :: tmp
t_1 = t / (y / (y - x))
if (y <= (-1.8d+68)) then
tmp = t_1
else if (y <= (-0.0013d0)) then
tmp = t / (z / (x - y))
else if (y <= (-1.25d-85)) then
tmp = t_1
else if (y <= 4.6d-17) then
tmp = t * (x / (z - y))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t / (y / (y - x));
double tmp;
if (y <= -1.8e+68) {
tmp = t_1;
} else if (y <= -0.0013) {
tmp = t / (z / (x - y));
} else if (y <= -1.25e-85) {
tmp = t_1;
} else if (y <= 4.6e-17) {
tmp = t * (x / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (y / (y - x)) tmp = 0 if y <= -1.8e+68: tmp = t_1 elif y <= -0.0013: tmp = t / (z / (x - y)) elif y <= -1.25e-85: tmp = t_1 elif y <= 4.6e-17: tmp = t * (x / (z - y)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(y / Float64(y - x))) tmp = 0.0 if (y <= -1.8e+68) tmp = t_1; elseif (y <= -0.0013) tmp = Float64(t / Float64(z / Float64(x - y))); elseif (y <= -1.25e-85) tmp = t_1; elseif (y <= 4.6e-17) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (y / (y - x)); tmp = 0.0; if (y <= -1.8e+68) tmp = t_1; elseif (y <= -0.0013) tmp = t / (z / (x - y)); elseif (y <= -1.25e-85) tmp = t_1; elseif (y <= 4.6e-17) tmp = t * (x / (z - y)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+68], t$95$1, If[LessEqual[y, -0.0013], N[(t / N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.25e-85], t$95$1, If[LessEqual[y, 4.6e-17], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y}{y - x}}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -0.0013:\\
\;\;\;\;\frac{t}{\frac{z}{x - y}}\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-17}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if y < -1.7999999999999999e68 or -0.0012999999999999999 < y < -1.25e-85Initial program 99.9%
associate-*l/73.8%
*-commutative73.8%
associate-*l/76.2%
Simplified76.2%
Taylor expanded in z around 0 63.7%
associate-*r/63.7%
neg-mul-163.7%
distribute-rgt-neg-in63.7%
associate-/l*87.2%
neg-sub087.2%
associate--r-87.2%
neg-sub087.2%
Simplified87.2%
Taylor expanded in t around 0 63.7%
associate-/l*87.2%
Simplified87.2%
if -1.7999999999999999e68 < y < -0.0012999999999999999Initial program 99.9%
associate-*l/85.0%
*-commutative85.0%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in z around inf 70.5%
associate-/l*85.4%
Simplified85.4%
if -1.25e-85 < y < 4.60000000000000018e-17Initial program 92.4%
Taylor expanded in x around inf 86.0%
if 4.60000000000000018e-17 < y Initial program 99.9%
associate-*l/84.6%
*-commutative84.6%
associate-*l/73.5%
Simplified73.5%
Taylor expanded in z around 0 68.8%
associate-*r/68.8%
neg-mul-168.8%
distribute-rgt-neg-in68.8%
associate-/l*81.3%
neg-sub081.3%
associate--r-81.3%
neg-sub081.3%
Simplified81.3%
Taylor expanded in t around 0 68.8%
associate-/l*81.3%
Simplified81.3%
clear-num81.1%
associate-/r/81.3%
clear-num81.3%
Applied egg-rr81.3%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e+135) (not (<= y 1.95e+192))) (* t (/ (- y x) y)) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+135) || !(y <= 1.95e+192)) {
tmp = t * ((y - x) / y);
} 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+135)) .or. (.not. (y <= 1.95d+192))) then
tmp = t * ((y - x) / y)
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+135) || !(y <= 1.95e+192)) {
tmp = t * ((y - x) / y);
} else {
tmp = (x - y) * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e+135) or not (y <= 1.95e+192): tmp = t * ((y - x) / y) else: tmp = (x - y) * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e+135) || !(y <= 1.95e+192)) tmp = Float64(t * Float64(Float64(y - x) / y)); 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+135) || ~((y <= 1.95e+192))) tmp = t * ((y - x) / y); else tmp = (x - y) * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+135], N[Not[LessEqual[y, 1.95e+192]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $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 -3.4 \cdot 10^{+135} \lor \neg \left(y \leq 1.95 \cdot 10^{+192}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -3.4000000000000001e135 or 1.9499999999999999e192 < y Initial program 99.9%
associate-*l/72.7%
*-commutative72.7%
associate-*l/52.3%
Simplified52.3%
Taylor expanded in z around 0 67.8%
associate-*r/67.8%
neg-mul-167.8%
distribute-rgt-neg-in67.8%
associate-/l*91.8%
neg-sub091.8%
associate--r-91.8%
neg-sub091.8%
Simplified91.8%
Taylor expanded in t around 0 67.8%
associate-/l*91.8%
Simplified91.8%
clear-num91.6%
associate-/r/91.8%
clear-num91.8%
Applied egg-rr91.8%
if -3.4000000000000001e135 < y < 1.9499999999999999e192Initial program 95.9%
associate-*l/87.0%
*-commutative87.0%
associate-*l/92.1%
Simplified92.1%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.8e+68) t (if (<= y 7e-16) (* (- x y) (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+68) {
tmp = t;
} else if (y <= 7e-16) {
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 <= (-1.8d+68)) then
tmp = t
else if (y <= 7d-16) 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 <= -1.8e+68) {
tmp = t;
} else if (y <= 7e-16) {
tmp = (x - y) * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e+68: tmp = t elif y <= 7e-16: tmp = (x - y) * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e+68) tmp = t; elseif (y <= 7e-16) 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 <= -1.8e+68) tmp = t; elseif (y <= 7e-16) tmp = (x - y) * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e+68], t, If[LessEqual[y, 7e-16], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+68}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-16}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.7999999999999999e68 or 7.00000000000000035e-16 < y Initial program 99.9%
associate-*l/77.3%
*-commutative77.3%
associate-*l/73.0%
Simplified73.0%
Taylor expanded in y around inf 69.1%
if -1.7999999999999999e68 < y < 7.00000000000000035e-16Initial program 93.9%
associate-*l/89.7%
*-commutative89.7%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in z around inf 73.1%
associate-/l*76.0%
associate-/r/73.6%
Simplified73.6%
Final simplification71.4%
(FPCore (x y z t) :precision binary64 (if (<= y -2.1e+69) t (if (<= y 0.14) (* t (/ x (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.1e+69) {
tmp = t;
} else if (y <= 0.14) {
tmp = t * (x / (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 <= (-2.1d+69)) then
tmp = t
else if (y <= 0.14d0) then
tmp = t * (x / (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 <= -2.1e+69) {
tmp = t;
} else if (y <= 0.14) {
tmp = t * (x / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.1e+69: tmp = t elif y <= 0.14: tmp = t * (x / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.1e+69) tmp = t; elseif (y <= 0.14) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.1e+69) tmp = t; elseif (y <= 0.14) tmp = t * (x / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.1e+69], t, If[LessEqual[y, 0.14], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+69}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 0.14:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.10000000000000015e69 or 0.14000000000000001 < y Initial program 99.9%
associate-*l/76.6%
*-commutative76.6%
associate-*l/72.1%
Simplified72.1%
Taylor expanded in y around inf 70.5%
if -2.10000000000000015e69 < y < 0.14000000000000001Initial program 94.1%
Taylor expanded in x around inf 80.7%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (if (<= y -4.1e+69) t (if (<= y 1e-16) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+69) {
tmp = t;
} else if (y <= 1e-16) {
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 <= (-4.1d+69)) then
tmp = t
else if (y <= 1d-16) 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 <= -4.1e+69) {
tmp = t;
} else if (y <= 1e-16) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.1e+69: tmp = t elif y <= 1e-16: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.1e+69) tmp = t; elseif (y <= 1e-16) 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 <= -4.1e+69) tmp = t; elseif (y <= 1e-16) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.1e+69], t, If[LessEqual[y, 1e-16], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+69}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 10^{-16}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -4.0999999999999999e69 or 9.9999999999999998e-17 < y Initial program 99.9%
associate-*l/77.3%
*-commutative77.3%
associate-*l/73.0%
Simplified73.0%
Taylor expanded in y around inf 69.1%
if -4.0999999999999999e69 < y < 9.9999999999999998e-17Initial program 93.9%
associate-*l/89.7%
*-commutative89.7%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in y around 0 66.5%
associate-/l*70.1%
associate-/r/66.2%
Simplified66.2%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.8e+68) t (if (<= y 2.5e-16) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+68) {
tmp = t;
} else if (y <= 2.5e-16) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.8d+68)) then
tmp = t
else if (y <= 2.5d-16) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+68) {
tmp = t;
} else if (y <= 2.5e-16) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e+68: tmp = t elif y <= 2.5e-16: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e+68) tmp = t; elseif (y <= 2.5e-16) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.8e+68) tmp = t; elseif (y <= 2.5e-16) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e+68], t, If[LessEqual[y, 2.5e-16], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+68}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-16}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.7999999999999999e68 or 2.5000000000000002e-16 < y Initial program 99.9%
associate-*l/77.3%
*-commutative77.3%
associate-*l/73.0%
Simplified73.0%
Taylor expanded in y around inf 69.1%
if -1.7999999999999999e68 < y < 2.5000000000000002e-16Initial program 93.9%
Taylor expanded in y around 0 70.1%
Final simplification69.6%
(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.8%
associate-*l/83.7%
*-commutative83.7%
associate-*l/82.9%
Simplified82.9%
Taylor expanded in y around inf 38.6%
Final simplification38.6%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t / ((z - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2023320
(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))