
(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 8 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 93.7%
Final simplification93.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -1.02e+14)
t_1
(if (<= z 8.5e-79)
(* y (/ x z))
(if (<= z 0.00056)
(* x (- t))
(if (or (<= z 2.2e+158) (not (<= z 1.4e+259))) (* 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.02e+14) {
tmp = t_1;
} else if (z <= 8.5e-79) {
tmp = y * (x / z);
} else if (z <= 0.00056) {
tmp = x * -t;
} else if ((z <= 2.2e+158) || !(z <= 1.4e+259)) {
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.02d+14)) then
tmp = t_1
else if (z <= 8.5d-79) then
tmp = y * (x / z)
else if (z <= 0.00056d0) then
tmp = x * -t
else if ((z <= 2.2d+158) .or. (.not. (z <= 1.4d+259))) 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.02e+14) {
tmp = t_1;
} else if (z <= 8.5e-79) {
tmp = y * (x / z);
} else if (z <= 0.00056) {
tmp = x * -t;
} else if ((z <= 2.2e+158) || !(z <= 1.4e+259)) {
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.02e+14: tmp = t_1 elif z <= 8.5e-79: tmp = y * (x / z) elif z <= 0.00056: tmp = x * -t elif (z <= 2.2e+158) or not (z <= 1.4e+259): 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.02e+14) tmp = t_1; elseif (z <= 8.5e-79) tmp = Float64(y * Float64(x / z)); elseif (z <= 0.00056) tmp = Float64(x * Float64(-t)); elseif ((z <= 2.2e+158) || !(z <= 1.4e+259)) 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); tmp = 0.0; if (z <= -1.02e+14) tmp = t_1; elseif (z <= 8.5e-79) tmp = y * (x / z); elseif (z <= 0.00056) tmp = x * -t; elseif ((z <= 2.2e+158) || ~((z <= 1.4e+259))) 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.02e+14], t$95$1, If[LessEqual[z, 8.5e-79], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00056], N[(x * (-t)), $MachinePrecision], If[Or[LessEqual[z, 2.2e+158], N[Not[LessEqual[z, 1.4e+259]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-79}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 0.00056:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+158} \lor \neg \left(z \leq 1.4 \cdot 10^{+259}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.02e14 or 2.2000000000000001e158 < z < 1.4e259Initial program 94.8%
Taylor expanded in z around inf 85.2%
Taylor expanded in y around 0 66.0%
*-commutative66.0%
Simplified66.0%
associate-/l*71.9%
*-commutative71.9%
Applied egg-rr71.9%
if -1.02e14 < z < 8.50000000000000029e-79Initial program 91.7%
Taylor expanded in y around inf 74.5%
*-commutative74.5%
associate-/l*77.0%
Simplified77.0%
if 8.50000000000000029e-79 < z < 5.5999999999999995e-4Initial program 99.7%
Taylor expanded in y around 0 64.2%
mul-1-neg64.2%
*-commutative64.2%
associate-/l*64.3%
distribute-rgt-neg-out64.3%
distribute-neg-frac264.3%
neg-sub064.3%
associate--r-64.3%
metadata-eval64.3%
Simplified64.3%
Taylor expanded in z around 0 59.0%
*-commutative59.0%
neg-mul-159.0%
distribute-lft-neg-in59.0%
Simplified59.0%
if 5.5999999999999995e-4 < z < 2.2000000000000001e158 or 1.4e259 < z Initial program 94.2%
Taylor expanded in y around inf 60.0%
associate-*r/67.0%
Simplified67.0%
Final simplification72.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -3.6e+15)
t_1
(if (<= z 1.0)
(* x (- (/ y z) t))
(if (or (<= z 3e+164) (not (<= z 1.2e+253))) (* 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 <= -3.6e+15) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else if ((z <= 3e+164) || !(z <= 1.2e+253)) {
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 <= (-3.6d+15)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else if ((z <= 3d+164) .or. (.not. (z <= 1.2d+253))) 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 <= -3.6e+15) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else if ((z <= 3e+164) || !(z <= 1.2e+253)) {
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 <= -3.6e+15: tmp = t_1 elif z <= 1.0: tmp = x * ((y / z) - t) elif (z <= 3e+164) or not (z <= 1.2e+253): 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 <= -3.6e+15) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif ((z <= 3e+164) || !(z <= 1.2e+253)) 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); tmp = 0.0; if (z <= -3.6e+15) tmp = t_1; elseif (z <= 1.0) tmp = x * ((y / z) - t); elseif ((z <= 3e+164) || ~((z <= 1.2e+253))) 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, -3.6e+15], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3e+164], N[Not[LessEqual[z, 1.2e+253]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+164} \lor \neg \left(z \leq 1.2 \cdot 10^{+253}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.6e15 or 3.00000000000000001e164 < z < 1.19999999999999996e253Initial program 94.8%
Taylor expanded in z around inf 85.2%
Taylor expanded in y around 0 66.0%
*-commutative66.0%
Simplified66.0%
associate-/l*71.9%
*-commutative71.9%
Applied egg-rr71.9%
if -3.6e15 < z < 1Initial program 93.0%
Taylor expanded in z around 0 87.9%
+-commutative87.9%
associate-*r/85.9%
*-commutative85.9%
associate-*r*85.9%
neg-mul-185.9%
distribute-rgt-out91.0%
unsub-neg91.0%
Simplified91.0%
if 1 < z < 3.00000000000000001e164 or 1.19999999999999996e253 < z Initial program 94.2%
Taylor expanded in y around inf 60.0%
associate-*r/67.0%
Simplified67.0%
Final simplification81.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ x z))))
(if (<= t -4e+90)
(* x (- t))
(if (<= t 2e-152)
t_1
(if (<= t 1.4e+138)
(* x (/ y z))
(if (<= t 3.5e+222) t_1 (* t (/ x z))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double tmp;
if (t <= -4e+90) {
tmp = x * -t;
} else if (t <= 2e-152) {
tmp = t_1;
} else if (t <= 1.4e+138) {
tmp = x * (y / z);
} else if (t <= 3.5e+222) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = y * (x / z)
if (t <= (-4d+90)) then
tmp = x * -t
else if (t <= 2d-152) then
tmp = t_1
else if (t <= 1.4d+138) then
tmp = x * (y / z)
else if (t <= 3.5d+222) then
tmp = t_1
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double tmp;
if (t <= -4e+90) {
tmp = x * -t;
} else if (t <= 2e-152) {
tmp = t_1;
} else if (t <= 1.4e+138) {
tmp = x * (y / z);
} else if (t <= 3.5e+222) {
tmp = t_1;
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x / z) tmp = 0 if t <= -4e+90: tmp = x * -t elif t <= 2e-152: tmp = t_1 elif t <= 1.4e+138: tmp = x * (y / z) elif t <= 3.5e+222: tmp = t_1 else: tmp = t * (x / z) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x / z)) tmp = 0.0 if (t <= -4e+90) tmp = Float64(x * Float64(-t)); elseif (t <= 2e-152) tmp = t_1; elseif (t <= 1.4e+138) tmp = Float64(x * Float64(y / z)); elseif (t <= 3.5e+222) tmp = t_1; else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x / z); tmp = 0.0; if (t <= -4e+90) tmp = x * -t; elseif (t <= 2e-152) tmp = t_1; elseif (t <= 1.4e+138) tmp = x * (y / z); elseif (t <= 3.5e+222) tmp = t_1; else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e+90], N[(x * (-t)), $MachinePrecision], If[LessEqual[t, 2e-152], t$95$1, If[LessEqual[t, 1.4e+138], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+222], t$95$1, N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{z}\\
\mathbf{if}\;t \leq -4 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+138}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -3.99999999999999987e90Initial program 97.8%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
*-commutative82.6%
associate-/l*86.4%
distribute-rgt-neg-out86.4%
distribute-neg-frac286.4%
neg-sub086.4%
associate--r-86.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in z around 0 46.8%
*-commutative46.8%
neg-mul-146.8%
distribute-lft-neg-in46.8%
Simplified46.8%
if -3.99999999999999987e90 < t < 2.00000000000000013e-152 or 1.4e138 < t < 3.4999999999999998e222Initial program 89.0%
Taylor expanded in y around inf 73.7%
*-commutative73.7%
associate-/l*81.9%
Simplified81.9%
if 2.00000000000000013e-152 < t < 1.4e138Initial program 98.3%
Taylor expanded in y around inf 60.8%
associate-*r/63.6%
Simplified63.6%
if 3.4999999999999998e222 < t Initial program 99.9%
Taylor expanded in y around 0 72.6%
mul-1-neg72.6%
*-commutative72.6%
associate-/l*86.1%
distribute-rgt-neg-out86.1%
distribute-neg-frac286.1%
neg-sub086.1%
associate--r-86.1%
metadata-eval86.1%
Simplified86.1%
Taylor expanded in z around inf 51.3%
associate-/l*64.7%
Simplified64.7%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1000000000000.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 <= -1000000000000.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 <= (-1000000000000.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 <= -1000000000000.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 <= -1000000000000.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 <= -1000000000000.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 <= -1000000000000.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, -1000000000000.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 -1000000000000 \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 < -1e12 or 1 < z Initial program 94.6%
Taylor expanded in z around inf 87.0%
*-commutative87.0%
remove-double-neg87.0%
cancel-sign-sub-inv87.0%
metadata-eval87.0%
*-lft-identity87.0%
distribute-neg-out87.0%
neg-mul-187.0%
sub-neg87.0%
mul-1-neg87.0%
associate-*r*87.0%
*-commutative87.0%
associate-*r/87.0%
mul-1-neg87.0%
associate-/l*94.4%
distribute-rgt-neg-in94.4%
distribute-neg-frac94.4%
Simplified94.4%
if -1e12 < z < 1Initial program 93.0%
Taylor expanded in z around 0 87.9%
+-commutative87.9%
associate-*r/85.9%
*-commutative85.9%
associate-*r*85.9%
neg-mul-185.9%
distribute-rgt-out91.0%
unsub-neg91.0%
Simplified91.0%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e-55) (not (<= z 7.2))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e-55) || !(z <= 7.2)) {
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 <= (-7d-55)) .or. (.not. (z <= 7.2d0))) 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 <= -7e-55) || !(z <= 7.2)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e-55) or not (z <= 7.2): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e-55) || !(z <= 7.2)) 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 <= -7e-55) || ~((z <= 7.2))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e-55], N[Not[LessEqual[z, 7.2]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-55} \lor \neg \left(z \leq 7.2\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -7.00000000000000051e-55 or 7.20000000000000018 < z Initial program 94.2%
Taylor expanded in y around 0 56.2%
mul-1-neg56.2%
*-commutative56.2%
associate-/l*58.9%
distribute-rgt-neg-out58.9%
distribute-neg-frac258.9%
neg-sub058.9%
associate--r-58.9%
metadata-eval58.9%
Simplified58.9%
Taylor expanded in z around inf 54.8%
associate-/l*54.2%
Simplified54.2%
if -7.00000000000000051e-55 < z < 7.20000000000000018Initial program 93.3%
Taylor expanded in y around 0 29.9%
mul-1-neg29.9%
*-commutative29.9%
associate-/l*30.0%
distribute-rgt-neg-out30.0%
distribute-neg-frac230.0%
neg-sub030.0%
associate--r-30.0%
metadata-eval30.0%
Simplified30.0%
Taylor expanded in z around 0 29.0%
*-commutative29.0%
neg-mul-129.0%
distribute-lft-neg-in29.0%
Simplified29.0%
Final simplification41.5%
(FPCore (x y z t) :precision binary64 (if (<= t -2.6e+90) (* x (- t)) (if (<= t 3.5e+222) (* x (/ y z)) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.6e+90) {
tmp = x * -t;
} else if (t <= 3.5e+222) {
tmp = x * (y / z);
} else {
tmp = 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 (t <= (-2.6d+90)) then
tmp = x * -t
else if (t <= 3.5d+222) then
tmp = x * (y / z)
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.6e+90) {
tmp = x * -t;
} else if (t <= 3.5e+222) {
tmp = x * (y / z);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.6e+90: tmp = x * -t elif t <= 3.5e+222: tmp = x * (y / z) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.6e+90) tmp = Float64(x * Float64(-t)); elseif (t <= 3.5e+222) tmp = Float64(x * Float64(y / z)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.6e+90) tmp = x * -t; elseif (t <= 3.5e+222) tmp = x * (y / z); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.6e+90], N[(x * (-t)), $MachinePrecision], If[LessEqual[t, 3.5e+222], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -2.5999999999999998e90Initial program 97.8%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
*-commutative82.6%
associate-/l*86.4%
distribute-rgt-neg-out86.4%
distribute-neg-frac286.4%
neg-sub086.4%
associate--r-86.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in z around 0 46.8%
*-commutative46.8%
neg-mul-146.8%
distribute-lft-neg-in46.8%
Simplified46.8%
if -2.5999999999999998e90 < t < 3.4999999999999998e222Initial program 92.3%
Taylor expanded in y around inf 69.2%
associate-*r/70.8%
Simplified70.8%
if 3.4999999999999998e222 < t Initial program 99.9%
Taylor expanded in y around 0 72.6%
mul-1-neg72.6%
*-commutative72.6%
associate-/l*86.1%
distribute-rgt-neg-out86.1%
distribute-neg-frac286.1%
neg-sub086.1%
associate--r-86.1%
metadata-eval86.1%
Simplified86.1%
Taylor expanded in z around inf 51.3%
associate-/l*64.7%
Simplified64.7%
Final simplification65.9%
(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 93.7%
Taylor expanded in y around 0 43.0%
mul-1-neg43.0%
*-commutative43.0%
associate-/l*44.3%
distribute-rgt-neg-out44.3%
distribute-neg-frac244.3%
neg-sub044.3%
associate--r-44.3%
metadata-eval44.3%
Simplified44.3%
Taylor expanded in z around 0 20.0%
*-commutative20.0%
neg-mul-120.0%
distribute-lft-neg-in20.0%
Simplified20.0%
Final simplification20.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024045
(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)))))