
(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 (- z)))))) (if (<= z -33000.0) t_1 (if (<= z 0.0014) (/ (* x (- y (* z t))) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t / -z));
double tmp;
if (z <= -33000.0) {
tmp = t_1;
} else if (z <= 0.0014) {
tmp = (x * (y - (z * t))) / 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) :: tmp
t_1 = x * ((y / z) - (t / -z))
if (z <= (-33000.0d0)) then
tmp = t_1
else if (z <= 0.0014d0) then
tmp = (x * (y - (z * t))) / 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 / -z));
double tmp;
if (z <= -33000.0) {
tmp = t_1;
} else if (z <= 0.0014) {
tmp = (x * (y - (z * t))) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t / -z)) tmp = 0 if z <= -33000.0: tmp = t_1 elif z <= 0.0014: tmp = (x * (y - (z * t))) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(-z)))) tmp = 0.0 if (z <= -33000.0) tmp = t_1; elseif (z <= 0.0014) tmp = Float64(Float64(x * Float64(y - Float64(z * t))) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t / -z)); tmp = 0.0; if (z <= -33000.0) tmp = t_1; elseif (z <= 0.0014) tmp = (x * (y - (z * t))) / 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 / (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -33000.0], t$95$1, If[LessEqual[z, 0.0014], N[(N[(x * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - \frac{t}{-z}\right)\\
\mathbf{if}\;z \leq -33000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.0014:\\
\;\;\;\;\frac{x \cdot \left(y - z \cdot t\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -33000 or 0.00139999999999999999 < z Initial program 97.6%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6497.2
Applied rewrites97.2%
if -33000 < z < 0.00139999999999999999Initial program 93.7%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6498.3
Applied rewrites98.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -6e-155)
(/ (* x (+ y t)) z)
(if (<= z 3.2e-28)
(/ (* x y) z)
(if (<= z 1.32e-8) (* x (- (fma z t t))) (* (+ y t) (/ x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6e-155) {
tmp = (x * (y + t)) / z;
} else if (z <= 3.2e-28) {
tmp = (x * y) / z;
} else if (z <= 1.32e-8) {
tmp = x * -fma(z, t, t);
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -6e-155) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (z <= 3.2e-28) tmp = Float64(Float64(x * y) / z); elseif (z <= 1.32e-8) tmp = Float64(x * Float64(-fma(z, t, t))); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -6e-155], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 3.2e-28], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.32e-8], N[(x * (-N[(z * t + t), $MachinePrecision])), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-155}:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(-\mathsf{fma}\left(z, t, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -5.99999999999999967e-155Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites80.6%
if -5.99999999999999967e-155 < z < 3.19999999999999982e-28Initial program 91.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6482.6
Applied rewrites82.6%
if 3.19999999999999982e-28 < z < 1.32000000000000007e-8Initial program 99.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites99.7%
if 1.32000000000000007e-8 < z Initial program 96.1%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6468.5
Applied rewrites68.5%
Taylor expanded in z around inf
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
+-commutativeN/A
remove-double-negN/A
+-commutativeN/A
lower-+.f6491.2
Applied rewrites91.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (+ y t)) z)))
(if (<= z -6e-155)
t_1
(if (<= z 3.2e-28)
(/ (* x y) z)
(if (<= z 1.32e-8) (* x (- (fma z t t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (y + t)) / z;
double tmp;
if (z <= -6e-155) {
tmp = t_1;
} else if (z <= 3.2e-28) {
tmp = (x * y) / z;
} else if (z <= 1.32e-8) {
tmp = x * -fma(z, t, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(y + t)) / z) tmp = 0.0 if (z <= -6e-155) tmp = t_1; elseif (z <= 3.2e-28) tmp = Float64(Float64(x * y) / z); elseif (z <= 1.32e-8) tmp = Float64(x * Float64(-fma(z, t, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -6e-155], t$95$1, If[LessEqual[z, 3.2e-28], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.32e-8], N[(x * (-N[(z * t + t), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{if}\;z \leq -6 \cdot 10^{-155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(-\mathsf{fma}\left(z, t, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.99999999999999967e-155 or 1.32000000000000007e-8 < z Initial program 97.4%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites84.4%
if -5.99999999999999967e-155 < z < 3.19999999999999982e-28Initial program 91.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6482.6
Applied rewrites82.6%
if 3.19999999999999982e-28 < z < 1.32000000000000007e-8Initial program 99.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in z around 0
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (if (<= z -33000.0) (/ (* x (+ y t)) z) (if (<= z 0.0014) (/ (* x (- y (* z t))) z) (* (+ y t) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -33000.0) {
tmp = (x * (y + t)) / z;
} else if (z <= 0.0014) {
tmp = (x * (y - (z * t))) / z;
} else {
tmp = (y + 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 (z <= (-33000.0d0)) then
tmp = (x * (y + t)) / z
else if (z <= 0.0014d0) then
tmp = (x * (y - (z * t))) / z
else
tmp = (y + t) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -33000.0) {
tmp = (x * (y + t)) / z;
} else if (z <= 0.0014) {
tmp = (x * (y - (z * t))) / z;
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -33000.0: tmp = (x * (y + t)) / z elif z <= 0.0014: tmp = (x * (y - (z * t))) / z else: tmp = (y + t) * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -33000.0) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (z <= 0.0014) tmp = Float64(Float64(x * Float64(y - Float64(z * t))) / z); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -33000.0) tmp = (x * (y + t)) / z; elseif (z <= 0.0014) tmp = (x * (y - (z * t))) / z; else tmp = (y + t) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -33000.0], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.0014], N[(N[(x * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -33000:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;z \leq 0.0014:\\
\;\;\;\;\frac{x \cdot \left(y - z \cdot t\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -33000Initial program 99.2%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.9%
if -33000 < z < 0.00139999999999999999Initial program 93.7%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6498.3
Applied rewrites98.3%
if 0.00139999999999999999 < z Initial program 96.1%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6468.0
Applied rewrites68.0%
Taylor expanded in z around inf
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
+-commutativeN/A
remove-double-negN/A
+-commutativeN/A
lower-+.f6491.1
Applied rewrites91.1%
(FPCore (x y z t) :precision binary64 (if (<= z -36000.0) (/ (* x (+ y t)) z) (if (<= z 0.00011) (* x (fma t -1.0 (/ y z))) (* (+ y t) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -36000.0) {
tmp = (x * (y + t)) / z;
} else if (z <= 0.00011) {
tmp = x * fma(t, -1.0, (y / z));
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -36000.0) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (z <= 0.00011) tmp = Float64(x * fma(t, -1.0, Float64(y / z))); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -36000.0], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.00011], N[(x * N[(t * -1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -36000:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;z \leq 0.00011:\\
\;\;\;\;x \cdot \mathsf{fma}\left(t, -1, \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -36000Initial program 99.2%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.9%
if -36000 < z < 1.10000000000000004e-4Initial program 93.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
div-invN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6493.6
Applied rewrites93.6%
Taylor expanded in z around 0
Applied rewrites93.1%
if 1.10000000000000004e-4 < z Initial program 96.1%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6468.5
Applied rewrites68.5%
Taylor expanded in z around inf
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
+-commutativeN/A
remove-double-negN/A
+-commutativeN/A
lower-+.f6491.2
Applied rewrites91.2%
(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 95.7%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -1.1e+52) t_1 (if (<= z 3.5e+71) (/ (* x y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.1e+52) {
tmp = t_1;
} else if (z <= 3.5e+71) {
tmp = (x * y) / 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) :: tmp
t_1 = x * (t / z)
if (z <= (-1.1d+52)) then
tmp = t_1
else if (z <= 3.5d+71) then
tmp = (x * y) / 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 * (t / z);
double tmp;
if (z <= -1.1e+52) {
tmp = t_1;
} else if (z <= 3.5e+71) {
tmp = (x * y) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -1.1e+52: tmp = t_1 elif z <= 3.5e+71: tmp = (x * y) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -1.1e+52) tmp = t_1; elseif (z <= 3.5e+71) tmp = Float64(Float64(x * y) / z); 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 <= -1.1e+52) tmp = t_1; elseif (z <= 3.5e+71) tmp = (x * y) / z; 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, -1.1e+52], t$95$1, If[LessEqual[z, 3.5e+71], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+71}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1e52 or 3.4999999999999999e71 < z Initial program 97.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6471.9
Applied rewrites71.9%
Taylor expanded in z around inf
Applied rewrites71.9%
if -1.1e52 < z < 3.4999999999999999e71Initial program 94.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6474.1
Applied rewrites74.1%
(FPCore (x y z t) :precision binary64 (if (<= t 4.7e+266) (/ (* x y) z) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.7e+266) {
tmp = (x * y) / 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 (t <= 4.7d+266) then
tmp = (x * y) / 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 (t <= 4.7e+266) {
tmp = (x * y) / z;
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 4.7e+266: tmp = (x * y) / z else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 4.7e+266) tmp = Float64(Float64(x * y) / z); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 4.7e+266) tmp = (x * y) / z; else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 4.7e+266], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.7 \cdot 10^{+266}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < 4.6999999999999998e266Initial program 95.5%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6465.6
Applied rewrites65.6%
if 4.6999999999999998e266 < t Initial program 100.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites82.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1.25e+267) (* y (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.25e+267) {
tmp = y * (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 (t <= 1.25d+267) then
tmp = y * (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 (t <= 1.25e+267) {
tmp = y * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.25e+267: tmp = y * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.25e+267) tmp = Float64(y * 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 (t <= 1.25e+267) tmp = y * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.25e+267], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.25 \cdot 10^{+267}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < 1.25e267Initial program 95.5%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6465.6
Applied rewrites65.6%
Applied rewrites64.4%
if 1.25e267 < t Initial program 100.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites82.0%
(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 95.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6450.1
Applied rewrites50.1%
Taylor expanded in z around 0
Applied rewrites23.3%
(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 2024233
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))