
(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 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 (- INFINITY)) (* (/ x z) y) (* x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / z) * y;
} else {
tmp = x * t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x / z) * y;
} else {
tmp = x * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: tmp = (x / z) * y else: tmp = x * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / z) * y); else tmp = Float64(x * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= -Inf) tmp = (x / z) * y; else tmp = x * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 75.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -3100.0)
(* (/ (+ t y) z) x)
(if (<= z 0.00182)
(* (- (/ y z) (fma (fma t z t) z t)) x)
(/ x (/ z (+ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3100.0) {
tmp = ((t + y) / z) * x;
} else if (z <= 0.00182) {
tmp = ((y / z) - fma(fma(t, z, t), z, t)) * x;
} else {
tmp = x / (z / (t + y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -3100.0) tmp = Float64(Float64(Float64(t + y) / z) * x); elseif (z <= 0.00182) tmp = Float64(Float64(Float64(y / z) - fma(fma(t, z, t), z, t)) * x); else tmp = Float64(x / Float64(z / Float64(t + y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -3100.0], N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 0.00182], N[(N[(N[(y / z), $MachinePrecision] - N[(N[(t * z + t), $MachinePrecision] * z + t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(x / N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3100:\\
\;\;\;\;\frac{t + y}{z} \cdot x\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\left(\frac{y}{z} - \mathsf{fma}\left(\mathsf{fma}\left(t, z, t\right), z, t\right)\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t + y}}\\
\end{array}
\end{array}
if z < -3100Initial program 95.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
if -3100 < z < 0.00182Initial program 93.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6493.5
Applied rewrites93.5%
if 0.00182 < z Initial program 96.5%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in z around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
lower-/.f64N/A
lower-+.f6495.2
Applied rewrites95.2%
Final simplification94.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (+ t y) z) x)))
(if (<= z -1.25e-22)
t_1
(if (<= z -5.2e-84)
(* (fma (fma x z x) z x) (- t))
(if (<= z 0.00182) (/ y (/ z x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -1.25e-22) {
tmp = t_1;
} else if (z <= -5.2e-84) {
tmp = fma(fma(x, z, x), z, x) * -t;
} else if (z <= 0.00182) {
tmp = y / (z / x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -1.25e-22) tmp = t_1; elseif (z <= -5.2e-84) tmp = Float64(fma(fma(x, z, x), z, x) * Float64(-t)); elseif (z <= 0.00182) tmp = Float64(y / Float64(z / x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.25e-22], t$95$1, If[LessEqual[z, -5.2e-84], N[(N[(N[(x * z + x), $MachinePrecision] * z + x), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 0.00182], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-84}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, z, x\right), z, x\right) \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.24999999999999988e-22 or 0.00182 < z Initial program 96.0%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.0
Applied rewrites95.0%
if -1.24999999999999988e-22 < z < -5.2e-84Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in z around 0
Applied rewrites84.1%
if -5.2e-84 < z < 0.00182Initial program 92.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.1
Applied rewrites81.1%
Applied rewrites81.2%
Applied rewrites81.9%
Final simplification88.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (+ t y) z) x)))
(if (<= z -1.25e-22)
t_1
(if (<= z -5.2e-84)
(* (fma (fma x z x) z x) (- t))
(if (<= z 0.00182) (* (/ x z) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -1.25e-22) {
tmp = t_1;
} else if (z <= -5.2e-84) {
tmp = fma(fma(x, z, x), z, x) * -t;
} else if (z <= 0.00182) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -1.25e-22) tmp = t_1; elseif (z <= -5.2e-84) tmp = Float64(fma(fma(x, z, x), z, x) * Float64(-t)); elseif (z <= 0.00182) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.25e-22], t$95$1, If[LessEqual[z, -5.2e-84], N[(N[(N[(x * z + x), $MachinePrecision] * z + x), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 0.00182], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-84}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, z, x\right), z, x\right) \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.24999999999999988e-22 or 0.00182 < z Initial program 96.0%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.0
Applied rewrites95.0%
if -1.24999999999999988e-22 < z < -5.2e-84Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in z around 0
Applied rewrites84.1%
if -5.2e-84 < z < 0.00182Initial program 92.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.1
Applied rewrites81.1%
Applied rewrites81.2%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (<= z -3100.0) (* (/ (+ t y) z) x) (if (<= z 0.00182) (* (/ (- y (* t z)) z) x) (/ x (/ z (+ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3100.0) {
tmp = ((t + y) / z) * x;
} else if (z <= 0.00182) {
tmp = ((y - (t * z)) / z) * x;
} else {
tmp = x / (z / (t + y));
}
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 <= (-3100.0d0)) then
tmp = ((t + y) / z) * x
else if (z <= 0.00182d0) then
tmp = ((y - (t * z)) / z) * x
else
tmp = x / (z / (t + y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3100.0) {
tmp = ((t + y) / z) * x;
} else if (z <= 0.00182) {
tmp = ((y - (t * z)) / z) * x;
} else {
tmp = x / (z / (t + y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3100.0: tmp = ((t + y) / z) * x elif z <= 0.00182: tmp = ((y - (t * z)) / z) * x else: tmp = x / (z / (t + y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3100.0) tmp = Float64(Float64(Float64(t + y) / z) * x); elseif (z <= 0.00182) tmp = Float64(Float64(Float64(y - Float64(t * z)) / z) * x); else tmp = Float64(x / Float64(z / Float64(t + y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3100.0) tmp = ((t + y) / z) * x; elseif (z <= 0.00182) tmp = ((y - (t * z)) / z) * x; else tmp = x / (z / (t + y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3100.0], N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 0.00182], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], N[(x / N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3100:\\
\;\;\;\;\frac{t + y}{z} \cdot x\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\frac{y - t \cdot z}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t + y}}\\
\end{array}
\end{array}
if z < -3100Initial program 95.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
if -3100 < z < 0.00182Initial program 93.4%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
if 0.00182 < z Initial program 96.5%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in z around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
lower-/.f64N/A
lower-+.f6495.2
Applied rewrites95.2%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -3100.0) t_1 (if (<= z 0.00182) (* (/ (- y (* t z)) z) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -3100.0) {
tmp = t_1;
} else if (z <= 0.00182) {
tmp = ((y - (t * z)) / z) * x;
} 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 = ((t + y) / z) * x
if (z <= (-3100.0d0)) then
tmp = t_1
else if (z <= 0.00182d0) then
tmp = ((y - (t * z)) / z) * x
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 = ((t + y) / z) * x;
double tmp;
if (z <= -3100.0) {
tmp = t_1;
} else if (z <= 0.00182) {
tmp = ((y - (t * z)) / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -3100.0: tmp = t_1 elif z <= 0.00182: tmp = ((y - (t * z)) / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -3100.0) tmp = t_1; elseif (z <= 0.00182) tmp = Float64(Float64(Float64(y - Float64(t * z)) / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) / z) * x; tmp = 0.0; if (z <= -3100.0) tmp = t_1; elseif (z <= 0.00182) tmp = ((y - (t * z)) / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -3100.0], t$95$1, If[LessEqual[z, 0.00182], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -3100:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\frac{y - t \cdot z}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3100 or 0.00182 < z Initial program 95.8%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.7
Applied rewrites94.7%
if -3100 < z < 0.00182Initial program 93.4%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) y))) (if (<= y -8.6e-98) t_1 (if (<= y 1.25e-108) (/ (* x t) (- z 1.0)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double tmp;
if (y <= -8.6e-98) {
tmp = t_1;
} else if (y <= 1.25e-108) {
tmp = (x * t) / (z - 1.0);
} 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 / z) * y
if (y <= (-8.6d-98)) then
tmp = t_1
else if (y <= 1.25d-108) then
tmp = (x * t) / (z - 1.0d0)
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 / z) * y;
double tmp;
if (y <= -8.6e-98) {
tmp = t_1;
} else if (y <= 1.25e-108) {
tmp = (x * t) / (z - 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * y tmp = 0 if y <= -8.6e-98: tmp = t_1 elif y <= 1.25e-108: tmp = (x * t) / (z - 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) tmp = 0.0 if (y <= -8.6e-98) tmp = t_1; elseif (y <= 1.25e-108) tmp = Float64(Float64(x * t) / Float64(z - 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * y; tmp = 0.0; if (y <= -8.6e-98) tmp = t_1; elseif (y <= 1.25e-108) tmp = (x * t) / (z - 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -8.6e-98], t$95$1, If[LessEqual[y, 1.25e-108], N[(N[(x * t), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-108}:\\
\;\;\;\;\frac{x \cdot t}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.59999999999999977e-98 or 1.25e-108 < y Initial program 94.3%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6472.5
Applied rewrites72.5%
Applied rewrites76.8%
if -8.59999999999999977e-98 < y < 1.25e-108Initial program 95.2%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/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
sub-negN/A
lower--.f6482.2
Applied rewrites82.2%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) y))) (if (<= y -2.6e-183) t_1 (if (<= y 2.55e-110) (/ (* x t) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double tmp;
if (y <= -2.6e-183) {
tmp = t_1;
} else if (y <= 2.55e-110) {
tmp = (x * 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 / z) * y
if (y <= (-2.6d-183)) then
tmp = t_1
else if (y <= 2.55d-110) then
tmp = (x * 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 / z) * y;
double tmp;
if (y <= -2.6e-183) {
tmp = t_1;
} else if (y <= 2.55e-110) {
tmp = (x * t) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * y tmp = 0 if y <= -2.6e-183: tmp = t_1 elif y <= 2.55e-110: tmp = (x * t) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) tmp = 0.0 if (y <= -2.6e-183) tmp = t_1; elseif (y <= 2.55e-110) tmp = Float64(Float64(x * t) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * y; tmp = 0.0; if (y <= -2.6e-183) tmp = t_1; elseif (y <= 2.55e-110) tmp = (x * t) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.6e-183], t$95$1, If[LessEqual[y, 2.55e-110], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{-183}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-110}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.5999999999999999e-183 or 2.5500000000000001e-110 < y Initial program 94.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6470.4
Applied rewrites70.4%
Applied rewrites74.4%
if -2.5999999999999999e-183 < y < 2.5500000000000001e-110Initial program 94.4%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6477.7
Applied rewrites77.7%
Taylor expanded in z around inf
Applied rewrites66.8%
Final simplification72.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t) x))) (if (<= t -3.9e+207) t_1 (if (<= t 2.25e+184) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -t * x;
double tmp;
if (t <= -3.9e+207) {
tmp = t_1;
} else if (t <= 2.25e+184) {
tmp = (x / z) * y;
} 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 = -t * x
if (t <= (-3.9d+207)) then
tmp = t_1
else if (t <= 2.25d+184) then
tmp = (x / z) * y
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 = -t * x;
double tmp;
if (t <= -3.9e+207) {
tmp = t_1;
} else if (t <= 2.25e+184) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -t * x tmp = 0 if t <= -3.9e+207: tmp = t_1 elif t <= 2.25e+184: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-t) * x) tmp = 0.0 if (t <= -3.9e+207) tmp = t_1; elseif (t <= 2.25e+184) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -t * x; tmp = 0.0; if (t <= -3.9e+207) tmp = t_1; elseif (t <= 2.25e+184) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-t) * x), $MachinePrecision]}, If[LessEqual[t, -3.9e+207], t$95$1, If[LessEqual[t, 2.25e+184], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot x\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{+184}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.89999999999999972e207 or 2.25000000000000018e184 < t Initial program 99.8%
Taylor expanded in t around inf
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
sub-negN/A
lower--.f6486.3
Applied rewrites86.3%
Taylor expanded in z around 0
Applied rewrites52.9%
if -3.89999999999999972e207 < t < 2.25000000000000018e184Initial program 93.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.5
Applied rewrites67.5%
Applied rewrites69.2%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (* (- t) x))
double code(double x, double y, double z, double t) {
return -t * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t * x
end function
public static double code(double x, double y, double z, double t) {
return -t * x;
}
def code(x, y, z, t): return -t * x
function code(x, y, z, t) return Float64(Float64(-t) * x) end
function tmp = code(x, y, z, t) tmp = -t * x; end
code[x_, y_, z_, t_] := N[((-t) * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) \cdot x
\end{array}
Initial program 94.6%
Taylor expanded in t around inf
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
sub-negN/A
lower--.f6446.5
Applied rewrites46.5%
Taylor expanded in z around 0
Applied rewrites22.4%
Final simplification22.4%
(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 2024277
(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)))))