
(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 (/ (- 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 82.8%
associate-/l*95.6%
Simplified95.6%
Final simplification95.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.4e+128)
x
(if (<= z -7.5e-17)
(* x (/ y (- z)))
(if (<= z 6.3e-242)
(/ (* x y) t)
(if (<= z 1500000000.0) (/ x (/ t y)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.4e+128) {
tmp = x;
} else if (z <= -7.5e-17) {
tmp = x * (y / -z);
} else if (z <= 6.3e-242) {
tmp = (x * y) / t;
} else if (z <= 1500000000.0) {
tmp = x / (t / y);
} 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.4d+128)) then
tmp = x
else if (z <= (-7.5d-17)) then
tmp = x * (y / -z)
else if (z <= 6.3d-242) then
tmp = (x * y) / t
else if (z <= 1500000000.0d0) then
tmp = x / (t / y)
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.4e+128) {
tmp = x;
} else if (z <= -7.5e-17) {
tmp = x * (y / -z);
} else if (z <= 6.3e-242) {
tmp = (x * y) / t;
} else if (z <= 1500000000.0) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.4e+128: tmp = x elif z <= -7.5e-17: tmp = x * (y / -z) elif z <= 6.3e-242: tmp = (x * y) / t elif z <= 1500000000.0: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.4e+128) tmp = x; elseif (z <= -7.5e-17) tmp = Float64(x * Float64(y / Float64(-z))); elseif (z <= 6.3e-242) tmp = Float64(Float64(x * y) / t); elseif (z <= 1500000000.0) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.4e+128) tmp = x; elseif (z <= -7.5e-17) tmp = x * (y / -z); elseif (z <= 6.3e-242) tmp = (x * y) / t; elseif (z <= 1500000000.0) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.4e+128], x, If[LessEqual[z, -7.5e-17], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.3e-242], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1500000000.0], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+128}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\mathbf{elif}\;z \leq 6.3 \cdot 10^{-242}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{elif}\;z \leq 1500000000:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.39999999999999991e128 or 1.5e9 < z Initial program 66.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 70.5%
if -1.39999999999999991e128 < z < -7.49999999999999984e-17Initial program 85.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 50.1%
*-commutative50.1%
associate-/l*50.3%
associate-*l*50.3%
associate-*l/50.3%
*-commutative50.3%
neg-mul-150.3%
neg-sub050.3%
associate--r-50.3%
neg-sub050.3%
+-commutative50.3%
sub-neg50.3%
div-sub50.3%
*-inverses50.3%
Simplified50.3%
Taylor expanded in y around inf 43.4%
associate-*r/43.4%
mul-1-neg43.4%
distribute-rgt-neg-out43.4%
associate-*r/43.4%
Simplified43.4%
if -7.49999999999999984e-17 < z < 6.3000000000000001e-242Initial program 96.2%
associate-/l*90.9%
Simplified90.9%
Taylor expanded in z around 0 72.7%
if 6.3000000000000001e-242 < z < 1.5e9Initial program 89.8%
associate-/l*93.2%
Simplified93.2%
clear-num93.1%
un-div-inv93.4%
Applied egg-rr93.4%
Taylor expanded in z around 0 58.5%
Final simplification65.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -7.9e+114)
x
(if (<= z -6.4e-18)
(* x (/ (- z) t))
(if (<= z 6.6e-242)
(/ (* x y) t)
(if (<= z 920000000.0) (/ x (/ t y)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.9e+114) {
tmp = x;
} else if (z <= -6.4e-18) {
tmp = x * (-z / t);
} else if (z <= 6.6e-242) {
tmp = (x * y) / t;
} else if (z <= 920000000.0) {
tmp = x / (t / y);
} 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 <= (-7.9d+114)) then
tmp = x
else if (z <= (-6.4d-18)) then
tmp = x * (-z / t)
else if (z <= 6.6d-242) then
tmp = (x * y) / t
else if (z <= 920000000.0d0) then
tmp = x / (t / y)
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 <= -7.9e+114) {
tmp = x;
} else if (z <= -6.4e-18) {
tmp = x * (-z / t);
} else if (z <= 6.6e-242) {
tmp = (x * y) / t;
} else if (z <= 920000000.0) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.9e+114: tmp = x elif z <= -6.4e-18: tmp = x * (-z / t) elif z <= 6.6e-242: tmp = (x * y) / t elif z <= 920000000.0: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.9e+114) tmp = x; elseif (z <= -6.4e-18) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= 6.6e-242) tmp = Float64(Float64(x * y) / t); elseif (z <= 920000000.0) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.9e+114) tmp = x; elseif (z <= -6.4e-18) tmp = x * (-z / t); elseif (z <= 6.6e-242) tmp = (x * y) / t; elseif (z <= 920000000.0) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.9e+114], x, If[LessEqual[z, -6.4e-18], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-242], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 920000000.0], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.9 \cdot 10^{+114}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-18}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-242}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{elif}\;z \leq 920000000:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.9000000000000001e114 or 9.2e8 < z Initial program 66.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 69.8%
if -7.9000000000000001e114 < z < -6.3999999999999998e-18Initial program 85.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around inf 44.2%
associate-/l*58.3%
Simplified58.3%
Taylor expanded in y around 0 44.2%
neg-mul-144.2%
distribute-neg-frac44.2%
Simplified44.2%
if -6.3999999999999998e-18 < z < 6.59999999999999963e-242Initial program 96.1%
associate-/l*90.8%
Simplified90.8%
Taylor expanded in z around 0 73.6%
if 6.59999999999999963e-242 < z < 9.2e8Initial program 89.8%
associate-/l*93.2%
Simplified93.2%
clear-num93.1%
un-div-inv93.4%
Applied egg-rr93.4%
Taylor expanded in z around 0 58.5%
Final simplification65.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -8.5e+124)
x
(if (<= z -7.8e-17)
(* y (/ x (- z)))
(if (<= z 7.3e-242)
(/ (* x y) t)
(if (<= z 25500000.0) (/ x (/ t y)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.5e+124) {
tmp = x;
} else if (z <= -7.8e-17) {
tmp = y * (x / -z);
} else if (z <= 7.3e-242) {
tmp = (x * y) / t;
} else if (z <= 25500000.0) {
tmp = x / (t / y);
} 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 <= (-8.5d+124)) then
tmp = x
else if (z <= (-7.8d-17)) then
tmp = y * (x / -z)
else if (z <= 7.3d-242) then
tmp = (x * y) / t
else if (z <= 25500000.0d0) then
tmp = x / (t / y)
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 <= -8.5e+124) {
tmp = x;
} else if (z <= -7.8e-17) {
tmp = y * (x / -z);
} else if (z <= 7.3e-242) {
tmp = (x * y) / t;
} else if (z <= 25500000.0) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.5e+124: tmp = x elif z <= -7.8e-17: tmp = y * (x / -z) elif z <= 7.3e-242: tmp = (x * y) / t elif z <= 25500000.0: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.5e+124) tmp = x; elseif (z <= -7.8e-17) tmp = Float64(y * Float64(x / Float64(-z))); elseif (z <= 7.3e-242) tmp = Float64(Float64(x * y) / t); elseif (z <= 25500000.0) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.5e+124) tmp = x; elseif (z <= -7.8e-17) tmp = y * (x / -z); elseif (z <= 7.3e-242) tmp = (x * y) / t; elseif (z <= 25500000.0) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.5e+124], x, If[LessEqual[z, -7.8e-17], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.3e-242], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 25500000.0], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-17}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{elif}\;z \leq 7.3 \cdot 10^{-242}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{elif}\;z \leq 25500000:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.4999999999999997e124 or 2.55e7 < z Initial program 66.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 70.5%
if -8.4999999999999997e124 < z < -7.79999999999999979e-17Initial program 85.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 50.1%
*-commutative50.1%
associate-/l*50.3%
associate-*l*50.3%
associate-*l/50.3%
*-commutative50.3%
neg-mul-150.3%
neg-sub050.3%
associate--r-50.3%
neg-sub050.3%
+-commutative50.3%
sub-neg50.3%
div-sub50.3%
*-inverses50.3%
Simplified50.3%
Taylor expanded in y around inf 43.4%
associate-*r/43.4%
mul-1-neg43.4%
distribute-rgt-neg-out43.4%
associate-*r/43.4%
Simplified43.4%
clear-num43.3%
un-div-inv43.4%
add-sqr-sqrt23.1%
sqrt-unprod17.6%
sqr-neg17.6%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
associate-/r/6.7%
associate-*l/3.1%
associate-*r/3.1%
Simplified3.1%
associate-*r/3.1%
frac-2neg3.1%
*-commutative3.1%
distribute-rgt-neg-in3.1%
add-sqr-sqrt1.4%
sqrt-unprod20.5%
sqr-neg20.5%
sqrt-unprod15.6%
add-sqr-sqrt43.4%
Applied egg-rr43.4%
associate-/l*46.9%
Simplified46.9%
if -7.79999999999999979e-17 < z < 7.3000000000000001e-242Initial program 96.2%
associate-/l*90.9%
Simplified90.9%
Taylor expanded in z around 0 72.7%
if 7.3000000000000001e-242 < z < 2.55e7Initial program 89.8%
associate-/l*93.2%
Simplified93.2%
clear-num93.1%
un-div-inv93.4%
Applied egg-rr93.4%
Taylor expanded in z around 0 58.5%
Final simplification66.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ t y))))
(if (<= t -0.00014)
t_1
(if (<= t 4.05e-22)
(* x (- 1.0 (/ y z)))
(if (<= t 2e+183) (* x (/ z (- z t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x / (t / y);
double tmp;
if (t <= -0.00014) {
tmp = t_1;
} else if (t <= 4.05e-22) {
tmp = x * (1.0 - (y / z));
} else if (t <= 2e+183) {
tmp = x * (z / (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 / (t / y)
if (t <= (-0.00014d0)) then
tmp = t_1
else if (t <= 4.05d-22) then
tmp = x * (1.0d0 - (y / z))
else if (t <= 2d+183) then
tmp = x * (z / (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 / (t / y);
double tmp;
if (t <= -0.00014) {
tmp = t_1;
} else if (t <= 4.05e-22) {
tmp = x * (1.0 - (y / z));
} else if (t <= 2e+183) {
tmp = x * (z / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (t / y) tmp = 0 if t <= -0.00014: tmp = t_1 elif t <= 4.05e-22: tmp = x * (1.0 - (y / z)) elif t <= 2e+183: tmp = x * (z / (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(t / y)) tmp = 0.0 if (t <= -0.00014) tmp = t_1; elseif (t <= 4.05e-22) tmp = Float64(x * Float64(1.0 - Float64(y / z))); elseif (t <= 2e+183) tmp = Float64(x * Float64(z / Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (t / y); tmp = 0.0; if (t <= -0.00014) tmp = t_1; elseif (t <= 4.05e-22) tmp = x * (1.0 - (y / z)); elseif (t <= 2e+183) tmp = x * (z / (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -0.00014], t$95$1, If[LessEqual[t, 4.05e-22], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+183], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{t}{y}}\\
\mathbf{if}\;t \leq -0.00014:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.05 \cdot 10^{-22}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+183}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.3999999999999999e-4 or 1.99999999999999989e183 < t Initial program 80.1%
associate-/l*92.0%
Simplified92.0%
clear-num91.4%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in z around 0 65.5%
if -1.3999999999999999e-4 < t < 4.05000000000000007e-22Initial program 85.1%
associate-/l*97.6%
Simplified97.6%
Taylor expanded in t around 0 70.6%
*-commutative70.6%
associate-/l*80.8%
associate-*l*80.8%
associate-*l/80.8%
*-commutative80.8%
neg-mul-180.8%
neg-sub080.8%
associate--r-80.8%
neg-sub080.8%
+-commutative80.8%
sub-neg80.8%
div-sub80.8%
*-inverses80.8%
Simplified80.8%
if 4.05000000000000007e-22 < t < 1.99999999999999989e183Initial program 82.1%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in y around 0 46.4%
mul-1-neg46.4%
distribute-neg-frac246.4%
neg-sub046.4%
associate--r-46.4%
neg-sub046.4%
mul-1-neg46.4%
+-commutative46.4%
mul-1-neg46.4%
sub-neg46.4%
associate-/l*60.7%
Simplified60.7%
Final simplification71.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.7e-22) (not (<= t 8.6e+60))) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e-22) || !(t <= 8.6e+60)) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.7d-22)) .or. (.not. (t <= 8.6d+60))) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e-22) || !(t <= 8.6e+60)) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e-22) or not (t <= 8.6e+60): tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e-22) || !(t <= 8.6e+60)) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.7e-22) || ~((t <= 8.6e+60))) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e-22], N[Not[LessEqual[t, 8.6e+60]], $MachinePrecision]], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{-22} \lor \neg \left(t \leq 8.6 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if t < -1.6999999999999999e-22 or 8.59999999999999942e60 < t Initial program 81.7%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in t around inf 69.5%
associate-/l*75.3%
Simplified75.3%
if -1.6999999999999999e-22 < t < 8.59999999999999942e60Initial program 84.0%
associate-/l*97.8%
Simplified97.8%
Taylor expanded in t around 0 68.4%
*-commutative68.4%
associate-/l*79.4%
associate-*l*79.4%
associate-*l/79.4%
*-commutative79.4%
neg-mul-179.4%
neg-sub079.4%
associate--r-79.4%
neg-sub079.4%
+-commutative79.4%
sub-neg79.4%
div-sub79.4%
*-inverses79.4%
Simplified79.4%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (<= t -2.3e-5) (/ x (/ t y)) (if (<= t 6e+146) (* x (- 1.0 (/ y z))) (* x (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.3e-5) {
tmp = x / (t / y);
} else if (t <= 6e+146) {
tmp = x * (1.0 - (y / z));
} 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 (t <= (-2.3d-5)) then
tmp = x / (t / y)
else if (t <= 6d+146) then
tmp = x * (1.0d0 - (y / z))
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 (t <= -2.3e-5) {
tmp = x / (t / y);
} else if (t <= 6e+146) {
tmp = x * (1.0 - (y / z));
} else {
tmp = x * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.3e-5: tmp = x / (t / y) elif t <= 6e+146: tmp = x * (1.0 - (y / z)) else: tmp = x * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.3e-5) tmp = Float64(x / Float64(t / y)); elseif (t <= 6e+146) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(x * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.3e-5) tmp = x / (t / y); elseif (t <= 6e+146) tmp = x * (1.0 - (y / z)); else tmp = x * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.3e-5], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6e+146], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+146}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -2.3e-5Initial program 84.7%
associate-/l*93.9%
Simplified93.9%
clear-num93.1%
un-div-inv93.2%
Applied egg-rr93.2%
Taylor expanded in z around 0 66.2%
if -2.3e-5 < t < 6.00000000000000005e146Initial program 84.3%
associate-/l*97.4%
Simplified97.4%
Taylor expanded in t around 0 63.4%
*-commutative63.4%
associate-/l*74.7%
associate-*l*74.7%
associate-*l/74.7%
*-commutative74.7%
neg-mul-174.7%
neg-sub074.7%
associate--r-74.7%
neg-sub074.7%
+-commutative74.7%
sub-neg74.7%
div-sub74.7%
*-inverses74.7%
Simplified74.7%
if 6.00000000000000005e146 < t Initial program 75.7%
associate-/l*91.8%
Simplified91.8%
Taylor expanded in z around 0 50.1%
associate-/l*61.3%
Simplified61.3%
Final simplification70.3%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e+111) x (if (<= z 5.4e+14) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+111) {
tmp = x;
} else if (z <= 5.4e+14) {
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 <= (-2.8d+111)) then
tmp = x
else if (z <= 5.4d+14) 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 <= -2.8e+111) {
tmp = x;
} else if (z <= 5.4e+14) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+111: tmp = x elif z <= 5.4e+14: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+111) tmp = x; elseif (z <= 5.4e+14) 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 <= -2.8e+111) tmp = x; elseif (z <= 5.4e+14) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+111], x, If[LessEqual[z, 5.4e+14], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e111 or 5.4e14 < z Initial program 66.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 68.4%
if -2.7999999999999999e111 < z < 5.4e14Initial program 92.6%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in z around 0 57.9%
associate-/l*60.8%
Simplified60.8%
Final simplification63.6%
(FPCore (x y z t) :precision binary64 (if (<= z -2.8e+111) x (if (<= z 3.8e+14) (/ x (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+111) {
tmp = x;
} else if (z <= 3.8e+14) {
tmp = x / (t / y);
} 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 <= (-2.8d+111)) then
tmp = x
else if (z <= 3.8d+14) then
tmp = x / (t / y)
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 <= -2.8e+111) {
tmp = x;
} else if (z <= 3.8e+14) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+111: tmp = x elif z <= 3.8e+14: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+111) tmp = x; elseif (z <= 3.8e+14) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+111) tmp = x; elseif (z <= 3.8e+14) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+111], x, If[LessEqual[z, 3.8e+14], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e111 or 3.8e14 < z Initial program 66.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 68.4%
if -2.7999999999999999e111 < z < 3.8e14Initial program 92.6%
associate-/l*93.0%
Simplified93.0%
clear-num92.7%
un-div-inv92.8%
Applied egg-rr92.8%
Taylor expanded in z around 0 60.8%
Final simplification63.6%
(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 82.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in z around inf 34.0%
Final simplification34.0%
(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 2024039
(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)))