
(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 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 2e+281) (* x t_1) (/ (* (- y (* t z)) x) z))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 2e+281) {
tmp = x * t_1;
} else {
tmp = ((y - (t * z)) * 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 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= 2d+281) then
tmp = x * t_1
else
tmp = ((y - (t * z)) * x) / z
end if
code = tmp
end function
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 <= 2e+281) {
tmp = x * t_1;
} else {
tmp = ((y - (t * z)) * x) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= 2e+281: tmp = x * t_1 else: tmp = ((y - (t * z)) * x) / z 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 <= 2e+281) tmp = Float64(x * t_1); else tmp = Float64(Float64(Float64(y - Float64(t * z)) * x) / z); 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 <= 2e+281) tmp = x * t_1; else tmp = ((y - (t * z)) * x) / z; 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, 2e+281], N[(x * t$95$1), $MachinePrecision], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+281}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - t \cdot z\right) \cdot x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 2.0000000000000001e281Initial program 96.7%
if 2.0000000000000001e281 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 60.0%
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
lower-*.f6499.9
Applied rewrites99.9%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (+ t y) z) x)))
(if (<= z -8.5e-5)
t_1
(if (<= z 9.2e-39) (* (/ (fma x z x) z) (fma (+ t y) (- 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 <= -8.5e-5) {
tmp = t_1;
} else if (z <= 9.2e-39) {
tmp = (fma(x, z, x) / z) * fma((t + y), -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 <= -8.5e-5) tmp = t_1; elseif (z <= 9.2e-39) tmp = Float64(Float64(fma(x, z, x) / z) * fma(Float64(t + y), Float64(-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, -8.5e-5], t$95$1, If[LessEqual[z, 9.2e-39], N[(N[(N[(x * z + x), $MachinePrecision] / z), $MachinePrecision] * N[(N[(t + y), $MachinePrecision] * (-z) + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-39}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, z, x\right)}{z} \cdot \mathsf{fma}\left(t + y, -z, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.500000000000001e-5 or 9.20000000000000033e-39 < z Initial program 96.4%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.3
Applied rewrites95.3%
if -8.500000000000001e-5 < z < 9.20000000000000033e-39Initial program 91.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in z around 0
Applied rewrites96.1%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -1.15) t_1 (if (<= z 2.35e-18) (/ (* (- y (* t z)) x) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -1.15) {
tmp = t_1;
} else if (z <= 2.35e-18) {
tmp = ((y - (t * z)) * x) / 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 = ((t + y) / z) * x
if (z <= (-1.15d0)) then
tmp = t_1
else if (z <= 2.35d-18) then
tmp = ((y - (t * z)) * x) / 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 = ((t + y) / z) * x;
double tmp;
if (z <= -1.15) {
tmp = t_1;
} else if (z <= 2.35e-18) {
tmp = ((y - (t * z)) * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -1.15: tmp = t_1 elif z <= 2.35e-18: tmp = ((y - (t * z)) * x) / z 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.15) tmp = t_1; elseif (z <= 2.35e-18) tmp = Float64(Float64(Float64(y - Float64(t * z)) * x) / z); 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 <= -1.15) tmp = t_1; elseif (z <= 2.35e-18) tmp = ((y - (t * z)) * x) / z; 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, -1.15], t$95$1, If[LessEqual[z, 2.35e-18], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.15:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-18}:\\
\;\;\;\;\frac{\left(y - t \cdot z\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1499999999999999 or 2.3499999999999998e-18 < z Initial program 96.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
if -1.1499999999999999 < z < 2.3499999999999998e-18Initial program 91.4%
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
lower-*.f6494.2
Applied rewrites94.2%
Final simplification94.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t) x)))
(if (<= t -1.6e+108)
t_1
(if (<= t 220000000000.0)
(* x (/ y z))
(if (<= t 2.2e+262) (* (/ t z) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = -t * x;
double tmp;
if (t <= -1.6e+108) {
tmp = t_1;
} else if (t <= 220000000000.0) {
tmp = x * (y / z);
} else if (t <= 2.2e+262) {
tmp = (t / 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 * x
if (t <= (-1.6d+108)) then
tmp = t_1
else if (t <= 220000000000.0d0) then
tmp = x * (y / z)
else if (t <= 2.2d+262) then
tmp = (t / 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 * x;
double tmp;
if (t <= -1.6e+108) {
tmp = t_1;
} else if (t <= 220000000000.0) {
tmp = x * (y / z);
} else if (t <= 2.2e+262) {
tmp = (t / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -t * x tmp = 0 if t <= -1.6e+108: tmp = t_1 elif t <= 220000000000.0: tmp = x * (y / z) elif t <= 2.2e+262: tmp = (t / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-t) * x) tmp = 0.0 if (t <= -1.6e+108) tmp = t_1; elseif (t <= 220000000000.0) tmp = Float64(x * Float64(y / z)); elseif (t <= 2.2e+262) tmp = Float64(Float64(t / z) * x); 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 <= -1.6e+108) tmp = t_1; elseif (t <= 220000000000.0) tmp = x * (y / z); elseif (t <= 2.2e+262) tmp = (t / z) * x; 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, -1.6e+108], t$95$1, If[LessEqual[t, 220000000000.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e+262], N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot x\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 220000000000:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+262}:\\
\;\;\;\;\frac{t}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.6e108 or 2.20000000000000011e262 < t Initial program 90.7%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
Taylor expanded in y around 0
Applied rewrites55.9%
if -1.6e108 < t < 2.2e11Initial program 94.5%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.0
Applied rewrites84.0%
if 2.2e11 < t < 2.20000000000000011e262Initial program 94.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6460.0
Applied rewrites60.0%
Taylor expanded in y around 0
Applied rewrites51.8%
Final simplification72.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -1.0) t_1 (if (<= z 9.2e-39) (* (- (/ y z) t) 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.0) {
tmp = t_1;
} else if (z <= 9.2e-39) {
tmp = ((y / z) - t) * 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 <= (-1.0d0)) then
tmp = t_1
else if (z <= 9.2d-39) then
tmp = ((y / z) - t) * 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 <= -1.0) {
tmp = t_1;
} else if (z <= 9.2e-39) {
tmp = ((y / z) - t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -1.0: tmp = t_1 elif z <= 9.2e-39: tmp = ((y / z) - t) * 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.0) tmp = t_1; elseif (z <= 9.2e-39) tmp = Float64(Float64(Float64(y / z) - t) * 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 <= -1.0) tmp = t_1; elseif (z <= 9.2e-39) tmp = ((y / z) - t) * 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, -1.0], t$95$1, If[LessEqual[z, 9.2e-39], N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-39}:\\
\;\;\;\;\left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 9.20000000000000033e-39 < z Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.2
Applied rewrites95.2%
if -1 < z < 9.20000000000000033e-39Initial program 91.1%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
Taylor expanded in y around 0
Applied rewrites90.6%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* x t) (- z 1.0)))) (if (<= t -3.8e+101) t_1 (if (<= t 60000000000.0) (* x (/ y z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * t) / (z - 1.0);
double tmp;
if (t <= -3.8e+101) {
tmp = t_1;
} else if (t <= 60000000000.0) {
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 - 1.0d0)
if (t <= (-3.8d+101)) then
tmp = t_1
else if (t <= 60000000000.0d0) 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 - 1.0);
double tmp;
if (t <= -3.8e+101) {
tmp = t_1;
} else if (t <= 60000000000.0) {
tmp = x * (y / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * t) / (z - 1.0) tmp = 0 if t <= -3.8e+101: tmp = t_1 elif t <= 60000000000.0: tmp = x * (y / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * t) / Float64(z - 1.0)) tmp = 0.0 if (t <= -3.8e+101) tmp = t_1; elseif (t <= 60000000000.0) tmp = Float64(x * Float64(y / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * t) / (z - 1.0); tmp = 0.0; if (t <= -3.8e+101) tmp = t_1; elseif (t <= 60000000000.0) tmp = x * (y / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * t), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.8e+101], t$95$1, If[LessEqual[t, 60000000000.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot t}{z - 1}\\
\mathbf{if}\;t \leq -3.8 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 60000000000:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7999999999999998e101 or 6e10 < t Initial program 92.6%
Taylor expanded in y around 0
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--.f6472.0
Applied rewrites72.0%
if -3.7999999999999998e101 < t < 6e10Initial program 94.5%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.5
Applied rewrites84.5%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t) x))) (if (<= t -1.6e+108) t_1 (if (<= t 4.3e+218) (* x (/ y z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -t * x;
double tmp;
if (t <= -1.6e+108) {
tmp = t_1;
} else if (t <= 4.3e+218) {
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 = -t * x
if (t <= (-1.6d+108)) then
tmp = t_1
else if (t <= 4.3d+218) 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 = -t * x;
double tmp;
if (t <= -1.6e+108) {
tmp = t_1;
} else if (t <= 4.3e+218) {
tmp = x * (y / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -t * x tmp = 0 if t <= -1.6e+108: tmp = t_1 elif t <= 4.3e+218: tmp = x * (y / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-t) * x) tmp = 0.0 if (t <= -1.6e+108) tmp = t_1; elseif (t <= 4.3e+218) tmp = Float64(x * Float64(y / z)); 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 <= -1.6e+108) tmp = t_1; elseif (t <= 4.3e+218) tmp = x * (y / z); 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, -1.6e+108], t$95$1, If[LessEqual[t, 4.3e+218], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot x\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+218}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.6e108 or 4.29999999999999987e218 < t Initial program 92.1%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites54.5%
if -1.6e108 < t < 4.29999999999999987e218Initial program 94.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.7
Applied rewrites72.7%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t) x))) (if (<= t -1.2e+108) t_1 (if (<= t 4.3e+218) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -t * x;
double tmp;
if (t <= -1.2e+108) {
tmp = t_1;
} else if (t <= 4.3e+218) {
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 <= (-1.2d+108)) then
tmp = t_1
else if (t <= 4.3d+218) 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 <= -1.2e+108) {
tmp = t_1;
} else if (t <= 4.3e+218) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -t * x tmp = 0 if t <= -1.2e+108: tmp = t_1 elif t <= 4.3e+218: 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 <= -1.2e+108) tmp = t_1; elseif (t <= 4.3e+218) 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 <= -1.2e+108) tmp = t_1; elseif (t <= 4.3e+218) 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, -1.2e+108], t$95$1, If[LessEqual[t, 4.3e+218], 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 -1.2 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+218}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.20000000000000009e108 or 4.29999999999999987e218 < t Initial program 92.1%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6458.5
Applied rewrites58.5%
Taylor expanded in y around 0
Applied rewrites54.5%
if -1.20000000000000009e108 < t < 4.29999999999999987e218Initial program 94.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.7
Applied rewrites72.7%
Applied rewrites72.2%
Final simplification68.1%
(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 93.7%
Taylor expanded in z around 0
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6466.3
Applied rewrites66.3%
Taylor expanded in y around 0
Applied rewrites22.8%
Final simplification22.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 2024294
(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)))))