
(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 (+ z -1.0)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) + (t / (z + (-1.0d0))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
def code(x, y, z, t): return x * ((y / z) + (t / (z + -1.0)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t / (z + -1.0))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)
\end{array}
Initial program 96.9%
Final simplification96.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))) (t_2 (* t (/ x z))))
(if (<= y -3.15e-128)
t_1
(if (<= y 8.5e-229)
t_2
(if (<= y 7.5e-127) (* x (- t)) (if (<= y 3.7e-121) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double t_2 = t * (x / z);
double tmp;
if (y <= -3.15e-128) {
tmp = t_1;
} else if (y <= 8.5e-229) {
tmp = t_2;
} else if (y <= 7.5e-127) {
tmp = x * -t;
} else if (y <= 3.7e-121) {
tmp = t_2;
} 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_2 = t * (x / z)
if (y <= (-3.15d-128)) then
tmp = t_1
else if (y <= 8.5d-229) then
tmp = t_2
else if (y <= 7.5d-127) then
tmp = x * -t
else if (y <= 3.7d-121) then
tmp = t_2
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);
double t_2 = t * (x / z);
double tmp;
if (y <= -3.15e-128) {
tmp = t_1;
} else if (y <= 8.5e-229) {
tmp = t_2;
} else if (y <= 7.5e-127) {
tmp = x * -t;
} else if (y <= 3.7e-121) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) t_2 = t * (x / z) tmp = 0 if y <= -3.15e-128: tmp = t_1 elif y <= 8.5e-229: tmp = t_2 elif y <= 7.5e-127: tmp = x * -t elif y <= 3.7e-121: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) t_2 = Float64(t * Float64(x / z)) tmp = 0.0 if (y <= -3.15e-128) tmp = t_1; elseif (y <= 8.5e-229) tmp = t_2; elseif (y <= 7.5e-127) tmp = Float64(x * Float64(-t)); elseif (y <= 3.7e-121) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / z); t_2 = t * (x / z); tmp = 0.0; if (y <= -3.15e-128) tmp = t_1; elseif (y <= 8.5e-229) tmp = t_2; elseif (y <= 7.5e-127) tmp = x * -t; elseif (y <= 3.7e-121) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.15e-128], t$95$1, If[LessEqual[y, 8.5e-229], t$95$2, If[LessEqual[y, 7.5e-127], N[(x * (-t)), $MachinePrecision], If[LessEqual[y, 3.7e-121], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
t_2 := t \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -3.15 \cdot 10^{-128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-229}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-127}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-121}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.1500000000000002e-128 or 3.7000000000000002e-121 < y Initial program 97.7%
Taylor expanded in y around inf 77.9%
associate-*r/80.6%
Simplified80.6%
if -3.1500000000000002e-128 < y < 8.49999999999999977e-229 or 7.5000000000000004e-127 < y < 3.7000000000000002e-121Initial program 94.3%
Taylor expanded in y around 0 87.5%
mul-1-neg87.5%
distribute-neg-frac287.5%
neg-sub087.5%
associate--r-87.5%
metadata-eval87.5%
Simplified87.5%
Taylor expanded in z around inf 62.5%
associate-/l*68.0%
Simplified68.0%
if 8.49999999999999977e-229 < y < 7.5000000000000004e-127Initial program 99.9%
Taylor expanded in y around 0 65.3%
mul-1-neg65.3%
distribute-neg-frac265.3%
neg-sub065.3%
associate--r-65.3%
metadata-eval65.3%
Simplified65.3%
Taylor expanded in z around 0 56.7%
*-commutative56.7%
neg-mul-156.7%
distribute-lft-neg-in56.7%
Simplified56.7%
Final simplification76.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x z))))
(if (<= y -3.5e-129)
(* x (/ y z))
(if (<= y 1.45e-230)
t_1
(if (<= y 2.6e-130)
(* x (- t))
(if (<= y 8.4e-120) t_1 (* y (/ x z))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double tmp;
if (y <= -3.5e-129) {
tmp = x * (y / z);
} else if (y <= 1.45e-230) {
tmp = t_1;
} else if (y <= 2.6e-130) {
tmp = x * -t;
} else if (y <= 8.4e-120) {
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 = t * (x / z)
if (y <= (-3.5d-129)) then
tmp = x * (y / z)
else if (y <= 1.45d-230) then
tmp = t_1
else if (y <= 2.6d-130) then
tmp = x * -t
else if (y <= 8.4d-120) 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 = t * (x / z);
double tmp;
if (y <= -3.5e-129) {
tmp = x * (y / z);
} else if (y <= 1.45e-230) {
tmp = t_1;
} else if (y <= 2.6e-130) {
tmp = x * -t;
} else if (y <= 8.4e-120) {
tmp = t_1;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / z) tmp = 0 if y <= -3.5e-129: tmp = x * (y / z) elif y <= 1.45e-230: tmp = t_1 elif y <= 2.6e-130: tmp = x * -t elif y <= 8.4e-120: tmp = t_1 else: tmp = y * (x / z) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / z)) tmp = 0.0 if (y <= -3.5e-129) tmp = Float64(x * Float64(y / z)); elseif (y <= 1.45e-230) tmp = t_1; elseif (y <= 2.6e-130) tmp = Float64(x * Float64(-t)); elseif (y <= 8.4e-120) tmp = t_1; else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / z); tmp = 0.0; if (y <= -3.5e-129) tmp = x * (y / z); elseif (y <= 1.45e-230) tmp = t_1; elseif (y <= 2.6e-130) tmp = x * -t; elseif (y <= 8.4e-120) tmp = t_1; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.5e-129], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e-230], t$95$1, If[LessEqual[y, 2.6e-130], N[(x * (-t)), $MachinePrecision], If[LessEqual[y, 8.4e-120], t$95$1, N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{-129}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-230}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-120}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.4999999999999997e-129Initial program 98.9%
Taylor expanded in y around inf 81.0%
associate-*r/86.1%
Simplified86.1%
if -3.4999999999999997e-129 < y < 1.45000000000000003e-230 or 2.6000000000000001e-130 < y < 8.4000000000000002e-120Initial program 94.3%
Taylor expanded in y around 0 87.5%
mul-1-neg87.5%
distribute-neg-frac287.5%
neg-sub087.5%
associate--r-87.5%
metadata-eval87.5%
Simplified87.5%
Taylor expanded in z around inf 62.5%
associate-/l*68.0%
Simplified68.0%
if 1.45000000000000003e-230 < y < 2.6000000000000001e-130Initial program 99.9%
Taylor expanded in y around 0 65.3%
mul-1-neg65.3%
distribute-neg-frac265.3%
neg-sub065.3%
associate--r-65.3%
metadata-eval65.3%
Simplified65.3%
Taylor expanded in z around 0 56.7%
*-commutative56.7%
neg-mul-156.7%
distribute-lft-neg-in56.7%
Simplified56.7%
if 8.4000000000000002e-120 < y Initial program 96.4%
Taylor expanded in y around inf 74.3%
clear-num73.5%
associate-/r/74.2%
associate-*r*75.3%
associate-*l/75.4%
*-un-lft-identity75.4%
Applied egg-rr75.4%
Final simplification76.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* 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 <= 1.0)) {
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 <= 1.0d0))) 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 <= 1.0)) {
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 <= 1.0): 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 <= 1.0)) 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 <= 1.0))) 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, 1.0]], $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 1\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 1 < z Initial program 96.9%
Taylor expanded in z around inf 87.9%
sub-neg87.9%
remove-double-neg87.9%
neg-mul-187.9%
distribute-neg-in87.9%
neg-mul-187.9%
sub-neg87.9%
distribute-rgt-neg-in87.9%
distribute-neg-frac87.9%
associate-/l*96.1%
distribute-rgt-neg-in96.1%
distribute-neg-frac96.1%
sub-neg96.1%
neg-mul-196.1%
distribute-neg-in96.1%
remove-double-neg96.1%
remove-double-neg96.1%
+-commutative96.1%
Simplified96.1%
if -1 < z < 1Initial program 96.9%
Taylor expanded in z around 0 96.2%
mul-1-neg96.2%
unsub-neg96.2%
div-sub96.2%
associate-/l*96.2%
*-inverses96.2%
*-rgt-identity96.2%
Simplified96.2%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (<= y -7.2e-111) (* x (/ y z)) (if (<= y 6.9e-74) (* t (/ x (+ z -1.0))) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-111) {
tmp = x * (y / z);
} else if (y <= 6.9e-74) {
tmp = t * (x / (z + -1.0));
} 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) :: tmp
if (y <= (-7.2d-111)) then
tmp = x * (y / z)
else if (y <= 6.9d-74) then
tmp = t * (x / (z + (-1.0d0)))
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-111) {
tmp = x * (y / z);
} else if (y <= 6.9e-74) {
tmp = t * (x / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.2e-111: tmp = x * (y / z) elif y <= 6.9e-74: tmp = t * (x / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.2e-111) tmp = Float64(x * Float64(y / z)); elseif (y <= 6.9e-74) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.2e-111) tmp = x * (y / z); elseif (y <= 6.9e-74) tmp = t * (x / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.2e-111], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.9e-74], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-111}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 6.9 \cdot 10^{-74}:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -7.20000000000000019e-111Initial program 98.9%
Taylor expanded in y around inf 81.0%
associate-*r/86.1%
Simplified86.1%
if -7.20000000000000019e-111 < y < 6.89999999999999981e-74Initial program 95.9%
Taylor expanded in y around 0 78.6%
mul-1-neg78.6%
associate-/l*81.7%
distribute-rgt-neg-in81.7%
distribute-neg-frac281.7%
neg-sub081.7%
associate--r-81.7%
metadata-eval81.7%
Simplified81.7%
if 6.89999999999999981e-74 < y Initial program 95.6%
Taylor expanded in y around inf 78.3%
clear-num78.1%
associate-/r/78.1%
associate-*r*79.6%
associate-*l/79.7%
*-un-lft-identity79.7%
Applied egg-rr79.7%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.12e-100) (* x (/ y z)) (if (<= y 1.65e-69) (* x (/ t (+ z -1.0))) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.12e-100) {
tmp = x * (y / z);
} else if (y <= 1.65e-69) {
tmp = x * (t / (z + -1.0));
} 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) :: tmp
if (y <= (-1.12d-100)) then
tmp = x * (y / z)
else if (y <= 1.65d-69) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.12e-100) {
tmp = x * (y / z);
} else if (y <= 1.65e-69) {
tmp = x * (t / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.12e-100: tmp = x * (y / z) elif y <= 1.65e-69: tmp = x * (t / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.12e-100) tmp = Float64(x * Float64(y / z)); elseif (y <= 1.65e-69) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.12e-100) tmp = x * (y / z); elseif (y <= 1.65e-69) tmp = x * (t / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.12e-100], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e-69], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{-100}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-69}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.11999999999999996e-100Initial program 98.8%
Taylor expanded in y around inf 82.3%
associate-*r/87.6%
Simplified87.6%
if -1.11999999999999996e-100 < y < 1.65e-69Initial program 96.0%
Taylor expanded in y around 0 81.3%
mul-1-neg81.3%
distribute-neg-frac281.3%
neg-sub081.3%
associate--r-81.3%
metadata-eval81.3%
Simplified81.3%
if 1.65e-69 < y Initial program 95.6%
Taylor expanded in y around inf 78.3%
clear-num78.1%
associate-/r/78.1%
associate-*r*79.6%
associate-*l/79.7%
*-un-lft-identity79.7%
Applied egg-rr79.7%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.3e-18) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.3e-18) || !(z <= 1.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 <= (-2.3d-18)) .or. (.not. (z <= 1.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 <= -2.3e-18) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.3e-18) or not (z <= 1.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.3e-18) || !(z <= 1.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 <= -2.3e-18) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.3e-18], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-18} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -2.3000000000000001e-18 or 1 < z Initial program 96.9%
Taylor expanded in y around 0 56.7%
mul-1-neg56.7%
distribute-neg-frac256.7%
neg-sub056.7%
associate--r-56.7%
metadata-eval56.7%
Simplified56.7%
Taylor expanded in z around inf 52.6%
associate-/l*52.1%
Simplified52.1%
if -2.3000000000000001e-18 < z < 1Initial program 96.9%
Taylor expanded in y around 0 35.5%
mul-1-neg35.5%
distribute-neg-frac235.5%
neg-sub035.5%
associate--r-35.5%
metadata-eval35.5%
Simplified35.5%
Taylor expanded in z around 0 34.8%
*-commutative34.8%
neg-mul-134.8%
distribute-lft-neg-in34.8%
Simplified34.8%
Final simplification44.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.3e-18) (not (<= z 1.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.3e-18) || !(z <= 1.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 <= (-2.3d-18)) .or. (.not. (z <= 1.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 <= -2.3e-18) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.3e-18) or not (z <= 1.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.3e-18) || !(z <= 1.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 <= -2.3e-18) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.3e-18], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-18} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -2.3000000000000001e-18 or 1 < z Initial program 96.9%
Taylor expanded in y around 0 56.7%
mul-1-neg56.7%
distribute-neg-frac256.7%
neg-sub056.7%
associate--r-56.7%
metadata-eval56.7%
Simplified56.7%
Taylor expanded in z around inf 52.6%
*-commutative52.6%
*-lft-identity52.6%
times-frac55.9%
/-rgt-identity55.9%
Simplified55.9%
if -2.3000000000000001e-18 < z < 1Initial program 96.9%
Taylor expanded in y around 0 35.5%
mul-1-neg35.5%
distribute-neg-frac235.5%
neg-sub035.5%
associate--r-35.5%
metadata-eval35.5%
Simplified35.5%
Taylor expanded in z around 0 34.8%
*-commutative34.8%
neg-mul-134.8%
distribute-lft-neg-in34.8%
Simplified34.8%
Final simplification46.1%
(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.9%
Taylor expanded in y around 0 46.8%
mul-1-neg46.8%
distribute-neg-frac246.8%
neg-sub046.8%
associate--r-46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in z around 0 23.8%
*-commutative23.8%
neg-mul-123.8%
distribute-lft-neg-in23.8%
Simplified23.8%
Final simplification23.8%
(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 2024076
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(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)))))