
(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(x / Float64(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[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 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(x / Float64(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[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
(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(Float64(x / 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[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{t - z}}{y - z}
\end{array}
Initial program 89.7%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.6
Applied egg-rr97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ x (- z y)) z)))
(if (<= z -1.25e+154)
t_1
(if (<= z 2.55e+104) (/ x (fma (- t z) y (* z (- z t)))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / (z - y)) / z;
double tmp;
if (z <= -1.25e+154) {
tmp = t_1;
} else if (z <= 2.55e+104) {
tmp = x / fma((t - z), y, (z * (z - t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(z - y)) / z) tmp = 0.0 if (z <= -1.25e+154) tmp = t_1; elseif (z <= 2.55e+104) tmp = Float64(x / fma(Float64(t - z), y, Float64(z * Float64(z - t)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.25e+154], t$95$1, If[LessEqual[z, 2.55e+104], N[(x / N[(N[(t - z), $MachinePrecision] * y + N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z - y}}{z}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+104}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(t - z, y, z \cdot \left(z - t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000001e154 or 2.5500000000000001e104 < z Initial program 80.0%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6480.0
Simplified80.0%
clear-numN/A
associate-/r/N/A
*-commutativeN/A
associate-/r*N/A
associate-*l/N/A
frac-2negN/A
metadata-evalN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
associate-/r/N/A
metadata-evalN/A
distribute-neg-fracN/A
clear-numN/A
/-lowering-/.f64N/A
Applied egg-rr96.0%
if -1.25000000000000001e154 < z < 2.5500000000000001e104Initial program 93.6%
*-commutativeN/A
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
sqr-negN/A
cancel-sign-sub-invN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
--lowering--.f6493.6
Applied egg-rr93.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (* z (- z y)))))
(if (<= z -1.02e-33)
(/ x (* z (- z t)))
(if (<= z -1.24e-82) t_1 (if (<= z 1e-76) (/ x (* t y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z * (z - y));
double tmp;
if (z <= -1.02e-33) {
tmp = x / (z * (z - t));
} else if (z <= -1.24e-82) {
tmp = t_1;
} else if (z <= 1e-76) {
tmp = x / (t * y);
} 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 = x / (z * (z - y))
if (z <= (-1.02d-33)) then
tmp = x / (z * (z - t))
else if (z <= (-1.24d-82)) then
tmp = t_1
else if (z <= 1d-76) then
tmp = x / (t * y)
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 = x / (z * (z - y));
double tmp;
if (z <= -1.02e-33) {
tmp = x / (z * (z - t));
} else if (z <= -1.24e-82) {
tmp = t_1;
} else if (z <= 1e-76) {
tmp = x / (t * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z * (z - y)) tmp = 0 if z <= -1.02e-33: tmp = x / (z * (z - t)) elif z <= -1.24e-82: tmp = t_1 elif z <= 1e-76: tmp = x / (t * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z * Float64(z - y))) tmp = 0.0 if (z <= -1.02e-33) tmp = Float64(x / Float64(z * Float64(z - t))); elseif (z <= -1.24e-82) tmp = t_1; elseif (z <= 1e-76) tmp = Float64(x / Float64(t * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z * (z - y)); tmp = 0.0; if (z <= -1.02e-33) tmp = x / (z * (z - t)); elseif (z <= -1.24e-82) tmp = t_1; elseif (z <= 1e-76) tmp = x / (t * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e-33], N[(x / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.24e-82], t$95$1, If[LessEqual[z, 1e-76], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot \left(z - y\right)}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{-33}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\
\mathbf{elif}\;z \leq -1.24 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-76}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.02e-33Initial program 84.5%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6469.5
Simplified69.5%
if -1.02e-33 < z < -1.23999999999999997e-82 or 9.99999999999999927e-77 < z Initial program 91.3%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6475.0
Simplified75.0%
if -1.23999999999999997e-82 < z < 9.99999999999999927e-77Initial program 92.5%
Taylor expanded in z around 0
/-lowering-/.f64N/A
*-lowering-*.f6469.2
Simplified69.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ x (- z y)) z)))
(if (<= z -1.35e+154)
t_1
(if (<= z 3.1e+104) (/ x (* (- t z) (- y z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / (z - y)) / z;
double tmp;
if (z <= -1.35e+154) {
tmp = t_1;
} else if (z <= 3.1e+104) {
tmp = x / ((t - z) * (y - z));
} 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 = (x / (z - y)) / z
if (z <= (-1.35d+154)) then
tmp = t_1
else if (z <= 3.1d+104) then
tmp = x / ((t - z) * (y - z))
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 = (x / (z - y)) / z;
double tmp;
if (z <= -1.35e+154) {
tmp = t_1;
} else if (z <= 3.1e+104) {
tmp = x / ((t - z) * (y - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / (z - y)) / z tmp = 0 if z <= -1.35e+154: tmp = t_1 elif z <= 3.1e+104: tmp = x / ((t - z) * (y - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / Float64(z - y)) / z) tmp = 0.0 if (z <= -1.35e+154) tmp = t_1; elseif (z <= 3.1e+104) tmp = Float64(x / Float64(Float64(t - z) * Float64(y - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / (z - y)) / z; tmp = 0.0; if (z <= -1.35e+154) tmp = t_1; elseif (z <= 3.1e+104) tmp = x / ((t - z) * (y - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.35e+154], t$95$1, If[LessEqual[z, 3.1e+104], N[(x / N[(N[(t - z), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z - y}}{z}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+104}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.35000000000000003e154 or 3.10000000000000017e104 < z Initial program 80.0%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6480.0
Simplified80.0%
clear-numN/A
associate-/r/N/A
*-commutativeN/A
associate-/r*N/A
associate-*l/N/A
frac-2negN/A
metadata-evalN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
associate-/r/N/A
metadata-evalN/A
distribute-neg-fracN/A
clear-numN/A
/-lowering-/.f64N/A
Applied egg-rr96.0%
if -1.35000000000000003e154 < z < 3.10000000000000017e104Initial program 93.6%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (/ x z) (- z t)))) (if (<= z -2.4e+155) t_1 (if (<= z 4e+144) (/ x (* (- t z) (- y z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) / (z - t);
double tmp;
if (z <= -2.4e+155) {
tmp = t_1;
} else if (z <= 4e+144) {
tmp = x / ((t - z) * (y - z));
} 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 = (x / z) / (z - t)
if (z <= (-2.4d+155)) then
tmp = t_1
else if (z <= 4d+144) then
tmp = x / ((t - z) * (y - z))
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 = (x / z) / (z - t);
double tmp;
if (z <= -2.4e+155) {
tmp = t_1;
} else if (z <= 4e+144) {
tmp = x / ((t - z) * (y - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) / (z - t) tmp = 0 if z <= -2.4e+155: tmp = t_1 elif z <= 4e+144: tmp = x / ((t - z) * (y - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) / Float64(z - t)) tmp = 0.0 if (z <= -2.4e+155) tmp = t_1; elseif (z <= 4e+144) tmp = Float64(x / Float64(Float64(t - z) * Float64(y - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) / (z - t); tmp = 0.0; if (z <= -2.4e+155) tmp = t_1; elseif (z <= 4e+144) tmp = x / ((t - z) * (y - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+155], t$95$1, If[LessEqual[z, 4e+144], N[(x / N[(N[(t - z), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z}}{z - t}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.40000000000000021e155 or 4.00000000000000009e144 < z Initial program 77.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6477.6
Simplified77.6%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6495.4
Applied egg-rr95.4%
if -2.40000000000000021e155 < z < 4.00000000000000009e144Initial program 93.5%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (<= t -8e-136) (/ x (* (- t z) y)) (if (<= t 9.2e-36) (/ x (* z (- z y))) (/ x (* t (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e-136) {
tmp = x / ((t - z) * y);
} else if (t <= 9.2e-36) {
tmp = x / (z * (z - y));
} else {
tmp = x / (t * (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 (t <= (-8d-136)) then
tmp = x / ((t - z) * y)
else if (t <= 9.2d-36) then
tmp = x / (z * (z - y))
else
tmp = x / (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e-136) {
tmp = x / ((t - z) * y);
} else if (t <= 9.2e-36) {
tmp = x / (z * (z - y));
} else {
tmp = x / (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8e-136: tmp = x / ((t - z) * y) elif t <= 9.2e-36: tmp = x / (z * (z - y)) else: tmp = x / (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8e-136) tmp = Float64(x / Float64(Float64(t - z) * y)); elseif (t <= 9.2e-36) tmp = Float64(x / Float64(z * Float64(z - y))); else tmp = Float64(x / Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8e-136) tmp = x / ((t - z) * y); elseif (t <= 9.2e-36) tmp = x / (z * (z - y)); else tmp = x / (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8e-136], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.2e-36], N[(x / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-136}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{-36}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < -8.00000000000000001e-136Initial program 88.0%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6454.6
Simplified54.6%
if -8.00000000000000001e-136 < t < 9.19999999999999986e-36Initial program 94.2%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6483.3
Simplified83.3%
if 9.19999999999999986e-36 < t Initial program 86.1%
Taylor expanded in t around inf
Simplified78.6%
Final simplification71.0%
(FPCore (x y z t) :precision binary64 (if (<= y -9.8e+20) (/ x (* (- t z) y)) (if (<= y -3.1e-49) (/ x (* z (- z y))) (/ x (* z (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.8e+20) {
tmp = x / ((t - z) * y);
} else if (y <= -3.1e-49) {
tmp = x / (z * (z - y));
} else {
tmp = x / (z * (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 (y <= (-9.8d+20)) then
tmp = x / ((t - z) * y)
else if (y <= (-3.1d-49)) then
tmp = x / (z * (z - y))
else
tmp = x / (z * (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.8e+20) {
tmp = x / ((t - z) * y);
} else if (y <= -3.1e-49) {
tmp = x / (z * (z - y));
} else {
tmp = x / (z * (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.8e+20: tmp = x / ((t - z) * y) elif y <= -3.1e-49: tmp = x / (z * (z - y)) else: tmp = x / (z * (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.8e+20) tmp = Float64(x / Float64(Float64(t - z) * y)); elseif (y <= -3.1e-49) tmp = Float64(x / Float64(z * Float64(z - y))); else tmp = Float64(x / Float64(z * Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.8e+20) tmp = x / ((t - z) * y); elseif (y <= -3.1e-49) tmp = x / (z * (z - y)); else tmp = x / (z * (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.8e+20], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.1e-49], N[(x / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+20}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-49}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\
\end{array}
\end{array}
if y < -9.8e20Initial program 87.6%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6483.1
Simplified83.1%
if -9.8e20 < y < -3.1e-49Initial program 99.5%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6475.1
Simplified75.1%
if -3.1e-49 < y Initial program 89.3%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6459.8
Simplified59.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* z (- z t))))) (if (<= z -1.08e-58) t_1 (if (<= z 5.3e-220) (/ x (* t y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z * (z - t));
double tmp;
if (z <= -1.08e-58) {
tmp = t_1;
} else if (z <= 5.3e-220) {
tmp = x / (t * y);
} 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 = x / (z * (z - t))
if (z <= (-1.08d-58)) then
tmp = t_1
else if (z <= 5.3d-220) then
tmp = x / (t * y)
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 = x / (z * (z - t));
double tmp;
if (z <= -1.08e-58) {
tmp = t_1;
} else if (z <= 5.3e-220) {
tmp = x / (t * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z * (z - t)) tmp = 0 if z <= -1.08e-58: tmp = t_1 elif z <= 5.3e-220: tmp = x / (t * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z * Float64(z - t))) tmp = 0.0 if (z <= -1.08e-58) tmp = t_1; elseif (z <= 5.3e-220) tmp = Float64(x / Float64(t * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z * (z - t)); tmp = 0.0; if (z <= -1.08e-58) tmp = t_1; elseif (z <= 5.3e-220) tmp = x / (t * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.08e-58], t$95$1, If[LessEqual[z, 5.3e-220], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot \left(z - t\right)}\\
\mathbf{if}\;z \leq -1.08 \cdot 10^{-58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-220}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.08e-58 or 5.3e-220 < z Initial program 87.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
unsub-negN/A
--lowering--.f6466.7
Simplified66.7%
if -1.08e-58 < z < 5.3e-220Initial program 95.4%
Taylor expanded in z around 0
/-lowering-/.f64N/A
*-lowering-*.f6478.2
Simplified78.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ x (* z z)))) (if (<= z -7.5e-7) t_1 (if (<= z 5.2e-68) (/ x (* t y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z * z);
double tmp;
if (z <= -7.5e-7) {
tmp = t_1;
} else if (z <= 5.2e-68) {
tmp = x / (t * y);
} 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 = x / (z * z)
if (z <= (-7.5d-7)) then
tmp = t_1
else if (z <= 5.2d-68) then
tmp = x / (t * y)
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 = x / (z * z);
double tmp;
if (z <= -7.5e-7) {
tmp = t_1;
} else if (z <= 5.2e-68) {
tmp = x / (t * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z * z) tmp = 0 if z <= -7.5e-7: tmp = t_1 elif z <= 5.2e-68: tmp = x / (t * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z * z)) tmp = 0.0 if (z <= -7.5e-7) tmp = t_1; elseif (z <= 5.2e-68) tmp = Float64(x / Float64(t * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z * z); tmp = 0.0; if (z <= -7.5e-7) tmp = t_1; elseif (z <= 5.2e-68) tmp = x / (t * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e-7], t$95$1, If[LessEqual[z, 5.2e-68], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z \cdot z}\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{t \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5000000000000002e-7 or 5.1999999999999996e-68 < z Initial program 86.6%
Taylor expanded in z around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6462.3
Simplified62.3%
if -7.5000000000000002e-7 < z < 5.1999999999999996e-68Initial program 93.8%
Taylor expanded in z around 0
/-lowering-/.f64N/A
*-lowering-*.f6461.1
Simplified61.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.35e+154) (/ (/ x z) z) (/ x (* (- t z) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e+154) {
tmp = (x / z) / z;
} 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.35d+154)) then
tmp = (x / z) / z
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.35e+154) {
tmp = (x / z) / z;
} else {
tmp = x / ((t - z) * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.35e+154: tmp = (x / z) / z else: tmp = x / ((t - z) * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.35e+154) tmp = Float64(Float64(x / z) / z); else tmp = Float64(x / Float64(Float64(t - z) * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.35e+154) tmp = (x / z) / z; else tmp = x / ((t - z) * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.35e+154], N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(N[(t - z), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if z < -1.35000000000000003e154Initial program 71.4%
Taylor expanded in z around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6471.4
Simplified71.4%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6487.4
Applied egg-rr87.4%
if -1.35000000000000003e154 < z Initial program 92.1%
Final simplification91.6%
(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}{\left(t - z\right) \cdot \left(y - z\right)}
\end{array}
Initial program 89.7%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (/ x (* t y)))
double code(double x, double y, double z, double t) {
return x / (t * 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 = x / (t * y)
end function
public static double code(double x, double y, double z, double t) {
return x / (t * y);
}
def code(x, y, z, t): return x / (t * y)
function code(x, y, z, t) return Float64(x / Float64(t * y)) end
function tmp = code(x, y, z, t) tmp = x / (t * y); end
code[x_, y_, z_, t_] := N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t \cdot y}
\end{array}
Initial program 89.7%
Taylor expanded in z around 0
/-lowering-/.f64N/A
*-lowering-*.f6436.6
Simplified36.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (- t z)))) (if (< (/ x t_1) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / 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 = (y - z) * (t - z)
if ((x / t_1) < 0.0d0) then
tmp = (x / (y - z)) / (t - z)
else
tmp = x * (1.0d0 / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) tmp = 0 if (x / t_1) < 0.0: tmp = (x / (y - z)) / (t - z) else: tmp = x * (1.0 / t_1) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (Float64(x / t_1) < 0.0) tmp = Float64(Float64(x / Float64(y - z)) / Float64(t - z)); else tmp = Float64(x * Float64(1.0 / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); tmp = 0.0; if ((x / t_1) < 0.0) tmp = (x / (y - z)) / (t - z); else tmp = x * (1.0 / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Less[N[(x / t$95$1), $MachinePrecision], 0.0], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;\frac{x}{t\_1} < 0:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024196
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ x (* (- y z) (- t z))) 0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z))))))
(/ x (* (- y z) (- t z))))