
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y x) (/ z t) x))
double code(double x, double y, double z, double t) {
return fma((y - x), (z / t), x);
}
function code(x, y, z, t) return fma(Float64(y - x), Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)
\end{array}
Initial program 98.9%
+-commutative98.9%
fma-def98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= (/ z t) -2e+25)
(and (not (<= (/ z t) -2e-163))
(or (<= (/ z t) -1e-253) (not (<= (/ z t) 2e-10)))))
(* z (/ (- y x) t))
(* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2e+25) || (!((z / t) <= -2e-163) && (((z / t) <= -1e-253) || !((z / t) <= 2e-10)))) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2d+25)) .or. (.not. ((z / t) <= (-2d-163))) .and. ((z / t) <= (-1d-253)) .or. (.not. ((z / t) <= 2d-10))) then
tmp = z * ((y - x) / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2e+25) || (!((z / t) <= -2e-163) && (((z / t) <= -1e-253) || !((z / t) <= 2e-10)))) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2e+25) or (not ((z / t) <= -2e-163) and (((z / t) <= -1e-253) or not ((z / t) <= 2e-10))): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2e+25) || (!(Float64(z / t) <= -2e-163) && ((Float64(z / t) <= -1e-253) || !(Float64(z / t) <= 2e-10)))) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2e+25) || (~(((z / t) <= -2e-163)) && (((z / t) <= -1e-253) || ~(((z / t) <= 2e-10))))) tmp = z * ((y - x) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2e+25], And[N[Not[LessEqual[N[(z / t), $MachinePrecision], -2e-163]], $MachinePrecision], Or[LessEqual[N[(z / t), $MachinePrecision], -1e-253], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-10]], $MachinePrecision]]]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{+25} \lor \neg \left(\frac{z}{t} \leq -2 \cdot 10^{-163}\right) \land \left(\frac{z}{t} \leq -1 \cdot 10^{-253} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-10}\right)\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -2.00000000000000018e25 or -1.99999999999999985e-163 < (/.f64 z t) < -1.0000000000000001e-253 or 2.00000000000000007e-10 < (/.f64 z t) Initial program 98.3%
Taylor expanded in z around -inf 89.8%
Taylor expanded in t around 0 86.7%
associate-*l/92.4%
Applied egg-rr92.4%
if -2.00000000000000018e25 < (/.f64 z t) < -1.99999999999999985e-163 or -1.0000000000000001e-253 < (/.f64 z t) < 2.00000000000000007e-10Initial program 99.5%
Taylor expanded in x around inf 74.0%
*-commutative74.0%
mul-1-neg74.0%
unsub-neg74.0%
distribute-lft-out--74.0%
*-rgt-identity74.0%
Simplified74.0%
Taylor expanded in x around 0 74.0%
Final simplification83.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))))
(if (<= x -7.2e-49)
t_1
(if (<= x 4.7e-163)
(/ y (/ t z))
(if (or (<= x 2.85e+31) (not (<= x 7.8e+43))) t_1 (* z (/ y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -7.2e-49) {
tmp = t_1;
} else if (x <= 4.7e-163) {
tmp = y / (t / z);
} else if ((x <= 2.85e+31) || !(x <= 7.8e+43)) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-7.2d-49)) then
tmp = t_1
else if (x <= 4.7d-163) then
tmp = y / (t / z)
else if ((x <= 2.85d+31) .or. (.not. (x <= 7.8d+43))) then
tmp = t_1
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -7.2e-49) {
tmp = t_1;
} else if (x <= 4.7e-163) {
tmp = y / (t / z);
} else if ((x <= 2.85e+31) || !(x <= 7.8e+43)) {
tmp = t_1;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -7.2e-49: tmp = t_1 elif x <= 4.7e-163: tmp = y / (t / z) elif (x <= 2.85e+31) or not (x <= 7.8e+43): tmp = t_1 else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -7.2e-49) tmp = t_1; elseif (x <= 4.7e-163) tmp = Float64(y / Float64(t / z)); elseif ((x <= 2.85e+31) || !(x <= 7.8e+43)) tmp = t_1; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -7.2e-49) tmp = t_1; elseif (x <= 4.7e-163) tmp = y / (t / z); elseif ((x <= 2.85e+31) || ~((x <= 7.8e+43))) tmp = t_1; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.2e-49], t$95$1, If[LessEqual[x, 4.7e-163], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2.85e+31], N[Not[LessEqual[x, 7.8e+43]], $MachinePrecision]], t$95$1, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{-163}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+43}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -7.19999999999999939e-49 or 4.7e-163 < x < 2.85e31 or 7.8000000000000001e43 < x Initial program 99.3%
Taylor expanded in x around inf 81.9%
*-commutative81.9%
mul-1-neg81.9%
unsub-neg81.9%
distribute-lft-out--81.9%
*-rgt-identity81.9%
Simplified81.9%
Taylor expanded in x around 0 81.9%
if -7.19999999999999939e-49 < x < 4.7e-163Initial program 98.1%
Taylor expanded in z around -inf 92.4%
Taylor expanded in t around 0 79.2%
associate-*l/77.2%
Applied egg-rr77.2%
Taylor expanded in y around inf 75.5%
associate-/l*79.7%
Simplified79.7%
if 2.85e31 < x < 7.8000000000000001e43Initial program 99.7%
Taylor expanded in z around -inf 99.7%
Taylor expanded in t around 0 99.7%
associate-*l/100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 100.0%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2000000.0) (not (<= (/ z t) 0.2))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2000000.0) || !((z / t) <= 0.2)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z / t) <= (-2000000.0d0)) .or. (.not. ((z / t) <= 0.2d0))) then
tmp = z * ((y - x) / t)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2000000.0) || !((z / t) <= 0.2)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2000000.0) or not ((z / t) <= 0.2): tmp = z * ((y - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2000000.0) || !(Float64(z / t) <= 0.2)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2000000.0) || ~(((z / t) <= 0.2))) tmp = z * ((y - x) / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 0.2]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2000000 \lor \neg \left(\frac{z}{t} \leq 0.2\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e6 or 0.20000000000000001 < (/.f64 z t) Initial program 98.2%
Taylor expanded in z around -inf 89.7%
Taylor expanded in t around 0 87.8%
associate-*l/94.1%
Applied egg-rr94.1%
if -2e6 < (/.f64 z t) < 0.20000000000000001Initial program 99.5%
Taylor expanded in y around inf 93.4%
associate-*r/97.9%
Simplified97.9%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -2000000.0) (/ z (/ t (- y x))) (if (<= (/ z t) 0.2) (+ x (* y (/ z t))) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2000000.0) {
tmp = z / (t / (y - x));
} else if ((z / t) <= 0.2) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z / t) <= (-2000000.0d0)) then
tmp = z / (t / (y - x))
else if ((z / t) <= 0.2d0) then
tmp = x + (y * (z / t))
else
tmp = z * ((y - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2000000.0) {
tmp = z / (t / (y - x));
} else if ((z / t) <= 0.2) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -2000000.0: tmp = z / (t / (y - x)) elif (z / t) <= 0.2: tmp = x + (y * (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -2000000.0) tmp = Float64(z / Float64(t / Float64(y - x))); elseif (Float64(z / t) <= 0.2) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(z * Float64(Float64(y - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -2000000.0) tmp = z / (t / (y - x)); elseif ((z / t) <= 0.2) tmp = x + (y * (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -2000000.0], N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 0.2], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2000000:\\
\;\;\;\;\frac{z}{\frac{t}{y - x}}\\
\mathbf{elif}\;\frac{z}{t} \leq 0.2:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e6Initial program 96.1%
Taylor expanded in z around -inf 90.7%
Taylor expanded in t around 0 88.5%
associate-*l/92.1%
Applied egg-rr92.1%
*-commutative92.1%
clear-num92.1%
un-div-inv92.2%
Applied egg-rr92.2%
if -2e6 < (/.f64 z t) < 0.20000000000000001Initial program 99.5%
Taylor expanded in y around inf 93.4%
associate-*r/97.9%
Simplified97.9%
if 0.20000000000000001 < (/.f64 z t) Initial program 99.7%
Taylor expanded in z around -inf 88.9%
Taylor expanded in t around 0 87.3%
associate-*l/95.6%
Applied egg-rr95.6%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (<= z -5e+199) (* z (- (/ x t))) (if (<= z -1.1e-67) (* z (/ y t)) (if (<= z 1.6e-139) x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+199) {
tmp = z * -(x / t);
} else if (z <= -1.1e-67) {
tmp = z * (y / t);
} else if (z <= 1.6e-139) {
tmp = x;
} else {
tmp = y / (t / 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 (z <= (-5d+199)) then
tmp = z * -(x / t)
else if (z <= (-1.1d-67)) then
tmp = z * (y / t)
else if (z <= 1.6d-139) then
tmp = x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+199) {
tmp = z * -(x / t);
} else if (z <= -1.1e-67) {
tmp = z * (y / t);
} else if (z <= 1.6e-139) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5e+199: tmp = z * -(x / t) elif z <= -1.1e-67: tmp = z * (y / t) elif z <= 1.6e-139: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5e+199) tmp = Float64(z * Float64(-Float64(x / t))); elseif (z <= -1.1e-67) tmp = Float64(z * Float64(y / t)); elseif (z <= 1.6e-139) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5e+199) tmp = z * -(x / t); elseif (z <= -1.1e-67) tmp = z * (y / t); elseif (z <= 1.6e-139) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5e+199], N[(z * (-N[(x / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[z, -1.1e-67], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e-139], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+199}:\\
\;\;\;\;z \cdot \left(-\frac{x}{t}\right)\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-67}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -4.9999999999999998e199Initial program 99.8%
Taylor expanded in z around -inf 73.2%
Taylor expanded in t around 0 73.2%
associate-*l/84.3%
Applied egg-rr84.3%
Taylor expanded in y around 0 61.2%
neg-mul-161.2%
distribute-neg-frac61.2%
Simplified61.2%
if -4.9999999999999998e199 < z < -1.1000000000000001e-67Initial program 98.0%
Taylor expanded in z around -inf 81.8%
Taylor expanded in t around 0 67.1%
associate-*l/75.9%
Applied egg-rr75.9%
Taylor expanded in y around inf 55.2%
if -1.1000000000000001e-67 < z < 1.6e-139Initial program 99.4%
Taylor expanded in z around 0 66.2%
if 1.6e-139 < z Initial program 98.7%
Taylor expanded in z around -inf 87.3%
Taylor expanded in t around 0 73.9%
associate-*l/79.6%
Applied egg-rr79.6%
Taylor expanded in y around inf 55.4%
associate-/l*65.5%
Simplified65.5%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.3e+200) (/ z (/ t (- x))) (if (<= z -1.2e-68) (* z (/ y t)) (if (<= z 6e-138) x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+200) {
tmp = z / (t / -x);
} else if (z <= -1.2e-68) {
tmp = z * (y / t);
} else if (z <= 6e-138) {
tmp = x;
} else {
tmp = y / (t / 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 (z <= (-2.3d+200)) then
tmp = z / (t / -x)
else if (z <= (-1.2d-68)) then
tmp = z * (y / t)
else if (z <= 6d-138) then
tmp = x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+200) {
tmp = z / (t / -x);
} else if (z <= -1.2e-68) {
tmp = z * (y / t);
} else if (z <= 6e-138) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.3e+200: tmp = z / (t / -x) elif z <= -1.2e-68: tmp = z * (y / t) elif z <= 6e-138: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.3e+200) tmp = Float64(z / Float64(t / Float64(-x))); elseif (z <= -1.2e-68) tmp = Float64(z * Float64(y / t)); elseif (z <= 6e-138) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.3e+200) tmp = z / (t / -x); elseif (z <= -1.2e-68) tmp = z * (y / t); elseif (z <= 6e-138) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.3e+200], N[(z / N[(t / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-68], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-138], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+200}:\\
\;\;\;\;\frac{z}{\frac{t}{-x}}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-68}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-138}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -2.30000000000000003e200Initial program 99.8%
Taylor expanded in z around -inf 73.2%
Taylor expanded in t around 0 73.2%
add-cube-cbrt73.2%
pow373.2%
Applied egg-rr73.2%
Taylor expanded in y around 0 53.9%
mul-1-neg53.9%
distribute-frac-neg53.9%
distribute-rgt-neg-out53.9%
associate-/l*61.4%
Simplified61.4%
if -2.30000000000000003e200 < z < -1.19999999999999996e-68Initial program 98.0%
Taylor expanded in z around -inf 81.8%
Taylor expanded in t around 0 67.1%
associate-*l/75.9%
Applied egg-rr75.9%
Taylor expanded in y around inf 55.2%
if -1.19999999999999996e-68 < z < 6.0000000000000001e-138Initial program 99.4%
Taylor expanded in z around 0 66.2%
if 6.0000000000000001e-138 < z Initial program 98.7%
Taylor expanded in z around -inf 87.3%
Taylor expanded in t around 0 73.9%
associate-*l/79.6%
Applied egg-rr79.6%
Taylor expanded in y around inf 55.4%
associate-/l*65.5%
Simplified65.5%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5e-73) (not (<= z 1.05e-136))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e-73) || !(z <= 1.05e-136)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.5d-73)) .or. (.not. (z <= 1.05d-136))) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e-73) || !(z <= 1.05e-136)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.5e-73) or not (z <= 1.05e-136): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.5e-73) || !(z <= 1.05e-136)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.5e-73) || ~((z <= 1.05e-136))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.5e-73], N[Not[LessEqual[z, 1.05e-136]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-73} \lor \neg \left(z \leq 1.05 \cdot 10^{-136}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.5e-73 or 1.0499999999999999e-136 < z Initial program 98.6%
Taylor expanded in z around -inf 83.3%
Taylor expanded in t around 0 71.6%
associate-*l/79.1%
Applied egg-rr79.1%
Taylor expanded in y around inf 56.0%
if -4.5e-73 < z < 1.0499999999999999e-136Initial program 99.4%
Taylor expanded in z around 0 66.2%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.3e-74) (not (<= z 4e-137))) (/ y (/ t z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-74) || !(z <= 4e-137)) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.3d-74)) .or. (.not. (z <= 4d-137))) then
tmp = y / (t / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-74) || !(z <= 4e-137)) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.3e-74) or not (z <= 4e-137): tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.3e-74) || !(z <= 4e-137)) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.3e-74) || ~((z <= 4e-137))) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.3e-74], N[Not[LessEqual[z, 4e-137]], $MachinePrecision]], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{-74} \lor \neg \left(z \leq 4 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.29999999999999972e-74 or 3.99999999999999991e-137 < z Initial program 98.6%
Taylor expanded in z around -inf 83.3%
Taylor expanded in t around 0 71.6%
associate-*l/79.1%
Applied egg-rr79.1%
Taylor expanded in y around inf 49.1%
associate-/l*57.8%
Simplified57.8%
if -4.29999999999999972e-74 < z < 3.99999999999999991e-137Initial program 99.4%
Taylor expanded in z around 0 66.2%
Final simplification61.0%
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.9%
Taylor expanded in z around 0 36.9%
Final simplification36.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} 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 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
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 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t_1 < -1013646692435.8867:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023238
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))