
(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 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(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
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+281)))
(* (/ x (- t z)) (- y z))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+281)) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+281)) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+281): tmp = (x / (t - z)) * (y - z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+281)) tmp = Float64(Float64(x / 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 * (y - z)) / (t - z); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+281))) 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[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+281]], $MachinePrecision]], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+281}\right):\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -inf.0 or 2.0000000000000001e281 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 2.0000000000000001e281Initial program 97.8%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (* (* (pow (- t z) -1.0) (- y z)) x))
double code(double x, double y, double z, double t) {
return (pow((t - z), -1.0) * (y - 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 = (((t - z) ** (-1.0d0)) * (y - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return (Math.pow((t - z), -1.0) * (y - z)) * x;
}
def code(x, y, z, t): return (math.pow((t - z), -1.0) * (y - z)) * x
function code(x, y, z, t) return Float64(Float64((Float64(t - z) ^ -1.0) * Float64(y - z)) * x) end
function tmp = code(x, y, z, t) tmp = (((t - z) ^ -1.0) * (y - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[Power[N[(t - z), $MachinePrecision], -1.0], $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(t - z\right)}^{-1} \cdot \left(y - z\right)\right) \cdot x
\end{array}
Initial program 84.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
difference-of-squares-revN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-/r/N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites97.6%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -1e+185)
(* (/ x (- t z)) y)
(if (<= t_1 1e-321) (/ (* (- y z) x) t) (- x (/ (* y x) z))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -1e+185) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 1e-321) {
tmp = ((y - z) * x) / t;
} else {
tmp = x - ((y * x) / 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) :: t_1
real(8) :: tmp
t_1 = (x * (y - z)) / (t - z)
if (t_1 <= (-1d+185)) then
tmp = (x / (t - z)) * y
else if (t_1 <= 1d-321) then
tmp = ((y - z) * x) / t
else
tmp = x - ((y * x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -1e+185) {
tmp = (x / (t - z)) * y;
} else if (t_1 <= 1e-321) {
tmp = ((y - z) * x) / t;
} else {
tmp = x - ((y * x) / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -1e+185: tmp = (x / (t - z)) * y elif t_1 <= 1e-321: tmp = ((y - z) * x) / t else: tmp = x - ((y * x) / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -1e+185) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (t_1 <= 1e-321) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = Float64(x - Float64(Float64(y * x) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -1e+185) tmp = (x / (t - z)) * y; elseif (t_1 <= 1e-321) tmp = ((y - z) * x) / t; else tmp = x - ((y * x) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+185], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 1e-321], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], N[(x - N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+185}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 10^{-321}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot x}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -9.9999999999999998e184Initial program 61.6%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.4
Applied rewrites76.4%
if -9.9999999999999998e184 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 9.98013e-322Initial program 96.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6480.5
Applied rewrites80.5%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.9
Applied rewrites58.9%
if 9.98013e-322 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 81.9%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6465.2
Applied rewrites65.2%
Taylor expanded in y around 0
Applied rewrites60.3%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e+171) (not (<= z 1.25e+172))) (fma x (/ (- t y) z) x) (* (/ x (- t z)) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+171) || !(z <= 1.25e+172)) {
tmp = fma(x, ((t - y) / z), x);
} else {
tmp = (x / (t - z)) * (y - z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e+171) || !(z <= 1.25e+172)) tmp = fma(x, Float64(Float64(t - y) / z), x); else tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e+171], N[Not[LessEqual[z, 1.25e+172]], $MachinePrecision]], N[(x * N[(N[(t - y), $MachinePrecision] / z), $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 -7.6 \cdot 10^{+171} \lor \neg \left(z \leq 1.25 \cdot 10^{+172}\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t - y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if z < -7.6000000000000004e171 or 1.25e172 < z Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.8
Applied rewrites50.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
difference-of-squares-revN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-/r/N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.8%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
Applied rewrites90.9%
if -7.6000000000000004e171 < z < 1.25e172Initial program 89.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.5
Applied rewrites91.5%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.5e+27) (not (<= y 1.6e+21))) (* (/ y (- t z)) x) (* (/ z (- t z)) (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e+27) || !(y <= 1.6e+21)) {
tmp = (y / (t - z)) * x;
} else {
tmp = (z / (t - 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 ((y <= (-4.5d+27)) .or. (.not. (y <= 1.6d+21))) then
tmp = (y / (t - z)) * x
else
tmp = (z / (t - z)) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e+27) || !(y <= 1.6e+21)) {
tmp = (y / (t - z)) * x;
} else {
tmp = (z / (t - z)) * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.5e+27) or not (y <= 1.6e+21): tmp = (y / (t - z)) * x else: tmp = (z / (t - z)) * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.5e+27) || !(y <= 1.6e+21)) tmp = Float64(Float64(y / Float64(t - z)) * x); else tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.5e+27) || ~((y <= 1.6e+21))) tmp = (y / (t - z)) * x; else tmp = (z / (t - z)) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.5e+27], N[Not[LessEqual[y, 1.6e+21]], $MachinePrecision]], N[(N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+27} \lor \neg \left(y \leq 1.6 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{y}{t - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -4.4999999999999999e27 or 1.6e21 < y Initial program 82.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.2
Applied rewrites82.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
difference-of-squares-revN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-/r/N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6474.7
Applied rewrites74.7%
if -4.4999999999999999e27 < y < 1.6e21Initial program 86.8%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6486.0
Applied rewrites86.0%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.65e-28) (* (/ (- z y) z) x) (if (<= z 2.85e+24) (* (/ (- y z) t) x) (fma x (/ (- t y) z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.65e-28) {
tmp = ((z - y) / z) * x;
} else if (z <= 2.85e+24) {
tmp = ((y - z) / t) * x;
} else {
tmp = fma(x, ((t - y) / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.65e-28) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= 2.85e+24) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = fma(x, Float64(Float64(t - y) / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.65e-28], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.85e+24], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-28}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq 2.85 \cdot 10^{+24}:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t - y}{z}, x\right)\\
\end{array}
\end{array}
if z < -1.6500000000000001e-28Initial program 78.9%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6479.4
Applied rewrites79.4%
if -1.6500000000000001e-28 < z < 2.8500000000000002e24Initial program 91.7%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
if 2.8500000000000002e24 < z Initial program 75.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6474.4
Applied rewrites74.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
difference-of-squares-revN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-/r/N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites75.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
Applied rewrites76.4%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e-28) (not (<= z 2.85e+24))) (* (/ (- z y) z) x) (* (/ (- y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e-28) || !(z <= 2.85e+24)) {
tmp = ((z - y) / z) * x;
} else {
tmp = ((y - z) / 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.65d-28)) .or. (.not. (z <= 2.85d+24))) then
tmp = ((z - y) / z) * x
else
tmp = ((y - z) / 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.65e-28) || !(z <= 2.85e+24)) {
tmp = ((z - y) / z) * x;
} else {
tmp = ((y - z) / t) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e-28) or not (z <= 2.85e+24): tmp = ((z - y) / z) * x else: tmp = ((y - z) / t) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e-28) || !(z <= 2.85e+24)) tmp = Float64(Float64(Float64(z - y) / z) * x); else tmp = Float64(Float64(Float64(y - z) / t) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.65e-28) || ~((z <= 2.85e+24))) tmp = ((z - y) / z) * x; else tmp = ((y - z) / t) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e-28], N[Not[LessEqual[z, 2.85e+24]], $MachinePrecision]], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-28} \lor \neg \left(z \leq 2.85 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\end{array}
\end{array}
if z < -1.6500000000000001e-28 or 2.8500000000000002e24 < z Initial program 77.6%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6478.1
Applied rewrites78.1%
if -1.6500000000000001e-28 < z < 2.8500000000000002e24Initial program 91.7%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.1e+23) (not (<= t 1.52))) (* (/ (- y z) t) x) (- x (/ (* y x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e+23) || !(t <= 1.52)) {
tmp = ((y - z) / t) * x;
} else {
tmp = x - ((y * x) / 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 <= (-4.1d+23)) .or. (.not. (t <= 1.52d0))) then
tmp = ((y - z) / t) * x
else
tmp = x - ((y * x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.1e+23) || !(t <= 1.52)) {
tmp = ((y - z) / t) * x;
} else {
tmp = x - ((y * x) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.1e+23) or not (t <= 1.52): tmp = ((y - z) / t) * x else: tmp = x - ((y * x) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.1e+23) || !(t <= 1.52)) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = Float64(x - Float64(Float64(y * x) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.1e+23) || ~((t <= 1.52))) tmp = ((y - z) / t) * x; else tmp = x - ((y * x) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.1e+23], N[Not[LessEqual[t, 1.52]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], N[(x - N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{+23} \lor \neg \left(t \leq 1.52\right):\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot x}{z}\\
\end{array}
\end{array}
if t < -4.09999999999999996e23 or 1.52 < t Initial program 83.7%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if -4.09999999999999996e23 < t < 1.52Initial program 85.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6479.3
Applied rewrites79.3%
Taylor expanded in y around 0
Applied rewrites77.8%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e-28) (not (<= z 2.85e+24))) (- x (/ (* y x) z)) (/ (* (- y z) x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-28) || !(z <= 2.85e+24)) {
tmp = x - ((y * x) / z);
} else {
tmp = ((y - z) * 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.45d-28)) .or. (.not. (z <= 2.85d+24))) then
tmp = x - ((y * x) / z)
else
tmp = ((y - z) * 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.45e-28) || !(z <= 2.85e+24)) {
tmp = x - ((y * x) / z);
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-28) or not (z <= 2.85e+24): tmp = x - ((y * x) / z) else: tmp = ((y - z) * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-28) || !(z <= 2.85e+24)) tmp = Float64(x - Float64(Float64(y * x) / z)); else tmp = Float64(Float64(Float64(y - z) * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e-28) || ~((z <= 2.85e+24))) tmp = x - ((y * x) / z); else tmp = ((y - z) * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e-28], N[Not[LessEqual[z, 2.85e+24]], $MachinePrecision]], N[(x - N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-28} \lor \neg \left(z \leq 2.85 \cdot 10^{+24}\right):\\
\;\;\;\;x - \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\end{array}
\end{array}
if z < -1.45000000000000006e-28 or 2.8500000000000002e24 < z Initial program 77.6%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6478.1
Applied rewrites78.1%
Taylor expanded in y around 0
Applied rewrites71.4%
if -1.45000000000000006e-28 < z < 2.8500000000000002e24Initial program 91.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Final simplification72.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e-28) (not (<= z 3.5e+24))) (* 1.0 x) (/ (* (- y z) x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-28) || !(z <= 3.5e+24)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * 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.7d-28)) .or. (.not. (z <= 3.5d+24))) then
tmp = 1.0d0 * x
else
tmp = ((y - z) * 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.7e-28) || !(z <= 3.5e+24)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e-28) or not (z <= 3.5e+24): tmp = 1.0 * x else: tmp = ((y - z) * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e-28) || !(z <= 3.5e+24)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(Float64(y - z) * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e-28) || ~((z <= 3.5e+24))) tmp = 1.0 * x; else tmp = ((y - z) * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e-28], N[Not[LessEqual[z, 3.5e+24]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-28} \lor \neg \left(z \leq 3.5 \cdot 10^{+24}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\end{array}
\end{array}
if z < -1.7e-28 or 3.5000000000000002e24 < z Initial program 77.6%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6478.1
Applied rewrites78.1%
Taylor expanded in y around 0
Applied rewrites63.9%
if -1.7e-28 < z < 3.5000000000000002e24Initial program 91.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e-35) (not (<= z 4.4e+80))) (* 1.0 x) (* x (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-35) || !(z <= 4.4e+80)) {
tmp = 1.0 * x;
} else {
tmp = x * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.45d-35)) .or. (.not. (z <= 4.4d+80))) then
tmp = 1.0d0 * x
else
tmp = x * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-35) || !(z <= 4.4e+80)) {
tmp = 1.0 * x;
} else {
tmp = x * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-35) or not (z <= 4.4e+80): tmp = 1.0 * x else: tmp = x * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-35) || !(z <= 4.4e+80)) tmp = Float64(1.0 * x); else tmp = Float64(x * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e-35) || ~((z <= 4.4e+80))) tmp = 1.0 * x; else tmp = x * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e-35], N[Not[LessEqual[z, 4.4e+80]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-35} \lor \neg \left(z \leq 4.4 \cdot 10^{+80}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.4500000000000001e-35 or 4.40000000000000005e80 < z Initial program 77.5%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6479.6
Applied rewrites79.6%
Taylor expanded in y around 0
Applied rewrites65.8%
if -1.4500000000000001e-35 < z < 4.40000000000000005e80Initial program 90.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.5
Applied rewrites61.5%
Applied rewrites66.3%
Final simplification66.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 84.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6452.0
Applied rewrites52.0%
Taylor expanded in y around 0
Applied rewrites37.5%
(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 2024339
(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)))