
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- y z) (- t z)) x))
double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * 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 = ((y - z) / (t - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
def code(x, y, z, t): return ((y - z) / (t - z)) * x
function code(x, y, z, t) return Float64(Float64(Float64(y - z) / Float64(t - z)) * x) end
function tmp = code(x, y, z, t) tmp = ((y - z) / (t - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - z}{t - z} \cdot x
\end{array}
Initial program 83.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- z y) z) x)))
(if (<= z -4.7e+118)
t_1
(if (<= z 2.6e-189)
(* (/ x (- t z)) y)
(if (<= z 2.1e+152) (/ (* (- y z) x) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((z - y) / z) * x;
double tmp;
if (z <= -4.7e+118) {
tmp = t_1;
} else if (z <= 2.6e-189) {
tmp = (x / (t - z)) * y;
} else if (z <= 2.1e+152) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((z - y) / z) * x
if (z <= (-4.7d+118)) then
tmp = t_1
else if (z <= 2.6d-189) then
tmp = (x / (t - z)) * y
else if (z <= 2.1d+152) then
tmp = ((y - z) * x) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((z - y) / z) * x;
double tmp;
if (z <= -4.7e+118) {
tmp = t_1;
} else if (z <= 2.6e-189) {
tmp = (x / (t - z)) * y;
} else if (z <= 2.1e+152) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((z - y) / z) * x tmp = 0 if z <= -4.7e+118: tmp = t_1 elif z <= 2.6e-189: tmp = (x / (t - z)) * y elif z <= 2.1e+152: tmp = ((y - z) * x) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(z - y) / z) * x) tmp = 0.0 if (z <= -4.7e+118) tmp = t_1; elseif (z <= 2.6e-189) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (z <= 2.1e+152) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((z - y) / z) * x; tmp = 0.0; if (z <= -4.7e+118) tmp = t_1; elseif (z <= 2.6e-189) tmp = (x / (t - z)) * y; elseif (z <= 2.1e+152) tmp = ((y - z) * x) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -4.7e+118], t$95$1, If[LessEqual[z, 2.6e-189], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 2.1e+152], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z} \cdot x\\
\mathbf{if}\;z \leq -4.7 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-189}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+152}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.6999999999999997e118 or 2.1000000000000002e152 < z Initial program 61.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
lower-*.f64N/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
lift-neg.f64N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
Applied rewrites72.0%
Taylor expanded in t around 0
associate-/l*N/A
*-commutativeN/A
div-subN/A
*-inversesN/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
*-inversesN/A
div-subN/A
lower-/.f64N/A
lower--.f6483.8
Applied rewrites83.8%
if -4.6999999999999997e118 < z < 2.5999999999999999e-189Initial program 89.8%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.7
Applied rewrites84.7%
if 2.5999999999999999e-189 < z < 2.1000000000000002e152Initial program 94.2%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.6
Applied rewrites69.6%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+167) (not (<= z 8.5e+151))) (* (/ z (- t z)) (- x)) (* (/ x (- t z)) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+167) || !(z <= 8.5e+151)) {
tmp = (z / (t - z)) * -x;
} else {
tmp = (x / (t - z)) * (y - 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 <= (-1.8d+167)) .or. (.not. (z <= 8.5d+151))) then
tmp = (z / (t - z)) * -x
else
tmp = (x / (t - z)) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+167) || !(z <= 8.5e+151)) {
tmp = (z / (t - z)) * -x;
} else {
tmp = (x / (t - z)) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+167) or not (z <= 8.5e+151): tmp = (z / (t - z)) * -x else: tmp = (x / (t - z)) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+167) || !(z <= 8.5e+151)) tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x)); else tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e+167) || ~((z <= 8.5e+151))) tmp = (z / (t - z)) * -x; else tmp = (x / (t - z)) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+167], N[Not[LessEqual[z, 8.5e+151]], $MachinePrecision]], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+167} \lor \neg \left(z \leq 8.5 \cdot 10^{+151}\right):\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if z < -1.80000000000000012e167 or 8.50000000000000051e151 < z Initial program 62.8%
Taylor expanded in y around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6493.4
Applied rewrites93.4%
if -1.80000000000000012e167 < z < 8.50000000000000051e151Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Final simplification92.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.8e+165)
(* 1.0 x)
(if (<= z -3.8e-25)
(* (- y) (/ x z))
(if (<= z 2.5e+152) (* (/ y t) x) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+165) {
tmp = 1.0 * x;
} else if (z <= -3.8e-25) {
tmp = -y * (x / z);
} else if (z <= 2.5e+152) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * 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 <= (-5.8d+165)) then
tmp = 1.0d0 * x
else if (z <= (-3.8d-25)) then
tmp = -y * (x / z)
else if (z <= 2.5d+152) then
tmp = (y / t) * x
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+165) {
tmp = 1.0 * x;
} else if (z <= -3.8e-25) {
tmp = -y * (x / z);
} else if (z <= 2.5e+152) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+165: tmp = 1.0 * x elif z <= -3.8e-25: tmp = -y * (x / z) elif z <= 2.5e+152: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+165) tmp = Float64(1.0 * x); elseif (z <= -3.8e-25) tmp = Float64(Float64(-y) * Float64(x / z)); elseif (z <= 2.5e+152) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+165) tmp = 1.0 * x; elseif (z <= -3.8e-25) tmp = -y * (x / z); elseif (z <= 2.5e+152) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+165], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -3.8e-25], N[((-y) * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+152], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+165}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-25}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -5.80000000000000011e165 or 2.5e152 < z Initial program 61.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites79.8%
if -5.80000000000000011e165 < z < -3.7999999999999998e-25Initial program 72.5%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites65.4%
Taylor expanded in y around inf
Applied rewrites48.7%
if -3.7999999999999998e-25 < z < 2.5e152Initial program 94.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.1
Applied rewrites94.1%
Taylor expanded in z around 0
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.9e+14) (not (<= t 1.6e-77))) (* (/ (- y z) t) x) (- x (* (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.9e+14) || !(t <= 1.6e-77)) {
tmp = ((y - z) / t) * x;
} else {
tmp = x - ((y / z) * 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 <= (-3.9d+14)) .or. (.not. (t <= 1.6d-77))) then
tmp = ((y - z) / t) * x
else
tmp = x - ((y / z) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.9e+14) || !(t <= 1.6e-77)) {
tmp = ((y - z) / t) * x;
} else {
tmp = x - ((y / z) * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.9e+14) or not (t <= 1.6e-77): tmp = ((y - z) / t) * x else: tmp = x - ((y / z) * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.9e+14) || !(t <= 1.6e-77)) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = Float64(x - Float64(Float64(y / z) * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.9e+14) || ~((t <= 1.6e-77))) tmp = ((y - z) / t) * x; else tmp = x - ((y / z) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.9e+14], N[Not[LessEqual[t, 1.6e-77]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+14} \lor \neg \left(t \leq 1.6 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -3.9e14 or 1.6e-77 < t Initial program 84.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6480.9
Applied rewrites80.9%
if -3.9e14 < t < 1.6e-77Initial program 82.1%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites82.8%
Applied rewrites82.8%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.7e+118) (not (<= z 6600000.0))) (* (/ (- z y) z) x) (* (/ x (- t z)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.7e+118) || !(z <= 6600000.0)) {
tmp = ((z - y) / z) * x;
} else {
tmp = (x / (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 ((z <= (-4.7d+118)) .or. (.not. (z <= 6600000.0d0))) then
tmp = ((z - y) / z) * x
else
tmp = (x / (t - z)) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.7e+118) || !(z <= 6600000.0)) {
tmp = ((z - y) / z) * x;
} else {
tmp = (x / (t - z)) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.7e+118) or not (z <= 6600000.0): tmp = ((z - y) / z) * x else: tmp = (x / (t - z)) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.7e+118) || !(z <= 6600000.0)) tmp = Float64(Float64(Float64(z - y) / z) * x); else tmp = Float64(Float64(x / Float64(t - z)) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.7e+118) || ~((z <= 6600000.0))) tmp = ((z - y) / z) * x; else tmp = (x / (t - z)) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.7e+118], N[Not[LessEqual[z, 6600000.0]], $MachinePrecision]], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+118} \lor \neg \left(z \leq 6600000\right):\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\end{array}
\end{array}
if z < -4.6999999999999997e118 or 6.6e6 < z Initial program 70.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
lower-*.f64N/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
lift-neg.f64N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
Applied rewrites73.8%
Taylor expanded in t around 0
associate-/l*N/A
*-commutativeN/A
div-subN/A
*-inversesN/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
*-inversesN/A
div-subN/A
lower-/.f64N/A
lower--.f6474.7
Applied rewrites74.7%
if -4.6999999999999997e118 < z < 6.6e6Initial program 91.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.8e-31) (not (<= z 9.4e-38))) (* (/ (- z y) z) x) (* (/ y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.8e-31) || !(z <= 9.4e-38)) {
tmp = ((z - y) / z) * x;
} else {
tmp = (y / t) * 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 <= (-3.8d-31)) .or. (.not. (z <= 9.4d-38))) then
tmp = ((z - y) / z) * x
else
tmp = (y / t) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.8e-31) || !(z <= 9.4e-38)) {
tmp = ((z - y) / z) * x;
} else {
tmp = (y / t) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.8e-31) or not (z <= 9.4e-38): tmp = ((z - y) / z) * x else: tmp = (y / t) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.8e-31) || !(z <= 9.4e-38)) tmp = Float64(Float64(Float64(z - y) / z) * x); else tmp = Float64(Float64(y / t) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.8e-31) || ~((z <= 9.4e-38))) tmp = ((z - y) / z) * x; else tmp = (y / t) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.8e-31], N[Not[LessEqual[z, 9.4e-38]], $MachinePrecision]], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-31} \lor \neg \left(z \leq 9.4 \cdot 10^{-38}\right):\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\end{array}
\end{array}
if z < -3.8e-31 or 9.39999999999999996e-38 < z Initial program 74.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
lower-*.f64N/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
lift-neg.f64N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
Applied rewrites80.7%
Taylor expanded in t around 0
associate-/l*N/A
*-commutativeN/A
div-subN/A
*-inversesN/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
*-inversesN/A
div-subN/A
lower-/.f64N/A
lower--.f6470.0
Applied rewrites70.0%
if -3.8e-31 < z < 9.39999999999999996e-38Initial program 94.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
Taylor expanded in z around 0
lower-/.f6474.0
Applied rewrites74.0%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (<= z -4.7e+118) (* (/ (- z y) z) x) (if (<= z 6600000.0) (* (/ x (- t z)) y) (- x (* (/ y z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+118) {
tmp = ((z - y) / z) * x;
} else if (z <= 6600000.0) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((y / z) * 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.7d+118)) then
tmp = ((z - y) / z) * x
else if (z <= 6600000.0d0) then
tmp = (x / (t - z)) * y
else
tmp = x - ((y / z) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.7e+118) {
tmp = ((z - y) / z) * x;
} else if (z <= 6600000.0) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((y / z) * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.7e+118: tmp = ((z - y) / z) * x elif z <= 6600000.0: tmp = (x / (t - z)) * y else: tmp = x - ((y / z) * x) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.7e+118) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= 6600000.0) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(x - Float64(Float64(y / z) * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.7e+118) tmp = ((z - y) / z) * x; elseif (z <= 6600000.0) tmp = (x / (t - z)) * y; else tmp = x - ((y / z) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.7e+118], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6600000.0], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+118}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq 6600000:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot x\\
\end{array}
\end{array}
if z < -4.6999999999999997e118Initial program 67.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
frac-2negN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
lower-*.f64N/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
lift-neg.f64N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
+-commutativeN/A
Applied rewrites71.2%
Taylor expanded in t around 0
associate-/l*N/A
*-commutativeN/A
div-subN/A
*-inversesN/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
*-inversesN/A
div-subN/A
lower-/.f64N/A
lower--.f6483.4
Applied rewrites83.4%
if -4.6999999999999997e118 < z < 6.6e6Initial program 91.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
if 6.6e6 < z Initial program 73.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites68.3%
Applied rewrites68.3%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+119) (not (<= z 2.5e+152))) (* 1.0 x) (* (/ y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 2.5e+152)) {
tmp = 1.0 * x;
} else {
tmp = (y / t) * 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 <= (-1.15d+119)) .or. (.not. (z <= 2.5d+152))) then
tmp = 1.0d0 * x
else
tmp = (y / t) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 2.5e+152)) {
tmp = 1.0 * x;
} else {
tmp = (y / t) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+119) or not (z <= 2.5e+152): tmp = 1.0 * x else: tmp = (y / t) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+119) || !(z <= 2.5e+152)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y / t) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+119) || ~((z <= 2.5e+152))) tmp = 1.0 * x; else tmp = (y / t) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+119], N[Not[LessEqual[z, 2.5e+152]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+119} \lor \neg \left(z \leq 2.5 \cdot 10^{+152}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\end{array}
\end{array}
if z < -1.15e119 or 2.5e152 < z Initial program 61.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites70.3%
if -1.15e119 < z < 2.5e152Initial program 91.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
Taylor expanded in z around 0
lower-/.f6459.1
Applied rewrites59.1%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+119) (not (<= z 8500000000.0))) (* 1.0 x) (* (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 8500000000.0)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * 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 ((z <= (-1.15d+119)) .or. (.not. (z <= 8500000000.0d0))) then
tmp = 1.0d0 * x
else
tmp = (x / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+119) || !(z <= 8500000000.0)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+119) or not (z <= 8500000000.0): tmp = 1.0 * x else: tmp = (x / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+119) || !(z <= 8500000000.0)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(x / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+119) || ~((z <= 8500000000.0))) tmp = 1.0 * x; else tmp = (x / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+119], N[Not[LessEqual[z, 8500000000.0]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+119} \lor \neg \left(z \leq 8500000000\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\end{array}
\end{array}
if z < -1.15e119 or 8.5e9 < z Initial program 70.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
Applied rewrites59.1%
if -1.15e119 < z < 8.5e9Initial program 91.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
Applied rewrites60.7%
Final simplification60.1%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 83.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in z around inf
Applied rewrites27.1%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
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 / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024313
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))