
(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 9 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 (* 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}
Initial program 96.3%
Final simplification96.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -2.1e+268)
t_1
(if (<= z -1.05e+137)
(* x (/ y z))
(if (<= z -9.6e+64)
(/ x (/ z t))
(if (<= z 7.6e+35) (* x (- (/ y z) t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -2.1e+268) {
tmp = t_1;
} else if (z <= -1.05e+137) {
tmp = x * (y / z);
} else if (z <= -9.6e+64) {
tmp = x / (z / t);
} else if (z <= 7.6e+35) {
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 * (t / z)
if (z <= (-2.1d+268)) then
tmp = t_1
else if (z <= (-1.05d+137)) then
tmp = x * (y / z)
else if (z <= (-9.6d+64)) then
tmp = x / (z / t)
else if (z <= 7.6d+35) 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 * (t / z);
double tmp;
if (z <= -2.1e+268) {
tmp = t_1;
} else if (z <= -1.05e+137) {
tmp = x * (y / z);
} else if (z <= -9.6e+64) {
tmp = x / (z / t);
} else if (z <= 7.6e+35) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -2.1e+268: tmp = t_1 elif z <= -1.05e+137: tmp = x * (y / z) elif z <= -9.6e+64: tmp = x / (z / t) elif z <= 7.6e+35: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -2.1e+268) tmp = t_1; elseif (z <= -1.05e+137) tmp = Float64(x * Float64(y / z)); elseif (z <= -9.6e+64) tmp = Float64(x / Float64(z / t)); elseif (z <= 7.6e+35) 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 * (t / z); tmp = 0.0; if (z <= -2.1e+268) tmp = t_1; elseif (z <= -1.05e+137) tmp = x * (y / z); elseif (z <= -9.6e+64) tmp = x / (z / t); elseif (z <= 7.6e+35) 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[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+268], t$95$1, If[LessEqual[z, -1.05e+137], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.6e+64], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+35], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+268}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+137}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1000000000000001e268 or 7.5999999999999999e35 < z Initial program 98.1%
Taylor expanded in y around 0 62.9%
associate-*r/62.9%
associate-*r*62.9%
neg-mul-162.9%
associate-*l/74.4%
*-commutative74.4%
neg-mul-174.4%
associate-*l/74.3%
metadata-eval74.3%
distribute-neg-frac74.3%
*-commutative74.3%
distribute-neg-frac74.3%
metadata-eval74.3%
metadata-eval74.3%
associate-/r*74.3%
neg-mul-174.3%
associate-*r/74.4%
*-rgt-identity74.4%
neg-sub074.4%
associate--r-74.4%
metadata-eval74.4%
Simplified74.4%
Taylor expanded in z around inf 74.4%
if -2.1000000000000001e268 < z < -1.05e137Initial program 97.3%
Taylor expanded in y around inf 69.4%
associate-*r/73.1%
Simplified73.1%
if -1.05e137 < z < -9.59999999999999997e64Initial program 99.8%
Taylor expanded in y around 0 60.8%
associate-*r/60.8%
associate-*r*60.8%
neg-mul-160.8%
associate-*l/69.2%
*-commutative69.2%
neg-mul-169.2%
associate-*l/69.1%
metadata-eval69.1%
distribute-neg-frac69.1%
*-commutative69.1%
distribute-neg-frac69.1%
metadata-eval69.1%
metadata-eval69.1%
associate-/r*69.1%
neg-mul-169.1%
associate-*r/69.2%
*-rgt-identity69.2%
neg-sub069.2%
associate--r-69.2%
metadata-eval69.2%
Simplified69.2%
Taylor expanded in z around inf 60.8%
associate-/l*64.8%
Simplified64.8%
Taylor expanded in t around 0 60.8%
associate-*r/64.8%
Simplified64.8%
*-commutative64.8%
associate-/r/69.3%
Applied egg-rr69.3%
if -9.59999999999999997e64 < z < 7.5999999999999999e35Initial program 94.9%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
associate-*r/89.9%
*-commutative89.9%
associate-*r*89.9%
neg-mul-189.9%
distribute-rgt-out91.9%
unsub-neg91.9%
Simplified91.9%
Final simplification84.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8500000000.0) (not (<= z 1.62e-12))) (* (/ x z) (+ y t)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8500000000.0) || !(z <= 1.62e-12)) {
tmp = (x / z) * (y + t);
} 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 <= (-8500000000.0d0)) .or. (.not. (z <= 1.62d-12))) then
tmp = (x / z) * (y + t)
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 <= -8500000000.0) || !(z <= 1.62e-12)) {
tmp = (x / z) * (y + t);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8500000000.0) or not (z <= 1.62e-12): tmp = (x / z) * (y + t) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8500000000.0) || !(z <= 1.62e-12)) tmp = Float64(Float64(x / z) * Float64(y + t)); 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 <= -8500000000.0) || ~((z <= 1.62e-12))) tmp = (x / z) * (y + t); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8500000000.0], N[Not[LessEqual[z, 1.62e-12]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y + t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8500000000 \lor \neg \left(z \leq 1.62 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -8.5e9 or 1.62e-12 < z Initial program 98.4%
Taylor expanded in y around 0 87.1%
associate-/l*88.8%
*-un-lft-identity88.8%
div-inv88.8%
times-frac87.1%
Applied egg-rr87.1%
Taylor expanded in z around inf 86.8%
*-commutative86.8%
distribute-rgt-in87.7%
*-lft-identity87.7%
associate-*l/87.6%
distribute-lft-in86.7%
distribute-lft-in86.8%
*-commutative86.8%
/-rgt-identity86.8%
associate-/r/86.7%
associate-*l/86.7%
*-lft-identity86.7%
associate-/r/86.8%
/-rgt-identity86.8%
associate-*r/84.4%
associate-*l/84.5%
*-lft-identity84.5%
associate-*l/83.6%
*-commutative83.6%
distribute-rgt-out84.4%
+-commutative84.4%
Simplified84.4%
if -8.5e9 < z < 1.62e-12Initial program 94.4%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
associate-*r/92.2%
*-commutative92.2%
associate-*r*92.2%
neg-mul-192.2%
distribute-rgt-out94.4%
unsub-neg94.4%
Simplified94.4%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -29500000.0) (not (<= z 1.62e-12))) (/ x (/ z (+ y t))) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -29500000.0) || !(z <= 1.62e-12)) {
tmp = x / (z / (y + t));
} 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 <= (-29500000.0d0)) .or. (.not. (z <= 1.62d-12))) then
tmp = x / (z / (y + t))
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 <= -29500000.0) || !(z <= 1.62e-12)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -29500000.0) or not (z <= 1.62e-12): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -29500000.0) || !(z <= 1.62e-12)) tmp = Float64(x / Float64(z / Float64(y + t))); 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 <= -29500000.0) || ~((z <= 1.62e-12))) tmp = x / (z / (y + t)); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -29500000.0], N[Not[LessEqual[z, 1.62e-12]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -29500000 \lor \neg \left(z \leq 1.62 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -2.95e7 or 1.62e-12 < z Initial program 98.4%
Taylor expanded in z around inf 87.8%
associate-/l*97.9%
cancel-sign-sub-inv97.9%
metadata-eval97.9%
*-lft-identity97.9%
+-commutative97.9%
Simplified97.9%
if -2.95e7 < z < 1.62e-12Initial program 94.4%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
associate-*r/92.2%
*-commutative92.2%
associate-*r*92.2%
neg-mul-192.2%
distribute-rgt-out94.4%
unsub-neg94.4%
Simplified94.4%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.3e-29) (not (<= z 180000000.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-29) || !(z <= 180000000.0)) {
tmp = t * (x / z);
} else {
tmp = 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 <= (-4.3d-29)) .or. (.not. (z <= 180000000.0d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-29) || !(z <= 180000000.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.3e-29) or not (z <= 180000000.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.3e-29) || !(z <= 180000000.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.3e-29) || ~((z <= 180000000.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.3e-29], N[Not[LessEqual[z, 180000000.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{-29} \lor \neg \left(z \leq 180000000\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.2999999999999998e-29 or 1.8e8 < z Initial program 98.5%
Taylor expanded in y around 0 52.7%
associate-*r/52.7%
associate-*r*52.7%
neg-mul-152.7%
associate-*l/60.9%
*-commutative60.9%
neg-mul-160.9%
associate-*l/60.8%
metadata-eval60.8%
distribute-neg-frac60.8%
*-commutative60.8%
distribute-neg-frac60.8%
metadata-eval60.8%
metadata-eval60.8%
associate-/r*60.8%
neg-mul-160.8%
associate-*r/60.9%
*-rgt-identity60.9%
neg-sub060.9%
associate--r-60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in z around inf 52.4%
associate-/l*50.7%
Simplified50.7%
Taylor expanded in t around 0 52.4%
associate-*r/52.3%
Simplified52.3%
if -4.2999999999999998e-29 < z < 1.8e8Initial program 94.2%
Taylor expanded in y around 0 28.5%
associate-*r/28.5%
associate-*r*28.5%
neg-mul-128.5%
associate-*l/28.5%
*-commutative28.5%
neg-mul-128.5%
associate-*l/28.5%
metadata-eval28.5%
distribute-neg-frac28.5%
*-commutative28.5%
distribute-neg-frac28.5%
metadata-eval28.5%
metadata-eval28.5%
associate-/r*28.5%
neg-mul-128.5%
associate-*r/28.5%
*-rgt-identity28.5%
neg-sub028.5%
associate--r-28.5%
metadata-eval28.5%
Simplified28.5%
Taylor expanded in z around 0 28.5%
neg-mul-128.5%
Simplified28.5%
Final simplification40.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.3e-29) (not (<= z 180000000.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-29) || !(z <= 180000000.0)) {
tmp = x * (t / z);
} else {
tmp = 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 <= (-4.3d-29)) .or. (.not. (z <= 180000000.0d0))) then
tmp = x * (t / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.3e-29) || !(z <= 180000000.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.3e-29) or not (z <= 180000000.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.3e-29) || !(z <= 180000000.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.3e-29) || ~((z <= 180000000.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.3e-29], N[Not[LessEqual[z, 180000000.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{-29} \lor \neg \left(z \leq 180000000\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.2999999999999998e-29 or 1.8e8 < z Initial program 98.5%
Taylor expanded in y around 0 52.7%
associate-*r/52.7%
associate-*r*52.7%
neg-mul-152.7%
associate-*l/60.9%
*-commutative60.9%
neg-mul-160.9%
associate-*l/60.8%
metadata-eval60.8%
distribute-neg-frac60.8%
*-commutative60.8%
distribute-neg-frac60.8%
metadata-eval60.8%
metadata-eval60.8%
associate-/r*60.8%
neg-mul-160.8%
associate-*r/60.9%
*-rgt-identity60.9%
neg-sub060.9%
associate--r-60.9%
metadata-eval60.9%
Simplified60.9%
Taylor expanded in z around inf 60.6%
if -4.2999999999999998e-29 < z < 1.8e8Initial program 94.2%
Taylor expanded in y around 0 28.5%
associate-*r/28.5%
associate-*r*28.5%
neg-mul-128.5%
associate-*l/28.5%
*-commutative28.5%
neg-mul-128.5%
associate-*l/28.5%
metadata-eval28.5%
distribute-neg-frac28.5%
*-commutative28.5%
distribute-neg-frac28.5%
metadata-eval28.5%
metadata-eval28.5%
associate-/r*28.5%
neg-mul-128.5%
associate-*r/28.5%
*-rgt-identity28.5%
neg-sub028.5%
associate--r-28.5%
metadata-eval28.5%
Simplified28.5%
Taylor expanded in z around 0 28.5%
neg-mul-128.5%
Simplified28.5%
Final simplification44.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.7e+84) (not (<= t 1.45e+32))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.7e+84) || !(t <= 1.45e+32)) {
tmp = x * (t / 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 ((t <= (-6.7d+84)) .or. (.not. (t <= 1.45d+32))) then
tmp = x * (t / 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 ((t <= -6.7e+84) || !(t <= 1.45e+32)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.7e+84) or not (t <= 1.45e+32): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.7e+84) || !(t <= 1.45e+32)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.7e+84) || ~((t <= 1.45e+32))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.7e+84], N[Not[LessEqual[t, 1.45e+32]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.7 \cdot 10^{+84} \lor \neg \left(t \leq 1.45 \cdot 10^{+32}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -6.70000000000000041e84 or 1.45000000000000001e32 < t Initial program 94.9%
Taylor expanded in y around 0 60.7%
associate-*r/60.7%
associate-*r*60.7%
neg-mul-160.7%
associate-*l/71.4%
*-commutative71.4%
neg-mul-171.4%
associate-*l/71.4%
metadata-eval71.4%
distribute-neg-frac71.4%
*-commutative71.4%
distribute-neg-frac71.4%
metadata-eval71.4%
metadata-eval71.4%
associate-/r*71.4%
neg-mul-171.4%
associate-*r/71.4%
*-rgt-identity71.4%
neg-sub071.4%
associate--r-71.4%
metadata-eval71.4%
Simplified71.4%
Taylor expanded in z around inf 55.9%
if -6.70000000000000041e84 < t < 1.45000000000000001e32Initial program 97.1%
Taylor expanded in y around inf 79.4%
associate-*r/84.1%
Simplified84.1%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (<= t -1.45e+86) (* x (/ t z)) (if (<= t 1.65e+32) (* x (/ y z)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e+86) {
tmp = x * (t / z);
} else if (t <= 1.65e+32) {
tmp = x * (y / z);
} else {
tmp = x / (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 (t <= (-1.45d+86)) then
tmp = x * (t / z)
else if (t <= 1.65d+32) then
tmp = x * (y / z)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.45e+86) {
tmp = x * (t / z);
} else if (t <= 1.65e+32) {
tmp = x * (y / z);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.45e+86: tmp = x * (t / z) elif t <= 1.65e+32: tmp = x * (y / z) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.45e+86) tmp = Float64(x * Float64(t / z)); elseif (t <= 1.65e+32) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.45e+86) tmp = x * (t / z); elseif (t <= 1.65e+32) tmp = x * (y / z); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.45e+86], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e+32], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+32}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -1.44999999999999995e86Initial program 97.6%
Taylor expanded in y around 0 56.4%
associate-*r/56.4%
associate-*r*56.4%
neg-mul-156.4%
associate-*l/69.7%
*-commutative69.7%
neg-mul-169.7%
associate-*l/69.6%
metadata-eval69.6%
distribute-neg-frac69.6%
*-commutative69.6%
distribute-neg-frac69.6%
metadata-eval69.6%
metadata-eval69.6%
associate-/r*69.6%
neg-mul-169.6%
associate-*r/69.7%
*-rgt-identity69.7%
neg-sub069.7%
associate--r-69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in z around inf 58.4%
if -1.44999999999999995e86 < t < 1.6500000000000001e32Initial program 97.1%
Taylor expanded in y around inf 79.4%
associate-*r/84.1%
Simplified84.1%
if 1.6500000000000001e32 < t Initial program 92.8%
Taylor expanded in y around 0 64.0%
associate-*r/64.0%
associate-*r*64.0%
neg-mul-164.0%
associate-*l/72.8%
*-commutative72.8%
neg-mul-172.8%
associate-*l/72.8%
metadata-eval72.8%
distribute-neg-frac72.8%
*-commutative72.8%
distribute-neg-frac72.8%
metadata-eval72.8%
metadata-eval72.8%
associate-/r*72.8%
neg-mul-172.8%
associate-*r/72.8%
*-rgt-identity72.8%
neg-sub072.8%
associate--r-72.8%
metadata-eval72.8%
Simplified72.8%
Taylor expanded in z around inf 43.5%
associate-/l*41.6%
Simplified41.6%
Taylor expanded in t around 0 43.5%
associate-*r/43.4%
Simplified43.4%
*-commutative43.4%
associate-/r/54.1%
Applied egg-rr54.1%
Final simplification73.7%
(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 96.3%
Taylor expanded in y around 0 40.3%
associate-*r/40.3%
associate-*r*40.3%
neg-mul-140.3%
associate-*l/44.3%
*-commutative44.3%
neg-mul-144.3%
associate-*l/44.3%
metadata-eval44.3%
distribute-neg-frac44.3%
*-commutative44.3%
distribute-neg-frac44.3%
metadata-eval44.3%
metadata-eval44.3%
associate-/r*44.3%
neg-mul-144.3%
associate-*r/44.3%
*-rgt-identity44.3%
neg-sub044.3%
associate--r-44.3%
metadata-eval44.3%
Simplified44.3%
Taylor expanded in z around 0 23.0%
neg-mul-123.0%
Simplified23.0%
Final simplification23.0%
(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 2024034
(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)))))