
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\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 (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (- (/ y z) (/ t (- 1.0 z)))))) (if (<= t_1 1e+306) t_1 (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_1 <= 1e+306) {
tmp = t_1;
} else {
tmp = y * (x / 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) :: t_1
real(8) :: tmp
t_1 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_1 <= 1d+306) then
tmp = t_1
else
tmp = y * (x / z)
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 / (1.0 - z)));
double tmp;
if (t_1 <= 1e+306) {
tmp = t_1;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_1 <= 1e+306: tmp = t_1 else: tmp = y * (x / z) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_1 <= 1e+306) tmp = t_1; else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_1 <= 1e+306) tmp = t_1; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+306], t$95$1, N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_1 \leq 10^{+306}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z)))) < 1.00000000000000002e306Initial program 96.3%
if 1.00000000000000002e306 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z)))) Initial program 80.0%
Taylor expanded in y around inf 89.4%
associate-/l*70.0%
associate-/r/91.9%
Simplified91.9%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= y -4.4e-69)
(* y (/ x z))
(if (<= y -1.8e-203)
t_1
(if (<= y -4.2e-296)
(* x (- t))
(if (<= y 2.5e-79) t_1 (* x (/ y z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (y <= -4.4e-69) {
tmp = y * (x / z);
} else if (y <= -1.8e-203) {
tmp = t_1;
} else if (y <= -4.2e-296) {
tmp = x * -t;
} else if (y <= 2.5e-79) {
tmp = t_1;
} else {
tmp = x * (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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (y <= (-4.4d-69)) then
tmp = y * (x / z)
else if (y <= (-1.8d-203)) then
tmp = t_1
else if (y <= (-4.2d-296)) then
tmp = x * -t
else if (y <= 2.5d-79) then
tmp = t_1
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (y <= -4.4e-69) {
tmp = y * (x / z);
} else if (y <= -1.8e-203) {
tmp = t_1;
} else if (y <= -4.2e-296) {
tmp = x * -t;
} else if (y <= 2.5e-79) {
tmp = t_1;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if y <= -4.4e-69: tmp = y * (x / z) elif y <= -1.8e-203: tmp = t_1 elif y <= -4.2e-296: tmp = x * -t elif y <= 2.5e-79: tmp = t_1 else: tmp = x * (y / z) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (y <= -4.4e-69) tmp = Float64(y * Float64(x / z)); elseif (y <= -1.8e-203) tmp = t_1; elseif (y <= -4.2e-296) tmp = Float64(x * Float64(-t)); elseif (y <= 2.5e-79) tmp = t_1; else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (y <= -4.4e-69) tmp = y * (x / z); elseif (y <= -1.8e-203) tmp = t_1; elseif (y <= -4.2e-296) tmp = x * -t; elseif (y <= 2.5e-79) tmp = t_1; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e-69], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.8e-203], t$95$1, If[LessEqual[y, -4.2e-296], N[(x * (-t)), $MachinePrecision], If[LessEqual[y, 2.5e-79], t$95$1, N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-296}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-79}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -4.4e-69Initial program 92.4%
Taylor expanded in y around inf 73.5%
associate-/l*73.6%
associate-/r/77.4%
Simplified77.4%
if -4.4e-69 < y < -1.7999999999999999e-203 or -4.1999999999999999e-296 < y < 2.5e-79Initial program 97.2%
Taylor expanded in z around inf 67.9%
associate-/l*72.9%
associate-/r/71.7%
cancel-sign-sub-inv71.7%
metadata-eval71.7%
*-lft-identity71.7%
+-commutative71.7%
Simplified71.7%
Taylor expanded in t around inf 57.9%
associate-/l*61.8%
Simplified61.8%
Taylor expanded in t around 0 57.9%
associate-*l/63.1%
Simplified63.1%
if -1.7999999999999999e-203 < y < -4.1999999999999999e-296Initial program 83.6%
Taylor expanded in z around 0 67.9%
+-commutative67.9%
associate-*r/68.0%
*-commutative68.0%
associate-*r*68.0%
neg-mul-168.0%
distribute-rgt-out68.0%
unsub-neg68.0%
Simplified68.0%
Taylor expanded in y around 0 61.4%
neg-mul-161.4%
distribute-rgt-neg-in61.4%
Simplified61.4%
if 2.5e-79 < y Initial program 94.5%
Taylor expanded in y around inf 76.0%
associate-*r/75.9%
Simplified75.9%
Final simplification71.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= y -6.5e-69)
(* y (/ x z))
(if (<= y -1e-203)
t_1
(if (<= y -1.7e-296)
(* x (- t))
(if (<= y 2e-80) t_1 (/ (* x y) z)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (y <= -6.5e-69) {
tmp = y * (x / z);
} else if (y <= -1e-203) {
tmp = t_1;
} else if (y <= -1.7e-296) {
tmp = x * -t;
} else if (y <= 2e-80) {
tmp = t_1;
} else {
tmp = (x * 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (y <= (-6.5d-69)) then
tmp = y * (x / z)
else if (y <= (-1d-203)) then
tmp = t_1
else if (y <= (-1.7d-296)) then
tmp = x * -t
else if (y <= 2d-80) then
tmp = t_1
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (y <= -6.5e-69) {
tmp = y * (x / z);
} else if (y <= -1e-203) {
tmp = t_1;
} else if (y <= -1.7e-296) {
tmp = x * -t;
} else if (y <= 2e-80) {
tmp = t_1;
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if y <= -6.5e-69: tmp = y * (x / z) elif y <= -1e-203: tmp = t_1 elif y <= -1.7e-296: tmp = x * -t elif y <= 2e-80: tmp = t_1 else: tmp = (x * y) / z return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (y <= -6.5e-69) tmp = Float64(y * Float64(x / z)); elseif (y <= -1e-203) tmp = t_1; elseif (y <= -1.7e-296) tmp = Float64(x * Float64(-t)); elseif (y <= 2e-80) tmp = t_1; else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (y <= -6.5e-69) tmp = y * (x / z); elseif (y <= -1e-203) tmp = t_1; elseif (y <= -1.7e-296) tmp = x * -t; elseif (y <= 2e-80) tmp = t_1; else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e-69], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1e-203], t$95$1, If[LessEqual[y, -1.7e-296], N[(x * (-t)), $MachinePrecision], If[LessEqual[y, 2e-80], t$95$1, N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{-296}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -6.49999999999999951e-69Initial program 92.4%
Taylor expanded in y around inf 73.5%
associate-/l*73.6%
associate-/r/77.4%
Simplified77.4%
if -6.49999999999999951e-69 < y < -1e-203 or -1.69999999999999998e-296 < y < 1.99999999999999992e-80Initial program 97.2%
Taylor expanded in z around inf 67.9%
associate-/l*72.9%
associate-/r/71.7%
cancel-sign-sub-inv71.7%
metadata-eval71.7%
*-lft-identity71.7%
+-commutative71.7%
Simplified71.7%
Taylor expanded in t around inf 57.9%
associate-/l*61.8%
Simplified61.8%
Taylor expanded in t around 0 57.9%
associate-*l/63.1%
Simplified63.1%
if -1e-203 < y < -1.69999999999999998e-296Initial program 83.6%
Taylor expanded in z around 0 67.9%
+-commutative67.9%
associate-*r/68.0%
*-commutative68.0%
associate-*r*68.0%
neg-mul-168.0%
distribute-rgt-out68.0%
unsub-neg68.0%
Simplified68.0%
Taylor expanded in y around 0 61.4%
neg-mul-161.4%
distribute-rgt-neg-in61.4%
Simplified61.4%
if 1.99999999999999992e-80 < y Initial program 94.5%
Taylor expanded in y around inf 76.0%
Final simplification71.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.25e+20)
(* x (/ y z))
(if (<= z 96000.0)
(* x (- (/ y z) t))
(if (<= z 7.8e+66)
(* t (/ x z))
(if (<= z 1.05e+214) (/ (* x y) z) (* x (/ t z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e+20) {
tmp = x * (y / z);
} else if (z <= 96000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 7.8e+66) {
tmp = t * (x / z);
} else if (z <= 1.05e+214) {
tmp = (x * y) / z;
} else {
tmp = x * (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.25d+20)) then
tmp = x * (y / z)
else if (z <= 96000.0d0) then
tmp = x * ((y / z) - t)
else if (z <= 7.8d+66) then
tmp = t * (x / z)
else if (z <= 1.05d+214) then
tmp = (x * y) / z
else
tmp = x * (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.25e+20) {
tmp = x * (y / z);
} else if (z <= 96000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 7.8e+66) {
tmp = t * (x / z);
} else if (z <= 1.05e+214) {
tmp = (x * y) / z;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e+20: tmp = x * (y / z) elif z <= 96000.0: tmp = x * ((y / z) - t) elif z <= 7.8e+66: tmp = t * (x / z) elif z <= 1.05e+214: tmp = (x * y) / z else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e+20) tmp = Float64(x * Float64(y / z)); elseif (z <= 96000.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 7.8e+66) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.05e+214) tmp = Float64(Float64(x * y) / z); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.25e+20) tmp = x * (y / z); elseif (z <= 96000.0) tmp = x * ((y / z) - t); elseif (z <= 7.8e+66) tmp = t * (x / z); elseif (z <= 1.05e+214) tmp = (x * y) / z; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e+20], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 96000.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+66], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+214], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+20}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 96000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+66}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+214}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1.25e20Initial program 98.3%
Taylor expanded in y around inf 52.5%
associate-*r/64.1%
Simplified64.1%
if -1.25e20 < z < 96000Initial program 91.3%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
associate-*r/81.6%
*-commutative81.6%
associate-*r*81.6%
neg-mul-181.6%
distribute-rgt-out89.1%
unsub-neg89.1%
Simplified89.1%
if 96000 < z < 7.8000000000000007e66Initial program 96.1%
Taylor expanded in z around inf 91.5%
associate-/l*91.0%
associate-/r/96.7%
cancel-sign-sub-inv96.7%
metadata-eval96.7%
*-lft-identity96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in t around inf 73.8%
associate-*r/73.9%
Simplified73.9%
if 7.8000000000000007e66 < z < 1.05e214Initial program 90.9%
Taylor expanded in y around inf 65.6%
if 1.05e214 < z Initial program 98.1%
Taylor expanded in z around inf 66.5%
associate-/l*95.0%
associate-/r/85.8%
cancel-sign-sub-inv85.8%
metadata-eval85.8%
*-lft-identity85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 51.8%
associate-/l*71.0%
Simplified71.0%
Taylor expanded in t around 0 51.8%
associate-*l/75.8%
Simplified75.8%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(if (<= y -7.8e-69)
(* y (/ x z))
(if (<= y 1.3e-78)
(* x (/ t (+ z -1.0)))
(if (<= y 4.8e-12)
(* x (- (/ y z) t))
(if (<= y 4.9e-12) (* t (/ x z)) (/ (* x y) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e-69) {
tmp = y * (x / z);
} else if (y <= 1.3e-78) {
tmp = x * (t / (z + -1.0));
} else if (y <= 4.8e-12) {
tmp = x * ((y / z) - t);
} else if (y <= 4.9e-12) {
tmp = t * (x / z);
} else {
tmp = (x * 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 (y <= (-7.8d-69)) then
tmp = y * (x / z)
else if (y <= 1.3d-78) then
tmp = x * (t / (z + (-1.0d0)))
else if (y <= 4.8d-12) then
tmp = x * ((y / z) - t)
else if (y <= 4.9d-12) then
tmp = t * (x / z)
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e-69) {
tmp = y * (x / z);
} else if (y <= 1.3e-78) {
tmp = x * (t / (z + -1.0));
} else if (y <= 4.8e-12) {
tmp = x * ((y / z) - t);
} else if (y <= 4.9e-12) {
tmp = t * (x / z);
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.8e-69: tmp = y * (x / z) elif y <= 1.3e-78: tmp = x * (t / (z + -1.0)) elif y <= 4.8e-12: tmp = x * ((y / z) - t) elif y <= 4.9e-12: tmp = t * (x / z) else: tmp = (x * y) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.8e-69) tmp = Float64(y * Float64(x / z)); elseif (y <= 1.3e-78) tmp = Float64(x * Float64(t / Float64(z + -1.0))); elseif (y <= 4.8e-12) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (y <= 4.9e-12) tmp = Float64(t * Float64(x / z)); else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.8e-69) tmp = y * (x / z); elseif (y <= 1.3e-78) tmp = x * (t / (z + -1.0)); elseif (y <= 4.8e-12) tmp = x * ((y / z) - t); elseif (y <= 4.9e-12) tmp = t * (x / z); else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.8e-69], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-78], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e-12], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-12], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-78}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-12}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -7.79999999999999961e-69Initial program 92.4%
Taylor expanded in y around inf 73.5%
associate-/l*73.6%
associate-/r/77.4%
Simplified77.4%
if -7.79999999999999961e-69 < y < 1.3000000000000001e-78Initial program 94.9%
Taylor expanded in y around 0 73.2%
associate-*r/73.2%
mul-1-neg73.2%
*-commutative73.2%
distribute-rgt-neg-in73.2%
associate-*r/76.8%
distribute-frac-neg76.8%
mul-1-neg76.8%
*-commutative76.8%
associate-*l/76.8%
associate-*r/76.7%
metadata-eval76.7%
associate-/r*76.7%
neg-mul-176.7%
associate-*r/76.8%
*-rgt-identity76.8%
neg-sub076.8%
associate--r-76.8%
metadata-eval76.8%
Simplified76.8%
if 1.3000000000000001e-78 < y < 4.79999999999999974e-12Initial program 100.0%
Taylor expanded in z around 0 77.1%
+-commutative77.1%
associate-*r/77.1%
*-commutative77.1%
associate-*r*77.1%
neg-mul-177.1%
distribute-rgt-out77.2%
unsub-neg77.2%
Simplified77.2%
if 4.79999999999999974e-12 < y < 4.89999999999999972e-12Initial program 100.0%
Taylor expanded in z around inf 100.0%
associate-/l*100.0%
associate-/r/100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 100.0%
associate-*r/100.0%
Simplified100.0%
if 4.89999999999999972e-12 < y Initial program 93.4%
Taylor expanded in y around inf 81.1%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 6.8e-7))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 6.8e-7)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / 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) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 6.8d-7))) then
tmp = x * ((y + t) / z)
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 6.8e-7)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 6.8e-7): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 6.8e-7)) tmp = Float64(x * Float64(Float64(y + t) / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 6.8e-7))) tmp = x * ((y + t) / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 6.8e-7]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 6.8 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 6.79999999999999948e-7 < z Initial program 96.4%
Taylor expanded in z around inf 95.8%
cancel-sign-sub-inv95.8%
metadata-eval95.8%
*-lft-identity95.8%
+-commutative95.8%
Simplified95.8%
if -1 < z < 6.79999999999999948e-7Initial program 91.1%
Taylor expanded in z around 0 88.4%
+-commutative88.4%
associate-*r/81.7%
*-commutative81.7%
associate-*r*81.7%
neg-mul-181.7%
distribute-rgt-out89.5%
unsub-neg89.5%
Simplified89.5%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5e-69) (not (<= y 4.9e-12))) (* x (/ y z)) (* t (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-69) || !(y <= 4.9e-12)) {
tmp = x * (y / z);
} else {
tmp = t * (x / 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 ((y <= (-3.5d-69)) .or. (.not. (y <= 4.9d-12))) then
tmp = x * (y / z)
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-69) || !(y <= 4.9e-12)) {
tmp = x * (y / z);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5e-69) or not (y <= 4.9e-12): tmp = x * (y / z) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5e-69) || !(y <= 4.9e-12)) tmp = Float64(x * Float64(y / z)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.5e-69) || ~((y <= 4.9e-12))) tmp = x * (y / z); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e-69], N[Not[LessEqual[y, 4.9e-12]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-69} \lor \neg \left(y \leq 4.9 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.5000000000000001e-69 or 4.89999999999999972e-12 < y Initial program 92.9%
Taylor expanded in y around inf 77.1%
associate-*r/77.3%
Simplified77.3%
if -3.5000000000000001e-69 < y < 4.89999999999999972e-12Initial program 95.6%
Taylor expanded in z around inf 62.7%
associate-/l*64.5%
associate-/r/65.5%
cancel-sign-sub-inv65.5%
metadata-eval65.5%
*-lft-identity65.5%
+-commutative65.5%
Simplified65.5%
Taylor expanded in t around inf 49.2%
associate-*r/53.8%
Simplified53.8%
Final simplification68.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5e-69) (not (<= y 4.6e-81))) (* x (/ y z)) (* x (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-69) || !(y <= 4.6e-81)) {
tmp = x * (y / z);
} else {
tmp = x * (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 ((y <= (-5d-69)) .or. (.not. (y <= 4.6d-81))) then
tmp = x * (y / z)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-69) || !(y <= 4.6e-81)) {
tmp = x * (y / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5e-69) or not (y <= 4.6e-81): tmp = x * (y / z) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5e-69) || !(y <= 4.6e-81)) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5e-69) || ~((y <= 4.6e-81))) tmp = x * (y / z); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5e-69], N[Not[LessEqual[y, 4.6e-81]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-69} \lor \neg \left(y \leq 4.6 \cdot 10^{-81}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -5.00000000000000033e-69 or 4.59999999999999982e-81 < y Initial program 93.5%
Taylor expanded in y around inf 74.8%
associate-*r/75.0%
Simplified75.0%
if -5.00000000000000033e-69 < y < 4.59999999999999982e-81Initial program 94.9%
Taylor expanded in z around inf 62.4%
associate-/l*63.5%
associate-/r/64.6%
cancel-sign-sub-inv64.6%
metadata-eval64.6%
*-lft-identity64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in t around inf 52.1%
associate-/l*54.3%
Simplified54.3%
Taylor expanded in t around 0 52.1%
associate-*l/55.6%
Simplified55.6%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (* t (/ x z)))
double code(double x, double y, double z, double t) {
return t * (x / 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 = t * (x / z)
end function
public static double code(double x, double y, double z, double t) {
return t * (x / z);
}
def code(x, y, z, t): return t * (x / z)
function code(x, y, z, t) return Float64(t * Float64(x / z)) end
function tmp = code(x, y, z, t) tmp = t * (x / z); end
code[x_, y_, z_, t_] := N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{x}{z}
\end{array}
Initial program 93.9%
Taylor expanded in z around inf 71.0%
associate-/l*75.7%
associate-/r/73.9%
cancel-sign-sub-inv73.9%
metadata-eval73.9%
*-lft-identity73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in t around inf 34.3%
associate-*r/38.4%
Simplified38.4%
Final simplification38.4%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -t;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 57.0%
+-commutative57.0%
associate-*r/56.9%
*-commutative56.9%
associate-*r*56.9%
neg-mul-156.9%
distribute-rgt-out60.8%
unsub-neg60.8%
Simplified60.8%
Taylor expanded in y around 0 19.7%
neg-mul-119.7%
distribute-rgt-neg-in19.7%
Simplified19.7%
Final simplification19.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - 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) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - 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 / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))