
(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 10 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 (/ 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}
Initial program 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (or (<= t_1 0.0) (not (<= t_1 2e-94)))
(* (/ x (- t z)) (- y z))
(* x (/ z (- z t))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y - z)) / (t - z);
double tmp;
if ((t_1 <= 0.0) || !(t_1 <= 2e-94)) {
tmp = (x / (t - z)) * (y - z);
} 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) :: t_1
real(8) :: tmp
t_1 = (x * (y - z)) / (t - z)
if ((t_1 <= 0.0d0) .or. (.not. (t_1 <= 2d-94))) then
tmp = (x / (t - z)) * (y - z)
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 t_1 = (x * (y - z)) / (t - z);
double tmp;
if ((t_1 <= 0.0) || !(t_1 <= 2e-94)) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if (t_1 <= 0.0) or not (t_1 <= 2e-94): tmp = (x / (t - z)) * (y - z) else: tmp = x * (z / (z - t)) 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 <= 0.0) || !(t_1 <= 2e-94)) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = Float64(x * Float64(z / Float64(z - t))); 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 <= 0.0) || ~((t_1 <= 2e-94))) tmp = (x / (t - z)) * (y - z); else tmp = x * (z / (z - t)); 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, 0.0], N[Not[LessEqual[t$95$1, 2e-94]], $MachinePrecision]], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t\_1 \leq 0 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-94}\right):\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0 or 1.9999999999999999e-94 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 81.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6492.0
Applied rewrites92.0%
if -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 1.9999999999999999e-94Initial program 99.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/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
*-commutativeN/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--.f6477.9
Applied rewrites77.9%
Applied rewrites78.2%
Final simplification90.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.05e+35)
(fma (/ y (- z)) x x)
(if (<= z -5.4e-146)
(* x (/ (- y z) t))
(if (<= z 0.85) (* (/ x (- t z)) y) (* x (/ z (- z t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+35) {
tmp = fma((y / -z), x, x);
} else if (z <= -5.4e-146) {
tmp = x * ((y - z) / t);
} else if (z <= 0.85) {
tmp = (x / (t - z)) * y;
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+35) tmp = fma(Float64(y / Float64(-z)), x, x); elseif (z <= -5.4e-146) tmp = Float64(x * Float64(Float64(y - z) / t)); elseif (z <= 0.85) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e+35], N[(N[(y / (-z)), $MachinePrecision] * x + x), $MachinePrecision], If[LessEqual[z, -5.4e-146], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.85], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-z}, x, x\right)\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-146}:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{elif}\;z \leq 0.85:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -2.0499999999999999e35Initial program 72.6%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites83.1%
if -2.0499999999999999e35 < z < -5.3999999999999999e-146Initial program 91.1%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.1
Applied rewrites70.1%
Applied rewrites75.8%
if -5.3999999999999999e-146 < z < 0.849999999999999978Initial program 93.4%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6487.5
Applied rewrites87.5%
if 0.849999999999999978 < z Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/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
*-commutativeN/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--.f6464.6
Applied rewrites64.6%
Applied rewrites81.8%
Final simplification83.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ z (- z t)))))
(if (<= z -5.8e+98)
t_1
(if (<= z -3.8e+37)
(* (- y) (/ x z))
(if (<= z 10500.0) (* x (/ (- y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / (z - t));
double tmp;
if (z <= -5.8e+98) {
tmp = t_1;
} else if (z <= -3.8e+37) {
tmp = -y * (x / z);
} else if (z <= 10500.0) {
tmp = x * ((y - z) / t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (z / (z - t))
if (z <= (-5.8d+98)) then
tmp = t_1
else if (z <= (-3.8d+37)) then
tmp = -y * (x / z)
else if (z <= 10500.0d0) then
tmp = x * ((y - z) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z / (z - t));
double tmp;
if (z <= -5.8e+98) {
tmp = t_1;
} else if (z <= -3.8e+37) {
tmp = -y * (x / z);
} else if (z <= 10500.0) {
tmp = x * ((y - z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / (z - t)) tmp = 0 if z <= -5.8e+98: tmp = t_1 elif z <= -3.8e+37: tmp = -y * (x / z) elif z <= 10500.0: tmp = x * ((y - z) / t) 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 <= -5.8e+98) tmp = t_1; elseif (z <= -3.8e+37) tmp = Float64(Float64(-y) * Float64(x / z)); elseif (z <= 10500.0) tmp = Float64(x * Float64(Float64(y - z) / t)); 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 <= -5.8e+98) tmp = t_1; elseif (z <= -3.8e+37) tmp = -y * (x / z); elseif (z <= 10500.0) tmp = x * ((y - z) / t); 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, -5.8e+98], t$95$1, If[LessEqual[z, -3.8e+37], N[((-y) * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 10500.0], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{z - t}\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{+37}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 10500:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.8000000000000002e98 or 10500 < z Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/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
*-commutativeN/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--.f6463.3
Applied rewrites63.3%
Applied rewrites84.5%
if -5.8000000000000002e98 < z < -3.7999999999999999e37Initial program 86.5%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites86.3%
Taylor expanded in y around inf
Applied rewrites72.8%
if -3.7999999999999999e37 < z < 10500Initial program 92.8%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.5
Applied rewrites75.5%
Applied rewrites77.1%
Final simplification80.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.8e+98)
(/ x 1.0)
(if (<= z -2.5e+37)
(* (- y) (/ x z))
(if (<= z 2200000000.0) (* x (/ y t)) (/ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+98) {
tmp = x / 1.0;
} else if (z <= -2.5e+37) {
tmp = -y * (x / z);
} else if (z <= 2200000000.0) {
tmp = x * (y / 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 <= (-5.8d+98)) then
tmp = x / 1.0d0
else if (z <= (-2.5d+37)) then
tmp = -y * (x / z)
else if (z <= 2200000000.0d0) then
tmp = x * (y / 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 <= -5.8e+98) {
tmp = x / 1.0;
} else if (z <= -2.5e+37) {
tmp = -y * (x / z);
} else if (z <= 2200000000.0) {
tmp = x * (y / t);
} else {
tmp = x / 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+98: tmp = x / 1.0 elif z <= -2.5e+37: tmp = -y * (x / z) elif z <= 2200000000.0: tmp = x * (y / t) else: tmp = x / 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+98) tmp = Float64(x / 1.0); elseif (z <= -2.5e+37) tmp = Float64(Float64(-y) * Float64(x / z)); elseif (z <= 2200000000.0) tmp = Float64(x * Float64(y / t)); else tmp = Float64(x / 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+98) tmp = x / 1.0; elseif (z <= -2.5e+37) tmp = -y * (x / z); elseif (z <= 2200000000.0) tmp = x * (y / t); else tmp = x / 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+98], N[(x / 1.0), $MachinePrecision], If[LessEqual[z, -2.5e+37], N[((-y) * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2200000000.0], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x / 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{+37}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 2200000000:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1}\\
\end{array}
\end{array}
if z < -5.8000000000000002e98 or 2.2e9 < z Initial program 72.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites68.9%
if -5.8000000000000002e98 < z < -2.49999999999999994e37Initial program 86.5%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites86.3%
Taylor expanded in y around inf
Applied rewrites72.8%
if -2.49999999999999994e37 < z < 2.2e9Initial program 92.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
Applied rewrites67.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+98) (not (<= z 0.85))) (* x (/ z (- z t))) (* (/ x (- t z)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+98) || !(z <= 0.85)) {
tmp = x * (z / (z - t));
} else {
tmp = (x / (t - z)) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.8d+98)) .or. (.not. (z <= 0.85d0))) then
tmp = x * (z / (z - t))
else
tmp = (x / (t - z)) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+98) || !(z <= 0.85)) {
tmp = x * (z / (z - t));
} else {
tmp = (x / (t - z)) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+98) or not (z <= 0.85): tmp = x * (z / (z - t)) else: tmp = (x / (t - z)) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+98) || !(z <= 0.85)) tmp = Float64(x * Float64(z / Float64(z - t))); else tmp = Float64(Float64(x / Float64(t - z)) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.8e+98) || ~((z <= 0.85))) tmp = x * (z / (z - t)); else tmp = (x / (t - z)) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+98], N[Not[LessEqual[z, 0.85]], $MachinePrecision]], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+98} \lor \neg \left(z \leq 0.85\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\end{array}
\end{array}
if z < -5.8000000000000002e98 or 0.849999999999999978 < z Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/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
*-commutativeN/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--.f6463.3
Applied rewrites63.3%
Applied rewrites84.5%
if -5.8000000000000002e98 < z < 0.849999999999999978Initial program 92.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.2
Applied rewrites79.2%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e-84) (not (<= z 0.27))) (* x (/ z (- z t))) (* x (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e-84) || !(z <= 0.27)) {
tmp = x * (z / (z - t));
} 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 <= (-2.1d-84)) .or. (.not. (z <= 0.27d0))) then
tmp = x * (z / (z - t))
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 <= -2.1e-84) || !(z <= 0.27)) {
tmp = x * (z / (z - t));
} else {
tmp = x * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e-84) or not (z <= 0.27): tmp = x * (z / (z - t)) else: tmp = x * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.1e-84) || !(z <= 0.27)) tmp = Float64(x * Float64(z / Float64(z - t))); else tmp = Float64(x * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.1e-84) || ~((z <= 0.27))) tmp = x * (z / (z - t)); else tmp = x * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.1e-84], N[Not[LessEqual[z, 0.27]], $MachinePrecision]], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-84} \lor \neg \left(z \leq 0.27\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -2.09999999999999998e-84 or 0.27000000000000002 < z Initial program 77.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/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.7
Applied rewrites59.7%
Applied rewrites76.4%
if -2.09999999999999998e-84 < z < 0.27000000000000002Initial program 92.2%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.4
Applied rewrites71.4%
Applied rewrites72.6%
Final simplification74.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e+35) (not (<= z 2200000000.0))) (/ x 1.0) (* x (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e+35) || !(z <= 2200000000.0)) {
tmp = x / 1.0;
} 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 <= (-2.1d+35)) .or. (.not. (z <= 2200000000.0d0))) then
tmp = x / 1.0d0
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 <= -2.1e+35) || !(z <= 2200000000.0)) {
tmp = x / 1.0;
} else {
tmp = x * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e+35) or not (z <= 2200000000.0): tmp = x / 1.0 else: tmp = x * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.1e+35) || !(z <= 2200000000.0)) tmp = Float64(x / 1.0); else tmp = Float64(x * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.1e+35) || ~((z <= 2200000000.0))) tmp = x / 1.0; else tmp = x * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.1e+35], N[Not[LessEqual[z, 2200000000.0]], $MachinePrecision]], N[(x / 1.0), $MachinePrecision], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+35} \lor \neg \left(z \leq 2200000000\right):\\
\;\;\;\;\frac{x}{1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -2.0999999999999999e35 or 2.2e9 < z Initial program 74.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites64.1%
if -2.0999999999999999e35 < z < 2.2e9Initial program 92.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
Applied rewrites67.3%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (* (/ (- y z) (- t z)) x))
double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y - z) / (t - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
def code(x, y, z, t): return ((y - z) / (t - z)) * x
function code(x, y, z, t) return Float64(Float64(Float64(y - z) / Float64(t - z)) * x) end
function tmp = code(x, y, z, t) tmp = ((y - z) / (t - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - z}{t - z} \cdot x
\end{array}
Initial program 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
(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}
\\
\frac{x}{1}
\end{array}
Initial program 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
Taylor expanded in z around inf
Applied rewrites37.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}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024324
(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)))