
(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 9 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 (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
Initial program 83.5%
*-commutative83.5%
associate-*l/95.8%
*-commutative95.8%
Simplified95.8%
Final simplification95.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -2.7e-25)
t_1
(if (<= z 9e-264)
(* (- y z) (/ x t))
(if (<= z 2.7e-7)
(* x (/ y (- t z)))
(if (<= z 7.8e+234) t_1 (* x (/ z (- z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -2.7e-25) {
tmp = t_1;
} else if (z <= 9e-264) {
tmp = (y - z) * (x / t);
} else if (z <= 2.7e-7) {
tmp = x * (y / (t - z));
} else if (z <= 7.8e+234) {
tmp = t_1;
} 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 * (1.0d0 - (y / z))
if (z <= (-2.7d-25)) then
tmp = t_1
else if (z <= 9d-264) then
tmp = (y - z) * (x / t)
else if (z <= 2.7d-7) then
tmp = x * (y / (t - z))
else if (z <= 7.8d+234) then
tmp = t_1
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 * (1.0 - (y / z));
double tmp;
if (z <= -2.7e-25) {
tmp = t_1;
} else if (z <= 9e-264) {
tmp = (y - z) * (x / t);
} else if (z <= 2.7e-7) {
tmp = x * (y / (t - z));
} else if (z <= 7.8e+234) {
tmp = t_1;
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -2.7e-25: tmp = t_1 elif z <= 9e-264: tmp = (y - z) * (x / t) elif z <= 2.7e-7: tmp = x * (y / (t - z)) elif z <= 7.8e+234: tmp = t_1 else: tmp = x * (z / (z - t)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -2.7e-25) tmp = t_1; elseif (z <= 9e-264) tmp = Float64(Float64(y - z) * Float64(x / t)); elseif (z <= 2.7e-7) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (z <= 7.8e+234) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -2.7e-25) tmp = t_1; elseif (z <= 9e-264) tmp = (y - z) * (x / t); elseif (z <= 2.7e-7) tmp = x * (y / (t - z)); elseif (z <= 7.8e+234) tmp = t_1; else tmp = x * (z / (z - t)); 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, -2.7e-25], t$95$1, If[LessEqual[z, 9e-264], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-7], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+234], t$95$1, N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-264}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -2.70000000000000016e-25 or 2.70000000000000009e-7 < z < 7.7999999999999994e234Initial program 80.3%
*-commutative80.3%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 84.5%
mul-1-neg84.5%
div-sub84.5%
sub-neg84.5%
*-inverses84.5%
metadata-eval84.5%
Simplified84.5%
Taylor expanded in x around 0 84.5%
if -2.70000000000000016e-25 < z < 9.0000000000000001e-264Initial program 89.3%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in t around inf 84.9%
if 9.0000000000000001e-264 < z < 2.70000000000000009e-7Initial program 92.3%
*-commutative92.3%
associate-*l/96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in y around inf 81.1%
if 7.7999999999999994e234 < z Initial program 58.7%
*-commutative58.7%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
neg-mul-199.9%
distribute-neg-frac99.9%
Simplified99.9%
frac-2neg99.9%
div-inv99.9%
remove-double-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification85.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -6e-28)
t_1
(if (<= z 5.9e-291)
(* (- y z) (/ x t))
(if (<= z 2.2e-9)
(/ x (/ (- t z) y))
(if (<= z 8.2e+234) t_1 (* x (/ z (- z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -6e-28) {
tmp = t_1;
} else if (z <= 5.9e-291) {
tmp = (y - z) * (x / t);
} else if (z <= 2.2e-9) {
tmp = x / ((t - z) / y);
} else if (z <= 8.2e+234) {
tmp = t_1;
} 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 * (1.0d0 - (y / z))
if (z <= (-6d-28)) then
tmp = t_1
else if (z <= 5.9d-291) then
tmp = (y - z) * (x / t)
else if (z <= 2.2d-9) then
tmp = x / ((t - z) / y)
else if (z <= 8.2d+234) then
tmp = t_1
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 * (1.0 - (y / z));
double tmp;
if (z <= -6e-28) {
tmp = t_1;
} else if (z <= 5.9e-291) {
tmp = (y - z) * (x / t);
} else if (z <= 2.2e-9) {
tmp = x / ((t - z) / y);
} else if (z <= 8.2e+234) {
tmp = t_1;
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -6e-28: tmp = t_1 elif z <= 5.9e-291: tmp = (y - z) * (x / t) elif z <= 2.2e-9: tmp = x / ((t - z) / y) elif z <= 8.2e+234: tmp = t_1 else: tmp = x * (z / (z - t)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -6e-28) tmp = t_1; elseif (z <= 5.9e-291) tmp = Float64(Float64(y - z) * Float64(x / t)); elseif (z <= 2.2e-9) tmp = Float64(x / Float64(Float64(t - z) / y)); elseif (z <= 8.2e+234) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -6e-28) tmp = t_1; elseif (z <= 5.9e-291) tmp = (y - z) * (x / t); elseif (z <= 2.2e-9) tmp = x / ((t - z) / y); elseif (z <= 8.2e+234) tmp = t_1; else tmp = x * (z / (z - t)); 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, -6e-28], t$95$1, If[LessEqual[z, 5.9e-291], N[(N[(y - z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-9], N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e+234], t$95$1, N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-291}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -6.00000000000000005e-28 or 2.1999999999999998e-9 < z < 8.19999999999999948e234Initial program 80.3%
*-commutative80.3%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 84.5%
mul-1-neg84.5%
div-sub84.5%
sub-neg84.5%
*-inverses84.5%
metadata-eval84.5%
Simplified84.5%
Taylor expanded in x around 0 84.5%
if -6.00000000000000005e-28 < z < 5.89999999999999972e-291Initial program 88.7%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around inf 84.0%
if 5.89999999999999972e-291 < z < 2.1999999999999998e-9Initial program 92.8%
*-commutative92.8%
associate-*l/96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in y around inf 81.4%
associate-/l*84.4%
Simplified84.4%
if 8.19999999999999948e234 < z Initial program 58.7%
*-commutative58.7%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
neg-mul-199.9%
distribute-neg-frac99.9%
Simplified99.9%
frac-2neg99.9%
div-inv99.9%
remove-double-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification85.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y z)))))
(if (<= z -2.6e+65)
t_1
(if (<= z 4.5e-11)
(* x (/ y (- t z)))
(if (<= z 8e+234) t_1 (* x (/ z (- z t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / z));
double tmp;
if (z <= -2.6e+65) {
tmp = t_1;
} else if (z <= 4.5e-11) {
tmp = x * (y / (t - z));
} else if (z <= 8e+234) {
tmp = t_1;
} 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 * (1.0d0 - (y / z))
if (z <= (-2.6d+65)) then
tmp = t_1
else if (z <= 4.5d-11) then
tmp = x * (y / (t - z))
else if (z <= 8d+234) then
tmp = t_1
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 * (1.0 - (y / z));
double tmp;
if (z <= -2.6e+65) {
tmp = t_1;
} else if (z <= 4.5e-11) {
tmp = x * (y / (t - z));
} else if (z <= 8e+234) {
tmp = t_1;
} else {
tmp = x * (z / (z - t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / z)) tmp = 0 if z <= -2.6e+65: tmp = t_1 elif z <= 4.5e-11: tmp = x * (y / (t - z)) elif z <= 8e+234: tmp = t_1 else: tmp = x * (z / (z - t)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / z))) tmp = 0.0 if (z <= -2.6e+65) tmp = t_1; elseif (z <= 4.5e-11) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (z <= 8e+234) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / z)); tmp = 0.0; if (z <= -2.6e+65) tmp = t_1; elseif (z <= 4.5e-11) tmp = x * (y / (t - z)); elseif (z <= 8e+234) tmp = t_1; else tmp = x * (z / (z - t)); 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, -2.6e+65], t$95$1, If[LessEqual[z, 4.5e-11], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+234], t$95$1, N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\end{array}
\end{array}
if z < -2.60000000000000003e65 or 4.5e-11 < z < 8.00000000000000014e234Initial program 77.0%
*-commutative77.0%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 87.9%
mul-1-neg87.9%
div-sub87.9%
sub-neg87.9%
*-inverses87.9%
metadata-eval87.9%
Simplified87.9%
Taylor expanded in x around 0 87.9%
if -2.60000000000000003e65 < z < 4.5e-11Initial program 91.7%
*-commutative91.7%
associate-*l/92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around inf 77.4%
if 8.00000000000000014e234 < z Initial program 58.7%
*-commutative58.7%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
neg-mul-199.9%
distribute-neg-frac99.9%
Simplified99.9%
frac-2neg99.9%
div-inv99.9%
remove-double-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-32) (not (<= z 1.8e-10))) (* x (- 1.0 (/ y z))) (* y (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-32) || !(z <= 1.8e-10)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = y * (x / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9d-32)) .or. (.not. (z <= 1.8d-10))) then
tmp = x * (1.0d0 - (y / z))
else
tmp = y * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-32) || !(z <= 1.8e-10)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = y * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-32) or not (z <= 1.8e-10): tmp = x * (1.0 - (y / z)) else: tmp = y * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-32) || !(z <= 1.8e-10)) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(y * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-32) || ~((z <= 1.8e-10))) tmp = x * (1.0 - (y / z)); else tmp = y * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-32], N[Not[LessEqual[z, 1.8e-10]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-32} \lor \neg \left(z \leq 1.8 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -9.00000000000000009e-32 or 1.8e-10 < z Initial program 76.9%
*-commutative76.9%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 83.3%
mul-1-neg83.3%
div-sub83.4%
sub-neg83.4%
*-inverses83.4%
metadata-eval83.4%
Simplified83.4%
Taylor expanded in x around 0 83.4%
if -9.00000000000000009e-32 < z < 1.8e-10Initial program 90.7%
*-commutative90.7%
associate-*l/91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around 0 68.2%
associate-/l*70.2%
Simplified70.2%
associate-/r/71.5%
Applied egg-rr71.5%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.06e+65) (not (<= z 2.2e-9))) (* x (- 1.0 (/ y z))) (* x (/ y (- t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.06e+65) || !(z <= 2.2e-9)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / (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 <= (-2.06d+65)) .or. (.not. (z <= 2.2d-9))) then
tmp = x * (1.0d0 - (y / z))
else
tmp = x * (y / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.06e+65) || !(z <= 2.2e-9)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.06e+65) or not (z <= 2.2e-9): tmp = x * (1.0 - (y / z)) else: tmp = x * (y / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.06e+65) || !(z <= 2.2e-9)) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(x * Float64(y / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.06e+65) || ~((z <= 2.2e-9))) tmp = x * (1.0 - (y / z)); else tmp = x * (y / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.06e+65], N[Not[LessEqual[z, 2.2e-9]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.06 \cdot 10^{+65} \lor \neg \left(z \leq 2.2 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if z < -2.06000000000000004e65 or 2.1999999999999998e-9 < z Initial program 73.7%
*-commutative73.7%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 86.0%
mul-1-neg86.0%
div-sub86.0%
sub-neg86.0%
*-inverses86.0%
metadata-eval86.0%
Simplified86.0%
Taylor expanded in x around 0 86.0%
if -2.06000000000000004e65 < z < 2.1999999999999998e-9Initial program 91.7%
*-commutative91.7%
associate-*l/92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around inf 77.4%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (<= z -9.2e+61) x (if (<= z 4.2e-6) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.2e+61) {
tmp = x;
} else if (z <= 4.2e-6) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-9.2d+61)) then
tmp = x
else if (z <= 4.2d-6) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.2e+61) {
tmp = x;
} else if (z <= 4.2e-6) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.2e+61: tmp = x elif z <= 4.2e-6: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.2e+61) tmp = x; elseif (z <= 4.2e-6) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.2e+61) tmp = x; elseif (z <= 4.2e-6) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.2e+61], x, If[LessEqual[z, 4.2e-6], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.1999999999999998e61 or 4.1999999999999996e-6 < z Initial program 74.1%
*-commutative74.1%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 70.5%
if -9.1999999999999998e61 < z < 4.1999999999999996e-6Initial program 91.6%
*-commutative91.6%
associate-*l/92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in z around 0 66.9%
Final simplification68.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.66e+62) x (if (<= z 0.00031) (* y (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.66e+62) {
tmp = x;
} else if (z <= 0.00031) {
tmp = y * (x / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.66d+62)) then
tmp = x
else if (z <= 0.00031d0) then
tmp = y * (x / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.66e+62) {
tmp = x;
} else if (z <= 0.00031) {
tmp = y * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.66e+62: tmp = x elif z <= 0.00031: tmp = y * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.66e+62) tmp = x; elseif (z <= 0.00031) tmp = Float64(y * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.66e+62) tmp = x; elseif (z <= 0.00031) tmp = y * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.66e+62], x, If[LessEqual[z, 0.00031], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.66 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.00031:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.6600000000000001e62 or 3.1e-4 < z Initial program 74.1%
*-commutative74.1%
associate-*l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 70.5%
if -1.6600000000000001e62 < z < 3.1e-4Initial program 91.6%
*-commutative91.6%
associate-*l/92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in z around 0 65.6%
associate-/l*67.3%
Simplified67.3%
associate-/r/68.5%
Applied egg-rr68.5%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return 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 = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 83.5%
*-commutative83.5%
associate-*l/95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in z around inf 39.2%
Final simplification39.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 2024031
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))