
(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 13 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 87.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ x (- z t)))) (t_2 (fma x (- (/ y z)) x)))
(if (<= z -2.7e+110)
t_2
(if (<= z -8e-34)
t_1
(if (<= z 0.035) (* x (/ y (- t z))) (if (<= z 4.2e+68) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x / (z - t));
double t_2 = fma(x, -(y / z), x);
double tmp;
if (z <= -2.7e+110) {
tmp = t_2;
} else if (z <= -8e-34) {
tmp = t_1;
} else if (z <= 0.035) {
tmp = x * (y / (t - z));
} else if (z <= 4.2e+68) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x / Float64(z - t))) t_2 = fma(x, Float64(-Float64(y / z)), x) tmp = 0.0 if (z <= -2.7e+110) tmp = t_2; elseif (z <= -8e-34) tmp = t_1; elseif (z <= 0.035) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (z <= 4.2e+68) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-N[(y / z), $MachinePrecision]) + x), $MachinePrecision]}, If[LessEqual[z, -2.7e+110], t$95$2, If[LessEqual[z, -8e-34], t$95$1, If[LessEqual[z, 0.035], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+68], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x}{z - t}\\
t_2 := \mathsf{fma}\left(x, -\frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+110}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.035:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.7000000000000001e110 or 4.20000000000000002e68 < z Initial program 75.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f647.1
Applied rewrites7.1%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in z around inf
Applied rewrites84.1%
if -2.7000000000000001e110 < z < -7.99999999999999942e-34 or 0.035000000000000003 < z < 4.20000000000000002e68Initial program 95.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
frac-2negN/A
associate-/r/N/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
associate--r+N/A
Applied rewrites93.3%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6471.6
Applied rewrites71.6%
if -7.99999999999999942e-34 < z < 0.035000000000000003Initial program 93.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6477.0
Applied rewrites77.0%
Final simplification78.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ x (- z t)))))
(if (<= z -1.45e+137)
(* x 1.0)
(if (<= z -1.9e-134)
t_1
(if (<= z 1.65e-51) (/ (* y x) t) (if (<= z 1e+198) t_1 (* x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x / (z - t));
double tmp;
if (z <= -1.45e+137) {
tmp = x * 1.0;
} else if (z <= -1.9e-134) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = (y * x) / t;
} else if (z <= 1e+198) {
tmp = t_1;
} else {
tmp = x * 1.0;
}
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 * (x / (z - t))
if (z <= (-1.45d+137)) then
tmp = x * 1.0d0
else if (z <= (-1.9d-134)) then
tmp = t_1
else if (z <= 1.65d-51) then
tmp = (y * x) / t
else if (z <= 1d+198) then
tmp = t_1
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x / (z - t));
double tmp;
if (z <= -1.45e+137) {
tmp = x * 1.0;
} else if (z <= -1.9e-134) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = (y * x) / t;
} else if (z <= 1e+198) {
tmp = t_1;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x / (z - t)) tmp = 0 if z <= -1.45e+137: tmp = x * 1.0 elif z <= -1.9e-134: tmp = t_1 elif z <= 1.65e-51: tmp = (y * x) / t elif z <= 1e+198: tmp = t_1 else: tmp = x * 1.0 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x / Float64(z - t))) tmp = 0.0 if (z <= -1.45e+137) tmp = Float64(x * 1.0); elseif (z <= -1.9e-134) tmp = t_1; elseif (z <= 1.65e-51) tmp = Float64(Float64(y * x) / t); elseif (z <= 1e+198) tmp = t_1; else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x / (z - t)); tmp = 0.0; if (z <= -1.45e+137) tmp = x * 1.0; elseif (z <= -1.9e-134) tmp = t_1; elseif (z <= 1.65e-51) tmp = (y * x) / t; elseif (z <= 1e+198) tmp = t_1; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+137], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, -1.9e-134], t$95$1, If[LessEqual[z, 1.65e-51], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1e+198], t$95$1, N[(x * 1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x}{z - t}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+137}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-51}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{elif}\;z \leq 10^{+198}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.44999999999999992e137 or 1.00000000000000002e198 < z Initial program 68.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites85.0%
if -1.44999999999999992e137 < z < -1.90000000000000001e-134 or 1.64999999999999986e-51 < z < 1.00000000000000002e198Initial program 92.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.0
Applied rewrites99.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
frac-2negN/A
associate-/r/N/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
associate--r+N/A
Applied rewrites92.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6461.9
Applied rewrites61.9%
if -1.90000000000000001e-134 < z < 1.64999999999999986e-51Initial program 91.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6477.8
Applied rewrites77.8%
Final simplification71.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (- (/ y z)) x)))
(if (<= z -5.6e-72)
t_1
(if (<= z 1.65e-51)
(/ (* y x) t)
(if (<= z 4.2e+68) (* z (/ x (- z t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, -(y / z), x);
double tmp;
if (z <= -5.6e-72) {
tmp = t_1;
} else if (z <= 1.65e-51) {
tmp = (y * x) / t;
} else if (z <= 4.2e+68) {
tmp = z * (x / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(-Float64(y / z)), x) tmp = 0.0 if (z <= -5.6e-72) tmp = t_1; elseif (z <= 1.65e-51) tmp = Float64(Float64(y * x) / t); elseif (z <= 4.2e+68) tmp = Float64(z * Float64(x / Float64(z - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-N[(y / z), $MachinePrecision]) + x), $MachinePrecision]}, If[LessEqual[z, -5.6e-72], t$95$1, If[LessEqual[z, 1.65e-51], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 4.2e+68], N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, -\frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -5.6 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-51}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+68}:\\
\;\;\;\;z \cdot \frac{x}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.5999999999999996e-72 or 4.20000000000000002e68 < z Initial program 81.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6414.7
Applied rewrites14.7%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6459.0
Applied rewrites59.0%
Taylor expanded in z around inf
Applied rewrites73.8%
if -5.5999999999999996e-72 < z < 1.64999999999999986e-51Initial program 92.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6474.8
Applied rewrites74.8%
if 1.64999999999999986e-51 < z < 4.20000000000000002e68Initial program 99.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
frac-2negN/A
associate-/r/N/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
associate--r+N/A
Applied rewrites91.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6468.3
Applied rewrites68.3%
Final simplification73.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e-30)
(* x 1.0)
(if (<= z -6.4e-72)
(* (/ x z) (- y))
(if (<= z 0.065) (/ (* y x) t) (* x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e-30) {
tmp = x * 1.0;
} else if (z <= -6.4e-72) {
tmp = (x / z) * -y;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.5d-30)) then
tmp = x * 1.0d0
else if (z <= (-6.4d-72)) then
tmp = (x / z) * -y
else if (z <= 0.065d0) then
tmp = (y * x) / t
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e-30) {
tmp = x * 1.0;
} else if (z <= -6.4e-72) {
tmp = (x / z) * -y;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e-30: tmp = x * 1.0 elif z <= -6.4e-72: tmp = (x / z) * -y elif z <= 0.065: tmp = (y * x) / t else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e-30) tmp = Float64(x * 1.0); elseif (z <= -6.4e-72) tmp = Float64(Float64(x / z) * Float64(-y)); elseif (z <= 0.065) tmp = Float64(Float64(y * x) / t); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e-30) tmp = x * 1.0; elseif (z <= -6.4e-72) tmp = (x / z) * -y; elseif (z <= 0.065) tmp = (y * x) / t; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e-30], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, -6.4e-72], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[z, 0.065], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-30}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -4.49999999999999967e-30 or 0.065000000000000002 < z Initial program 82.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites58.8%
if -4.49999999999999967e-30 < z < -6.39999999999999998e-72Initial program 94.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
frac-2negN/A
associate-/r/N/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
associate--r+N/A
Applied rewrites99.9%
Taylor expanded in z around inf
lower-/.f6468.1
Applied rewrites68.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6462.0
Applied rewrites62.0%
if -6.39999999999999998e-72 < z < 0.065000000000000002Initial program 93.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
Final simplification63.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.65e+110)
(* x 1.0)
(if (<= z -1.9e-134)
(/ (* x (- z)) t)
(if (<= z 0.065) (/ (* y x) t) (* x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.65e+110) {
tmp = x * 1.0;
} else if (z <= -1.9e-134) {
tmp = (x * -z) / t;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.65d+110)) then
tmp = x * 1.0d0
else if (z <= (-1.9d-134)) then
tmp = (x * -z) / t
else if (z <= 0.065d0) then
tmp = (y * x) / t
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.65e+110) {
tmp = x * 1.0;
} else if (z <= -1.9e-134) {
tmp = (x * -z) / t;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.65e+110: tmp = x * 1.0 elif z <= -1.9e-134: tmp = (x * -z) / t elif z <= 0.065: tmp = (y * x) / t else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.65e+110) tmp = Float64(x * 1.0); elseif (z <= -1.9e-134) tmp = Float64(Float64(x * Float64(-z)) / t); elseif (z <= 0.065) tmp = Float64(Float64(y * x) / t); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.65e+110) tmp = x * 1.0; elseif (z <= -1.9e-134) tmp = (x * -z) / t; elseif (z <= 0.065) tmp = (y * x) / t; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.65e+110], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, -1.9e-134], N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 0.065], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+110}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-134}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -2.6499999999999999e110 or 0.065000000000000002 < z Initial program 79.0%
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 rewrites65.9%
if -2.6499999999999999e110 < z < -1.90000000000000001e-134Initial program 94.6%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6451.5
Applied rewrites51.5%
Taylor expanded in y around 0
Applied rewrites39.8%
if -1.90000000000000001e-134 < z < 0.065000000000000002Initial program 92.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6473.4
Applied rewrites73.4%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e+137) (fma x (- (/ y z)) x) (if (<= z 6.2e+192) (* (- y z) (/ x (- t z))) (* x (/ z (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e+137) {
tmp = fma(x, -(y / z), x);
} else if (z <= 6.2e+192) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e+137) tmp = fma(x, Float64(-Float64(y / z)), x); elseif (z <= 6.2e+192) tmp = Float64(Float64(y - z) * Float64(x / Float64(t - z))); else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e+137], N[(x * (-N[(y / z), $MachinePrecision]) + x), $MachinePrecision], If[LessEqual[z, 6.2e+192], N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(x, -\frac{y}{z}, x\right)\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+192}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -1.60000000000000009e137Initial program 62.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f646.9
Applied rewrites6.9%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6459.3
Applied rewrites59.3%
Taylor expanded in z around inf
Applied rewrites94.3%
if -1.60000000000000009e137 < z < 6.1999999999999997e192Initial program 92.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if 6.1999999999999997e192 < z Initial program 83.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification92.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ z (- z t))))) (if (<= z -8e-33) t_1 (if (<= z 0.035) (/ (* y x) (- t z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / (z - t));
double tmp;
if (z <= -8e-33) {
tmp = t_1;
} else if (z <= 0.035) {
tmp = (y * x) / (t - 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 <= (-8d-33)) then
tmp = t_1
else if (z <= 0.035d0) then
tmp = (y * x) / (t - 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 <= -8e-33) {
tmp = t_1;
} else if (z <= 0.035) {
tmp = (y * x) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / (z - t)) tmp = 0 if z <= -8e-33: tmp = t_1 elif z <= 0.035: tmp = (y * x) / (t - z) 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 <= -8e-33) tmp = t_1; elseif (z <= 0.035) tmp = Float64(Float64(y * x) / Float64(t - 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 <= -8e-33) tmp = t_1; elseif (z <= 0.035) tmp = (y * x) / (t - z); 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, -8e-33], t$95$1, If[LessEqual[z, 0.035], N[(N[(y * x), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{z - t}\\
\mathbf{if}\;z \leq -8 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.035:\\
\;\;\;\;\frac{y \cdot x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0000000000000004e-33 or 0.035000000000000003 < z Initial program 82.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 y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6478.0
Applied rewrites78.0%
if -8.0000000000000004e-33 < z < 0.035000000000000003Initial program 93.3%
Taylor expanded in y around inf
lower-*.f6478.7
Applied rewrites78.7%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* x (- y z)) t))) (if (<= t -6.8e+44) t_1 (if (<= t 1.06e+51) (fma x (- (/ y z)) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / t;
double tmp;
if (t <= -6.8e+44) {
tmp = t_1;
} else if (t <= 1.06e+51) {
tmp = fma(x, -(y / z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y - z)) / t) tmp = 0.0 if (t <= -6.8e+44) tmp = t_1; elseif (t <= 1.06e+51) tmp = fma(x, Float64(-Float64(y / z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -6.8e+44], t$95$1, If[LessEqual[t, 1.06e+51], N[(x * (-N[(y / z), $MachinePrecision]) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t}\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.06 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(x, -\frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.8e44 or 1.06000000000000004e51 < t Initial program 90.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in y around 0
Applied rewrites44.3%
Taylor expanded in y around 0
Applied rewrites79.5%
if -6.8e44 < t < 1.06000000000000004e51Initial program 85.1%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6424.1
Applied rewrites24.1%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6466.6
Applied rewrites66.6%
Taylor expanded in z around inf
Applied rewrites77.0%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (/ x t)))) (if (<= t -6.8e+44) t_1 (if (<= t 1.06e+51) (fma x (- (/ y z)) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (x / t);
double tmp;
if (t <= -6.8e+44) {
tmp = t_1;
} else if (t <= 1.06e+51) {
tmp = fma(x, -(y / z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(x / t)) tmp = 0.0 if (t <= -6.8e+44) tmp = t_1; elseif (t <= 1.06e+51) tmp = fma(x, Float64(-Float64(y / z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.8e+44], t$95$1, If[LessEqual[t, 1.06e+51], N[(x * (-N[(y / z), $MachinePrecision]) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.06 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(x, -\frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.8e44 or 1.06000000000000004e51 < t Initial program 90.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.5
Applied rewrites79.5%
Applied rewrites74.7%
if -6.8e44 < t < 1.06000000000000004e51Initial program 85.1%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6424.1
Applied rewrites24.1%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6466.6
Applied rewrites66.6%
Taylor expanded in z around inf
Applied rewrites77.0%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-7) (* x 1.0) (if (<= z 0.065) (/ (* y x) t) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-7) {
tmp = x * 1.0;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
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-7)) then
tmp = x * 1.0d0
else if (z <= 0.065d0) then
tmp = (y * x) / t
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-7) {
tmp = x * 1.0;
} else if (z <= 0.065) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-7: tmp = x * 1.0 elif z <= 0.065: tmp = (y * x) / t else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-7) tmp = Float64(x * 1.0); elseif (z <= 0.065) tmp = Float64(Float64(y * x) / t); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-7) tmp = x * 1.0; elseif (z <= 0.065) tmp = (y * x) / t; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-7], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 0.065], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-7}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.79999999999999997e-7 or 0.065000000000000002 < z Initial program 81.3%
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 rewrites60.3%
if -1.79999999999999997e-7 < z < 0.065000000000000002Initial program 93.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6463.0
Applied rewrites63.0%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.75e-7) (* x 1.0) (if (<= z 0.017) (* y (/ x t)) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.75e-7) {
tmp = x * 1.0;
} else if (z <= 0.017) {
tmp = y * (x / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.75d-7)) then
tmp = x * 1.0d0
else if (z <= 0.017d0) then
tmp = y * (x / t)
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.75e-7) {
tmp = x * 1.0;
} else if (z <= 0.017) {
tmp = y * (x / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.75e-7: tmp = x * 1.0 elif z <= 0.017: tmp = y * (x / t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.75e-7) tmp = Float64(x * 1.0); elseif (z <= 0.017) tmp = Float64(y * Float64(x / t)); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.75e-7) tmp = x * 1.0; elseif (z <= 0.017) tmp = y * (x / t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.75e-7], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 0.017], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{-7}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 0.017:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.74999999999999992e-7 or 0.017000000000000001 < z Initial program 81.5%
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 rewrites59.9%
if -1.74999999999999992e-7 < z < 0.017000000000000001Initial program 93.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6462.7
Applied rewrites62.7%
Applied rewrites59.9%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (* x 1.0))
double code(double x, double y, double z, double t) {
return x * 1.0;
}
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 * 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return x * 1.0;
}
def code(x, y, z, t): return x * 1.0
function code(x, y, z, t) return Float64(x * 1.0) end
function tmp = code(x, y, z, t) tmp = x * 1.0; end
code[x_, y_, z_, t_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 1
\end{array}
Initial program 87.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in z around inf
Applied rewrites35.9%
Final simplification35.9%
(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 2024238
(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)))