
(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 86.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.55e+65)
(* x 1.0)
(if (<= z 5.8e-58)
(* x (/ y t))
(if (<= z 6.5e+135) (* x (/ y (- z))) (* x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+65) {
tmp = x * 1.0;
} else if (z <= 5.8e-58) {
tmp = x * (y / t);
} else if (z <= 6.5e+135) {
tmp = x * (y / -z);
} 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.55d+65)) then
tmp = x * 1.0d0
else if (z <= 5.8d-58) then
tmp = x * (y / t)
else if (z <= 6.5d+135) then
tmp = x * (y / -z)
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.55e+65) {
tmp = x * 1.0;
} else if (z <= 5.8e-58) {
tmp = x * (y / t);
} else if (z <= 6.5e+135) {
tmp = x * (y / -z);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.55e+65: tmp = x * 1.0 elif z <= 5.8e-58: tmp = x * (y / t) elif z <= 6.5e+135: tmp = x * (y / -z) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+65) tmp = Float64(x * 1.0); elseif (z <= 5.8e-58) tmp = Float64(x * Float64(y / t)); elseif (z <= 6.5e+135) tmp = Float64(x * Float64(y / Float64(-z))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.55e+65) tmp = x * 1.0; elseif (z <= 5.8e-58) tmp = x * (y / t); elseif (z <= 6.5e+135) tmp = x * (y / -z); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+65], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 5.8e-58], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+135], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+135}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.54999999999999995e65 or 6.5000000000000003e135 < z Initial program 73.2%
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 rewrites69.0%
if -1.54999999999999995e65 < z < 5.7999999999999998e-58Initial program 94.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
Taylor expanded in z around 0
lower-/.f6469.3
Applied rewrites69.3%
if 5.7999999999999998e-58 < z < 6.5000000000000003e135Initial program 89.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
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6457.9
Applied rewrites57.9%
Taylor expanded in y around inf
Applied rewrites45.2%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.28e+157) (* x (- 1.0 (/ y z))) (if (<= z 5.7e+222) (* (- y z) (/ x (- t z))) (* x (/ (- z) (- t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.28e+157) {
tmp = x * (1.0 - (y / z));
} else if (z <= 5.7e+222) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = x * (-z / (t - 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.28d+157)) then
tmp = x * (1.0d0 - (y / z))
else if (z <= 5.7d+222) then
tmp = (y - z) * (x / (t - z))
else
tmp = x * (-z / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.28e+157) {
tmp = x * (1.0 - (y / z));
} else if (z <= 5.7e+222) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = x * (-z / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.28e+157: tmp = x * (1.0 - (y / z)) elif z <= 5.7e+222: tmp = (y - z) * (x / (t - z)) else: tmp = x * (-z / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.28e+157) tmp = Float64(x * Float64(1.0 - Float64(y / z))); elseif (z <= 5.7e+222) tmp = Float64(Float64(y - z) * Float64(x / Float64(t - z))); else tmp = Float64(x * Float64(Float64(-z) / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.28e+157) tmp = x * (1.0 - (y / z)); elseif (z <= 5.7e+222) tmp = (y - z) * (x / (t - z)); else tmp = x * (-z / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.28e+157], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e+222], N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[((-z) / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.28 \cdot 10^{+157}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{+222}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t - z}\\
\end{array}
\end{array}
if z < -1.28000000000000001e157Initial program 65.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
sub-negN/A
lower--.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
if -1.28000000000000001e157 < z < 5.69999999999999994e222Initial program 92.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if 5.69999999999999994e222 < z Initial program 68.1%
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
lower-neg.f6491.0
Applied rewrites91.0%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ y z))))) (if (<= z -8.5e+55) t_1 (if (<= z 1150000.0) (* x (/ (- y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -8.5e+55) {
tmp = t_1;
} else if (z <= 1150000.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 * (1.0d0 - (y / z))
if (z <= (-8.5d+55)) then
tmp = t_1
else if (z <= 1150000.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 * (1.0 - (y / z));
double tmp;
if (z <= -8.5e+55) {
tmp = t_1;
} else if (z <= 1150000.0) {
tmp = x * ((y - z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -8.5e+55: tmp = t_1 elif z <= 1150000.0: tmp = x * ((y - z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -8.5e+55) tmp = t_1; elseif (z <= 1150000.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 * (1.0 - (y / z)); tmp = 0.0; if (z <= -8.5e+55) tmp = t_1; elseif (z <= 1150000.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[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+55], t$95$1, If[LessEqual[z, 1150000.0], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1150000:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.50000000000000002e55 or 1.15e6 < z Initial program 76.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
sub-negN/A
lower--.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
if -8.50000000000000002e55 < z < 1.15e6Initial program 95.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.0
Applied rewrites96.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6481.6
Applied rewrites81.6%
Final simplification80.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- 1.0 (/ y z))))) (if (<= z -8.5e+55) t_1 (if (<= z 1150000.0) (/ (* (- y z) x) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -8.5e+55) {
tmp = t_1;
} else if (z <= 1150000.0) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / z))
if (z <= (-8.5d+55)) then
tmp = t_1
else if (z <= 1150000.0d0) then
tmp = ((y - z) * x) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -8.5e+55) {
tmp = t_1;
} else if (z <= 1150000.0) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -8.5e+55: tmp = t_1 elif z <= 1150000.0: tmp = ((y - z) * x) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -8.5e+55) tmp = t_1; elseif (z <= 1150000.0) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -8.5e+55) tmp = t_1; elseif (z <= 1150000.0) tmp = ((y - z) * x) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+55], t$95$1, If[LessEqual[z, 1150000.0], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1150000:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.50000000000000002e55 or 1.15e6 < z Initial program 76.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
sub-negN/A
lower--.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
if -8.50000000000000002e55 < z < 1.15e6Initial program 95.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6479.3
Applied rewrites79.3%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.55e+65) (- x (* y (/ x z))) (if (<= z 1150000.0) (/ (* (- y z) x) t) (fma (- (/ x z)) y x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+65) {
tmp = x - (y * (x / z));
} else if (z <= 1150000.0) {
tmp = ((y - z) * x) / t;
} else {
tmp = fma(-(x / z), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+65) tmp = Float64(x - Float64(y * Float64(x / z))); elseif (z <= 1150000.0) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = fma(Float64(-Float64(x / z)), y, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+65], N[(x - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1150000.0], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], N[((-N[(x / z), $MachinePrecision]) * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;x - y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1150000:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\frac{x}{z}, y, x\right)\\
\end{array}
\end{array}
if z < -1.54999999999999995e65Initial program 74.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
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6477.6
Applied rewrites77.6%
if -1.54999999999999995e65 < z < 1.15e6Initial program 95.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
if 1.15e6 < z Initial program 76.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
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6470.1
Applied rewrites70.1%
Applied rewrites70.1%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* y (/ x z))))) (if (<= z -1.55e+65) t_1 (if (<= z 1150000.0) (/ (* (- y z) x) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y * (x / z));
double tmp;
if (z <= -1.55e+65) {
tmp = t_1;
} else if (z <= 1150000.0) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x - (y * (x / z))
if (z <= (-1.55d+65)) then
tmp = t_1
else if (z <= 1150000.0d0) then
tmp = ((y - z) * x) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (y * (x / z));
double tmp;
if (z <= -1.55e+65) {
tmp = t_1;
} else if (z <= 1150000.0) {
tmp = ((y - z) * x) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y * (x / z)) tmp = 0 if z <= -1.55e+65: tmp = t_1 elif z <= 1150000.0: tmp = ((y - z) * x) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y * Float64(x / z))) tmp = 0.0 if (z <= -1.55e+65) tmp = t_1; elseif (z <= 1150000.0) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y * (x / z)); tmp = 0.0; if (z <= -1.55e+65) tmp = t_1; elseif (z <= 1150000.0) tmp = ((y - z) * x) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+65], t$95$1, If[LessEqual[z, 1150000.0], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1150000:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.54999999999999995e65 or 1.15e6 < z Initial program 75.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
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -1.54999999999999995e65 < z < 1.15e6Initial program 95.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* y (/ x z))))) (if (<= z -3.5e+120) t_1 (if (<= z 2.8e+27) (* x (/ y (- t z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y * (x / z));
double tmp;
if (z <= -3.5e+120) {
tmp = t_1;
} else if (z <= 2.8e+27) {
tmp = x * (y / (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 - (y * (x / z))
if (z <= (-3.5d+120)) then
tmp = t_1
else if (z <= 2.8d+27) then
tmp = x * (y / (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 - (y * (x / z));
double tmp;
if (z <= -3.5e+120) {
tmp = t_1;
} else if (z <= 2.8e+27) {
tmp = x * (y / (t - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y * (x / z)) tmp = 0 if z <= -3.5e+120: tmp = t_1 elif z <= 2.8e+27: tmp = x * (y / (t - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y * Float64(x / z))) tmp = 0.0 if (z <= -3.5e+120) tmp = t_1; elseif (z <= 2.8e+27) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y * (x / z)); tmp = 0.0; if (z <= -3.5e+120) tmp = t_1; elseif (z <= 2.8e+27) tmp = x * (y / (t - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+120], t$95$1, If[LessEqual[z, 2.8e+27], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000007e120 or 2.7999999999999999e27 < z Initial program 70.7%
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
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if -3.50000000000000007e120 < z < 2.7999999999999999e27Initial program 95.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.3
Applied rewrites72.3%
(FPCore (x y z t) :precision binary64 (if (<= z -2.3e+115) (* x 1.0) (if (<= z 6.5e+135) (* x (/ y (- t z))) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+115) {
tmp = x * 1.0;
} else if (z <= 6.5e+135) {
tmp = x * (y / (t - z));
} 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.3d+115)) then
tmp = x * 1.0d0
else if (z <= 6.5d+135) then
tmp = x * (y / (t - z))
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.3e+115) {
tmp = x * 1.0;
} else if (z <= 6.5e+135) {
tmp = x * (y / (t - z));
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.3e+115: tmp = x * 1.0 elif z <= 6.5e+135: tmp = x * (y / (t - z)) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.3e+115) tmp = Float64(x * 1.0); elseif (z <= 6.5e+135) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.3e+115) tmp = x * 1.0; elseif (z <= 6.5e+135) tmp = x * (y / (t - z)); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.3e+115], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 6.5e+135], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+115}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+135}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -2.30000000000000004e115 or 6.5000000000000003e135 < z Initial program 68.8%
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 rewrites74.7%
if -2.30000000000000004e115 < z < 6.5000000000000003e135Initial program 93.9%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
Final simplification72.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.55e+65) (* x 1.0) (if (<= z 8500000000.0) (* x (/ y t)) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+65) {
tmp = x * 1.0;
} else if (z <= 8500000000.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 <= (-1.55d+65)) then
tmp = x * 1.0d0
else if (z <= 8500000000.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 <= -1.55e+65) {
tmp = x * 1.0;
} else if (z <= 8500000000.0) {
tmp = x * (y / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.55e+65: tmp = x * 1.0 elif z <= 8500000000.0: tmp = x * (y / t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+65) tmp = Float64(x * 1.0); elseif (z <= 8500000000.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 <= -1.55e+65) tmp = x * 1.0; elseif (z <= 8500000000.0) tmp = x * (y / t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+65], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 8500000000.0], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 8500000000:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.54999999999999995e65 or 8.5e9 < z Initial program 75.2%
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.1%
if -1.54999999999999995e65 < z < 8.5e9Initial program 95.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in z around 0
lower-/.f6464.9
Applied rewrites64.9%
Final simplification62.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.55e+65) (* x 1.0) (if (<= z 2.9e+27) (/ (* y x) t) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+65) {
tmp = x * 1.0;
} else if (z <= 2.9e+27) {
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.55d+65)) then
tmp = x * 1.0d0
else if (z <= 2.9d+27) 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.55e+65) {
tmp = x * 1.0;
} else if (z <= 2.9e+27) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.55e+65: tmp = x * 1.0 elif z <= 2.9e+27: tmp = (y * x) / t else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+65) tmp = Float64(x * 1.0); elseif (z <= 2.9e+27) 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.55e+65) tmp = x * 1.0; elseif (z <= 2.9e+27) tmp = (y * x) / t; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+65], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 2.9e+27], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+27}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.54999999999999995e65 or 2.9000000000000001e27 < z Initial program 74.6%
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 rewrites61.7%
if -1.54999999999999995e65 < z < 2.9000000000000001e27Initial program 95.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
Final simplification61.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.55e+65) (* x 1.0) (if (<= z 2.9e+27) (* y (/ x t)) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+65) {
tmp = x * 1.0;
} else if (z <= 2.9e+27) {
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.55d+65)) then
tmp = x * 1.0d0
else if (z <= 2.9d+27) 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.55e+65) {
tmp = x * 1.0;
} else if (z <= 2.9e+27) {
tmp = y * (x / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.55e+65: tmp = x * 1.0 elif z <= 2.9e+27: tmp = y * (x / t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+65) tmp = Float64(x * 1.0); elseif (z <= 2.9e+27) 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.55e+65) tmp = x * 1.0; elseif (z <= 2.9e+27) tmp = y * (x / t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+65], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 2.9e+27], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+65}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+27}:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -1.54999999999999995e65 or 2.9000000000000001e27 < z Initial program 74.6%
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 rewrites61.7%
if -1.54999999999999995e65 < z < 2.9000000000000001e27Initial program 95.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites58.2%
Final simplification59.7%
(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 86.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
Taylor expanded in z around inf
Applied rewrites32.2%
Final simplification32.2%
(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 2024226
(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)))