
(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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= z 4.2e-95) (+ x (/ (* (- y x) z) t)) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.2e-95) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = x + (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 <= 4.2d-95) then
tmp = x + (((y - x) * z) / t)
else
tmp = x + (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 <= 4.2e-95) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 4.2e-95: tmp = x + (((y - x) * z) / t) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 4.2e-95) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.2e-95) tmp = x + (((y - x) * z) / t); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.2e-95], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.2 \cdot 10^{-95}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if z < 4.2e-95Initial program 96.7%
if 4.2e-95 < z Initial program 88.2%
associate-*l/99.0%
Applied egg-rr99.0%
Final simplification97.4%
(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 94.0%
+-commutative94.0%
remove-double-neg94.0%
unsub-neg94.0%
associate-*r/97.2%
fma-neg97.2%
remove-double-neg97.2%
Simplified97.2%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.2e+193)
x
(if (<= t -8.5e+137)
(* z (/ (- y x) t))
(if (<= t -2.95e+16) x (if (<= t 2e+101) (* (- y x) (/ z t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e+193) {
tmp = x;
} else if (t <= -8.5e+137) {
tmp = z * ((y - x) / t);
} else if (t <= -2.95e+16) {
tmp = x;
} else if (t <= 2e+101) {
tmp = (y - x) * (z / 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 (t <= (-1.2d+193)) then
tmp = x
else if (t <= (-8.5d+137)) then
tmp = z * ((y - x) / t)
else if (t <= (-2.95d+16)) then
tmp = x
else if (t <= 2d+101) then
tmp = (y - x) * (z / 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 (t <= -1.2e+193) {
tmp = x;
} else if (t <= -8.5e+137) {
tmp = z * ((y - x) / t);
} else if (t <= -2.95e+16) {
tmp = x;
} else if (t <= 2e+101) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e+193: tmp = x elif t <= -8.5e+137: tmp = z * ((y - x) / t) elif t <= -2.95e+16: tmp = x elif t <= 2e+101: tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e+193) tmp = x; elseif (t <= -8.5e+137) tmp = Float64(z * Float64(Float64(y - x) / t)); elseif (t <= -2.95e+16) tmp = x; elseif (t <= 2e+101) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.2e+193) tmp = x; elseif (t <= -8.5e+137) tmp = z * ((y - x) / t); elseif (t <= -2.95e+16) tmp = x; elseif (t <= 2e+101) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e+193], x, If[LessEqual[t, -8.5e+137], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.95e+16], x, If[LessEqual[t, 2e+101], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+193}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{+137}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{elif}\;t \leq -2.95 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+101}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.2e193 or -8.50000000000000028e137 < t < -2.95e16 or 2e101 < t Initial program 89.4%
+-commutative89.4%
remove-double-neg89.4%
unsub-neg89.4%
associate-*r/98.4%
fma-neg98.4%
remove-double-neg98.4%
Simplified98.4%
Taylor expanded in z around 0 77.1%
if -1.2e193 < t < -8.50000000000000028e137Initial program 74.1%
+-commutative74.1%
remove-double-neg74.1%
unsub-neg74.1%
associate-*r/99.7%
fma-neg99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 70.3%
Taylor expanded in y around 0 70.3%
+-commutative70.3%
mul-1-neg70.3%
sub-neg70.3%
div-sub70.3%
Simplified70.3%
if -2.95e16 < t < 2e101Initial program 98.1%
+-commutative98.1%
remove-double-neg98.1%
unsub-neg98.1%
associate-*r/96.3%
fma-neg96.3%
remove-double-neg96.3%
Simplified96.3%
Taylor expanded in z around inf 69.0%
Taylor expanded in y around 0 69.0%
+-commutative69.0%
mul-1-neg69.0%
sub-neg69.0%
div-sub71.7%
Simplified71.7%
clear-num71.5%
un-div-inv72.1%
Applied egg-rr72.1%
associate-/r/78.4%
Applied egg-rr78.4%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y z) t)))
(if (<= t -1200000000000.0)
x
(if (<= t -1.8e-249)
t_1
(if (<= t -2.8e-264) (* (/ x t) (- z)) (if (<= t 2.3e-33) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if (t <= -1200000000000.0) {
tmp = x;
} else if (t <= -1.8e-249) {
tmp = t_1;
} else if (t <= -2.8e-264) {
tmp = (x / t) * -z;
} else if (t <= 2.3e-33) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y * z) / t
if (t <= (-1200000000000.0d0)) then
tmp = x
else if (t <= (-1.8d-249)) then
tmp = t_1
else if (t <= (-2.8d-264)) then
tmp = (x / t) * -z
else if (t <= 2.3d-33) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * z) / t;
double tmp;
if (t <= -1200000000000.0) {
tmp = x;
} else if (t <= -1.8e-249) {
tmp = t_1;
} else if (t <= -2.8e-264) {
tmp = (x / t) * -z;
} else if (t <= 2.3e-33) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) / t tmp = 0 if t <= -1200000000000.0: tmp = x elif t <= -1.8e-249: tmp = t_1 elif t <= -2.8e-264: tmp = (x / t) * -z elif t <= 2.3e-33: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) / t) tmp = 0.0 if (t <= -1200000000000.0) tmp = x; elseif (t <= -1.8e-249) tmp = t_1; elseif (t <= -2.8e-264) tmp = Float64(Float64(x / t) * Float64(-z)); elseif (t <= 2.3e-33) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) / t; tmp = 0.0; if (t <= -1200000000000.0) tmp = x; elseif (t <= -1.8e-249) tmp = t_1; elseif (t <= -2.8e-264) tmp = (x / t) * -z; elseif (t <= 2.3e-33) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1200000000000.0], x, If[LessEqual[t, -1.8e-249], t$95$1, If[LessEqual[t, -2.8e-264], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[t, 2.3e-33], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
\mathbf{if}\;t \leq -1200000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-249}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.8 \cdot 10^{-264}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.2e12 or 2.29999999999999986e-33 < t Initial program 90.0%
+-commutative90.0%
remove-double-neg90.0%
unsub-neg90.0%
associate-*r/98.8%
fma-neg98.8%
remove-double-neg98.8%
Simplified98.8%
Taylor expanded in z around 0 65.8%
if -1.2e12 < t < -1.79999999999999997e-249 or -2.80000000000000012e-264 < t < 2.29999999999999986e-33Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/96.2%
fma-neg96.2%
remove-double-neg96.2%
Simplified96.2%
Taylor expanded in z around inf 69.4%
Taylor expanded in y around 0 69.4%
+-commutative69.4%
mul-1-neg69.4%
sub-neg69.4%
div-sub72.7%
Simplified72.7%
Taylor expanded in z around 0 83.1%
Taylor expanded in y around inf 61.6%
if -1.79999999999999997e-249 < t < -2.80000000000000012e-264Initial program 99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
associate-*r/84.6%
fma-neg84.6%
remove-double-neg84.6%
Simplified84.6%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
Simplified100.0%
Final simplification64.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e-131) (not (<= z 5.5e-97))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e-131) || !(z <= 5.5e-97)) {
tmp = x + (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 <= (-1.75d-131)) .or. (.not. (z <= 5.5d-97))) then
tmp = x + (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 <= -1.75e-131) || !(z <= 5.5e-97)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e-131) or not (z <= 5.5e-97): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e-131) || !(z <= 5.5e-97)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e-131) || ~((z <= 5.5e-97))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e-131], N[Not[LessEqual[z, 5.5e-97]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-131} \lor \neg \left(z \leq 5.5 \cdot 10^{-97}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.7500000000000001e-131 or 5.49999999999999948e-97 < z Initial program 91.8%
associate-*l/98.9%
Applied egg-rr98.9%
if -1.7500000000000001e-131 < z < 5.49999999999999948e-97Initial program 97.9%
Taylor expanded in y around inf 91.5%
*-commutative91.5%
Simplified91.5%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.42e+118) (not (<= x 5.2e+42))) (* x (- (- -1.0) (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.42e+118) || !(x <= 5.2e+42)) {
tmp = x * (-(-1.0) - (z / t));
} else {
tmp = x + (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 ((x <= (-1.42d+118)) .or. (.not. (x <= 5.2d+42))) then
tmp = x * (-(-1.0d0) - (z / t))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.42e+118) || !(x <= 5.2e+42)) {
tmp = x * (-(-1.0) - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.42e+118) or not (x <= 5.2e+42): tmp = x * (-(-1.0) - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.42e+118) || !(x <= 5.2e+42)) tmp = Float64(x * Float64(Float64(-(-1.0)) - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.42e+118) || ~((x <= 5.2e+42))) tmp = x * (-(-1.0) - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.42e+118], N[Not[LessEqual[x, 5.2e+42]], $MachinePrecision]], N[(x * N[((--1.0) - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \cdot 10^{+118} \lor \neg \left(x \leq 5.2 \cdot 10^{+42}\right):\\
\;\;\;\;x \cdot \left(\left(--1\right) - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -1.41999999999999999e118 or 5.1999999999999998e42 < x Initial program 92.5%
+-commutative92.5%
remove-double-neg92.5%
unsub-neg92.5%
associate-*r/100.0%
fma-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 91.5%
associate-*r*91.5%
neg-mul-191.5%
*-commutative91.5%
sub-neg91.5%
metadata-eval91.5%
+-commutative91.5%
Simplified91.5%
if -1.41999999999999999e118 < x < 5.1999999999999998e42Initial program 95.0%
Taylor expanded in y around inf 85.9%
associate-/l*88.3%
Simplified88.3%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-85) (not (<= z 3.8e-77))) (* z (/ (- y x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-85) || !(z <= 3.8e-77)) {
tmp = z * ((y - x) / 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 <= (-7.2d-85)) .or. (.not. (z <= 3.8d-77))) then
tmp = z * ((y - x) / 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 <= -7.2e-85) || !(z <= 3.8e-77)) {
tmp = z * ((y - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-85) or not (z <= 3.8e-77): tmp = z * ((y - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-85) || !(z <= 3.8e-77)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.2e-85) || ~((z <= 3.8e-77))) tmp = z * ((y - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-85], N[Not[LessEqual[z, 3.8e-77]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-85} \lor \neg \left(z \leq 3.8 \cdot 10^{-77}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.1999999999999996e-85 or 3.7999999999999999e-77 < z Initial program 91.7%
+-commutative91.7%
remove-double-neg91.7%
unsub-neg91.7%
associate-*r/96.2%
fma-neg96.2%
remove-double-neg96.2%
Simplified96.2%
Taylor expanded in z around inf 76.2%
Taylor expanded in y around 0 76.2%
+-commutative76.2%
mul-1-neg76.2%
sub-neg76.2%
div-sub77.5%
Simplified77.5%
if -7.1999999999999996e-85 < z < 3.7999999999999999e-77Initial program 97.3%
+-commutative97.3%
remove-double-neg97.3%
unsub-neg97.3%
associate-*r/98.6%
fma-neg98.6%
remove-double-neg98.6%
Simplified98.6%
Taylor expanded in z around 0 64.1%
Final simplification72.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e+145) (not (<= z 6.4e+68))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+145) || !(z <= 6.4e+68)) {
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 <= (-1.25d+145)) .or. (.not. (z <= 6.4d+68))) 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 <= -1.25e+145) || !(z <= 6.4e+68)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+145) or not (z <= 6.4e+68): tmp = z * ((y - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+145) || !(z <= 6.4e+68)) 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 <= -1.25e+145) || ~((z <= 6.4e+68))) tmp = z * ((y - x) / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+145], N[Not[LessEqual[z, 6.4e+68]], $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}\;z \leq -1.25 \cdot 10^{+145} \lor \neg \left(z \leq 6.4 \cdot 10^{+68}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.24999999999999992e145 or 6.39999999999999989e68 < z Initial program 90.3%
+-commutative90.3%
remove-double-neg90.3%
unsub-neg90.3%
associate-*r/92.9%
fma-neg92.9%
remove-double-neg92.9%
Simplified92.9%
Taylor expanded in z around inf 85.9%
Taylor expanded in y around 0 85.9%
+-commutative85.9%
mul-1-neg85.9%
sub-neg85.9%
div-sub88.3%
Simplified88.3%
if -1.24999999999999992e145 < z < 6.39999999999999989e68Initial program 95.7%
Taylor expanded in y around inf 86.6%
associate-/l*88.8%
Simplified88.8%
div-inv88.7%
clear-num88.8%
*-commutative88.8%
Applied egg-rr88.8%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e+144) (/ z (/ t (- y x))) (if (<= z 1.3e+65) (+ x (* y (/ z t))) (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e+144) {
tmp = z / (t / (y - x));
} else if (z <= 1.3e+65) {
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 <= (-1.9d+144)) then
tmp = z / (t / (y - x))
else if (z <= 1.3d+65) 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 <= -1.9e+144) {
tmp = z / (t / (y - x));
} else if (z <= 1.3e+65) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.9e+144: tmp = z / (t / (y - x)) elif z <= 1.3e+65: tmp = x + (y * (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e+144) tmp = Float64(z / Float64(t / Float64(y - x))); elseif (z <= 1.3e+65) 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 <= -1.9e+144) tmp = z / (t / (y - x)); elseif (z <= 1.3e+65) tmp = x + (y * (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e+144], N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+65], 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}\;z \leq -1.9 \cdot 10^{+144}:\\
\;\;\;\;\frac{z}{\frac{t}{y - x}}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+65}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if z < -1.90000000000000013e144Initial program 93.3%
+-commutative93.3%
remove-double-neg93.3%
unsub-neg93.3%
associate-*r/90.3%
fma-neg90.3%
remove-double-neg90.3%
Simplified90.3%
Taylor expanded in z around inf 96.3%
Taylor expanded in y around 0 96.3%
+-commutative96.3%
mul-1-neg96.3%
sub-neg96.3%
div-sub99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
if -1.90000000000000013e144 < z < 1.30000000000000001e65Initial program 95.7%
Taylor expanded in y around inf 86.6%
associate-/l*88.8%
Simplified88.8%
div-inv88.7%
clear-num88.8%
*-commutative88.8%
Applied egg-rr88.8%
if 1.30000000000000001e65 < z Initial program 88.6%
+-commutative88.6%
remove-double-neg88.6%
unsub-neg88.6%
associate-*r/94.4%
fma-neg94.4%
remove-double-neg94.4%
Simplified94.4%
Taylor expanded in z around inf 79.9%
Taylor expanded in y around 0 79.9%
+-commutative79.9%
mul-1-neg79.9%
sub-neg79.9%
div-sub81.8%
Simplified81.8%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= t -650000000000.0) x (if (<= t 1.65e-34) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -650000000000.0) {
tmp = x;
} else if (t <= 1.65e-34) {
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 (t <= (-650000000000.0d0)) then
tmp = x
else if (t <= 1.65d-34) 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 (t <= -650000000000.0) {
tmp = x;
} else if (t <= 1.65e-34) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -650000000000.0: tmp = x elif t <= 1.65e-34: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -650000000000.0) tmp = x; elseif (t <= 1.65e-34) 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 (t <= -650000000000.0) tmp = x; elseif (t <= 1.65e-34) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -650000000000.0], x, If[LessEqual[t, 1.65e-34], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -650000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-34}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -6.5e11 or 1.64999999999999991e-34 < t Initial program 90.0%
+-commutative90.0%
remove-double-neg90.0%
unsub-neg90.0%
associate-*r/98.8%
fma-neg98.8%
remove-double-neg98.8%
Simplified98.8%
Taylor expanded in z around 0 65.8%
if -6.5e11 < t < 1.64999999999999991e-34Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/95.7%
fma-neg95.7%
remove-double-neg95.7%
Simplified95.7%
Taylor expanded in z around inf 70.8%
Taylor expanded in y around inf 53.7%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (if (<= t -4400000000000.0) x (if (<= t 1.02e-35) (/ (* y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4400000000000.0) {
tmp = x;
} else if (t <= 1.02e-35) {
tmp = (y * z) / 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 (t <= (-4400000000000.0d0)) then
tmp = x
else if (t <= 1.02d-35) then
tmp = (y * z) / 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 (t <= -4400000000000.0) {
tmp = x;
} else if (t <= 1.02e-35) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4400000000000.0: tmp = x elif t <= 1.02e-35: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4400000000000.0) tmp = x; elseif (t <= 1.02e-35) tmp = Float64(Float64(y * z) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4400000000000.0) tmp = x; elseif (t <= 1.02e-35) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4400000000000.0], x, If[LessEqual[t, 1.02e-35], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4400000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-35}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.4e12 or 1.01999999999999995e-35 < t Initial program 90.0%
+-commutative90.0%
remove-double-neg90.0%
unsub-neg90.0%
associate-*r/98.8%
fma-neg98.8%
remove-double-neg98.8%
Simplified98.8%
Taylor expanded in z around 0 65.8%
if -4.4e12 < t < 1.01999999999999995e-35Initial program 97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
associate-*r/95.7%
fma-neg95.7%
remove-double-neg95.7%
Simplified95.7%
Taylor expanded in z around inf 70.8%
Taylor expanded in y around 0 70.8%
+-commutative70.8%
mul-1-neg70.8%
sub-neg70.8%
div-sub74.0%
Simplified74.0%
Taylor expanded in z around 0 83.9%
Taylor expanded in y around inf 59.7%
Final simplification62.7%
(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 94.0%
+-commutative94.0%
remove-double-neg94.0%
unsub-neg94.0%
associate-*r/97.2%
fma-neg97.2%
remove-double-neg97.2%
Simplified97.2%
fma-udef97.2%
Applied egg-rr97.2%
Final simplification97.2%
(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 94.0%
+-commutative94.0%
remove-double-neg94.0%
unsub-neg94.0%
associate-*r/97.2%
fma-neg97.2%
remove-double-neg97.2%
Simplified97.2%
Taylor expanded in z around 0 39.8%
Final simplification39.8%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))