
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (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 = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\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 x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (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 = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (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 = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x z))))
(if (<= z -0.52)
t_1
(if (<= z 3.2e-101)
(+ x (* y t))
(if (<= z 1.6e+26)
(* x (- 1.0 y))
(if (or (<= z 6e+166) (not (<= z 5.7e+232))) (- x (* z t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double tmp;
if (z <= -0.52) {
tmp = t_1;
} else if (z <= 3.2e-101) {
tmp = x + (y * t);
} else if (z <= 1.6e+26) {
tmp = x * (1.0 - y);
} else if ((z <= 6e+166) || !(z <= 5.7e+232)) {
tmp = x - (z * t);
} 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 + (x * z)
if (z <= (-0.52d0)) then
tmp = t_1
else if (z <= 3.2d-101) then
tmp = x + (y * t)
else if (z <= 1.6d+26) then
tmp = x * (1.0d0 - y)
else if ((z <= 6d+166) .or. (.not. (z <= 5.7d+232))) then
tmp = x - (z * t)
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 + (x * z);
double tmp;
if (z <= -0.52) {
tmp = t_1;
} else if (z <= 3.2e-101) {
tmp = x + (y * t);
} else if (z <= 1.6e+26) {
tmp = x * (1.0 - y);
} else if ((z <= 6e+166) || !(z <= 5.7e+232)) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * z) tmp = 0 if z <= -0.52: tmp = t_1 elif z <= 3.2e-101: tmp = x + (y * t) elif z <= 1.6e+26: tmp = x * (1.0 - y) elif (z <= 6e+166) or not (z <= 5.7e+232): tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * z)) tmp = 0.0 if (z <= -0.52) tmp = t_1; elseif (z <= 3.2e-101) tmp = Float64(x + Float64(y * t)); elseif (z <= 1.6e+26) tmp = Float64(x * Float64(1.0 - y)); elseif ((z <= 6e+166) || !(z <= 5.7e+232)) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * z); tmp = 0.0; if (z <= -0.52) tmp = t_1; elseif (z <= 3.2e-101) tmp = x + (y * t); elseif (z <= 1.6e+26) tmp = x * (1.0 - y); elseif ((z <= 6e+166) || ~((z <= 5.7e+232))) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.52], t$95$1, If[LessEqual[z, 3.2e-101], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+26], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 6e+166], N[Not[LessEqual[z, 5.7e+232]], $MachinePrecision]], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;z \leq -0.52:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-101}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+166} \lor \neg \left(z \leq 5.7 \cdot 10^{+232}\right):\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.52000000000000002 or 5.99999999999999997e166 < z < 5.69999999999999956e232Initial program 100.0%
Taylor expanded in y around 0 85.8%
mul-1-neg85.8%
distribute-rgt-neg-in85.8%
sub-neg85.8%
+-commutative85.8%
distribute-neg-in85.8%
remove-double-neg85.8%
sub-neg85.8%
Simplified85.8%
Taylor expanded in t around 0 60.0%
if -0.52000000000000002 < z < 3.19999999999999978e-101Initial program 100.0%
Taylor expanded in y around inf 94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in t around inf 74.5%
*-commutative74.5%
Simplified74.5%
if 3.19999999999999978e-101 < z < 1.60000000000000014e26Initial program 99.9%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in x around inf 60.7%
neg-mul-160.7%
unsub-neg60.7%
Simplified60.7%
if 1.60000000000000014e26 < z < 5.99999999999999997e166 or 5.69999999999999956e232 < z Initial program 100.0%
Taylor expanded in t around inf 63.2%
Taylor expanded in y around 0 54.3%
mul-1-neg54.3%
unsub-neg54.3%
*-commutative54.3%
Simplified54.3%
Final simplification65.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x z))))
(if (<= z -750.0)
t_1
(if (<= z 6.6e-102)
(+ x (* y t))
(if (<= z 1.6e+26) (* x (- 1.0 y)) (if (<= z 1.2e+29) (* y t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double tmp;
if (z <= -750.0) {
tmp = t_1;
} else if (z <= 6.6e-102) {
tmp = x + (y * t);
} else if (z <= 1.6e+26) {
tmp = x * (1.0 - y);
} else if (z <= 1.2e+29) {
tmp = y * t;
} 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 + (x * z)
if (z <= (-750.0d0)) then
tmp = t_1
else if (z <= 6.6d-102) then
tmp = x + (y * t)
else if (z <= 1.6d+26) then
tmp = x * (1.0d0 - y)
else if (z <= 1.2d+29) then
tmp = y * t
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 + (x * z);
double tmp;
if (z <= -750.0) {
tmp = t_1;
} else if (z <= 6.6e-102) {
tmp = x + (y * t);
} else if (z <= 1.6e+26) {
tmp = x * (1.0 - y);
} else if (z <= 1.2e+29) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * z) tmp = 0 if z <= -750.0: tmp = t_1 elif z <= 6.6e-102: tmp = x + (y * t) elif z <= 1.6e+26: tmp = x * (1.0 - y) elif z <= 1.2e+29: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * z)) tmp = 0.0 if (z <= -750.0) tmp = t_1; elseif (z <= 6.6e-102) tmp = Float64(x + Float64(y * t)); elseif (z <= 1.6e+26) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 1.2e+29) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * z); tmp = 0.0; if (z <= -750.0) tmp = t_1; elseif (z <= 6.6e-102) tmp = x + (y * t); elseif (z <= 1.6e+26) tmp = x * (1.0 - y); elseif (z <= 1.2e+29) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -750.0], t$95$1, If[LessEqual[z, 6.6e-102], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+26], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+29], N[(y * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;z \leq -750:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-102}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+29}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -750 or 1.2e29 < z Initial program 100.0%
Taylor expanded in y around 0 85.0%
mul-1-neg85.0%
distribute-rgt-neg-in85.0%
sub-neg85.0%
+-commutative85.0%
distribute-neg-in85.0%
remove-double-neg85.0%
sub-neg85.0%
Simplified85.0%
Taylor expanded in t around 0 52.5%
if -750 < z < 6.6e-102Initial program 100.0%
Taylor expanded in y around inf 94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in t around inf 74.5%
*-commutative74.5%
Simplified74.5%
if 6.6e-102 < z < 1.60000000000000014e26Initial program 99.9%
Taylor expanded in y around inf 73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in x around inf 60.7%
neg-mul-160.7%
unsub-neg60.7%
Simplified60.7%
if 1.60000000000000014e26 < z < 1.2e29Initial program 100.0%
Taylor expanded in y around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x z))) (t_2 (* x (- 1.0 y))))
(if (<= z -1.9e+20)
t_1
(if (<= z -6e-298)
t_2
(if (<= z 6.5e-258) (* y t) (if (<= z 1.2e+32) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double t_2 = x * (1.0 - y);
double tmp;
if (z <= -1.9e+20) {
tmp = t_1;
} else if (z <= -6e-298) {
tmp = t_2;
} else if (z <= 6.5e-258) {
tmp = y * t;
} else if (z <= 1.2e+32) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + (x * z)
t_2 = x * (1.0d0 - y)
if (z <= (-1.9d+20)) then
tmp = t_1
else if (z <= (-6d-298)) then
tmp = t_2
else if (z <= 6.5d-258) then
tmp = y * t
else if (z <= 1.2d+32) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double t_2 = x * (1.0 - y);
double tmp;
if (z <= -1.9e+20) {
tmp = t_1;
} else if (z <= -6e-298) {
tmp = t_2;
} else if (z <= 6.5e-258) {
tmp = y * t;
} else if (z <= 1.2e+32) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * z) t_2 = x * (1.0 - y) tmp = 0 if z <= -1.9e+20: tmp = t_1 elif z <= -6e-298: tmp = t_2 elif z <= 6.5e-258: tmp = y * t elif z <= 1.2e+32: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * z)) t_2 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (z <= -1.9e+20) tmp = t_1; elseif (z <= -6e-298) tmp = t_2; elseif (z <= 6.5e-258) tmp = Float64(y * t); elseif (z <= 1.2e+32) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * z); t_2 = x * (1.0 - y); tmp = 0.0; if (z <= -1.9e+20) tmp = t_1; elseif (z <= -6e-298) tmp = t_2; elseif (z <= 6.5e-258) tmp = y * t; elseif (z <= 1.2e+32) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.9e+20], t$95$1, If[LessEqual[z, -6e-298], t$95$2, If[LessEqual[z, 6.5e-258], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.2e+32], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot z\\
t_2 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-298}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-258}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9e20 or 1.19999999999999996e32 < z Initial program 100.0%
Taylor expanded in y around 0 87.7%
mul-1-neg87.7%
distribute-rgt-neg-in87.7%
sub-neg87.7%
+-commutative87.7%
distribute-neg-in87.7%
remove-double-neg87.7%
sub-neg87.7%
Simplified87.7%
Taylor expanded in t around 0 54.0%
if -1.9e20 < z < -5.9999999999999999e-298 or 6.5000000000000002e-258 < z < 1.19999999999999996e32Initial program 100.0%
Taylor expanded in y around inf 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in x around inf 62.4%
neg-mul-162.4%
unsub-neg62.4%
Simplified62.4%
if -5.9999999999999999e-298 < z < 6.5000000000000002e-258Initial program 100.0%
Taylor expanded in y around inf 95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in t around inf 95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in x around 0 78.2%
*-commutative78.2%
Simplified78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.25e+17) (not (<= x 4.9e-57))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.25e+17) || !(x <= 4.9e-57)) {
tmp = x + (x * (z - y));
} 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 ((x <= (-2.25d+17)) .or. (.not. (x <= 4.9d-57))) then
tmp = x + (x * (z - y))
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 ((x <= -2.25e+17) || !(x <= 4.9e-57)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.25e+17) or not (x <= 4.9e-57): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.25e+17) || !(x <= 4.9e-57)) tmp = Float64(x + Float64(x * Float64(z - y))); 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 ((x <= -2.25e+17) || ~((x <= 4.9e-57))) tmp = x + (x * (z - y)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.25e+17], N[Not[LessEqual[x, 4.9e-57]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{+17} \lor \neg \left(x \leq 4.9 \cdot 10^{-57}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -2.25e17 or 4.89999999999999988e-57 < x Initial program 100.0%
Taylor expanded in t around 0 88.1%
mul-1-neg88.1%
distribute-rgt-neg-in88.1%
sub-neg88.1%
+-commutative88.1%
distribute-neg-in88.1%
remove-double-neg88.1%
sub-neg88.1%
Simplified88.1%
if -2.25e17 < x < 4.89999999999999988e-57Initial program 100.0%
Taylor expanded in t around inf 87.0%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.6e+88) (* x (- 1.0 y)) (if (<= x 5e-8) (+ x (* (- y z) t)) (+ x (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e+88) {
tmp = x * (1.0 - y);
} else if (x <= 5e-8) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (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 (x <= (-3.6d+88)) then
tmp = x * (1.0d0 - y)
else if (x <= 5d-8) then
tmp = x + ((y - z) * t)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.6e+88) {
tmp = x * (1.0 - y);
} else if (x <= 5e-8) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.6e+88: tmp = x * (1.0 - y) elif x <= 5e-8: tmp = x + ((y - z) * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.6e+88) tmp = Float64(x * Float64(1.0 - y)); elseif (x <= 5e-8) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.6e+88) tmp = x * (1.0 - y); elseif (x <= 5e-8) tmp = x + ((y - z) * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.6e+88], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e-8], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-8}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if x < -3.6000000000000002e88Initial program 100.0%
Taylor expanded in y around inf 66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in x around inf 66.3%
neg-mul-166.3%
unsub-neg66.3%
Simplified66.3%
if -3.6000000000000002e88 < x < 4.9999999999999998e-8Initial program 100.0%
Taylor expanded in t around inf 80.5%
if 4.9999999999999998e-8 < x Initial program 100.0%
Taylor expanded in y around 0 68.3%
mul-1-neg68.3%
distribute-rgt-neg-in68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-in68.3%
remove-double-neg68.3%
sub-neg68.3%
Simplified68.3%
Taylor expanded in t around 0 68.3%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.5e-179) (not (<= x 2.1e-112))) (* x (- 1.0 y)) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-179) || !(x <= 2.1e-112)) {
tmp = x * (1.0 - y);
} else {
tmp = y * 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 ((x <= (-1.5d-179)) .or. (.not. (x <= 2.1d-112))) then
tmp = x * (1.0d0 - y)
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-179) || !(x <= 2.1e-112)) {
tmp = x * (1.0 - y);
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.5e-179) or not (x <= 2.1e-112): tmp = x * (1.0 - y) else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.5e-179) || !(x <= 2.1e-112)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.5e-179) || ~((x <= 2.1e-112))) tmp = x * (1.0 - y); else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.5e-179], N[Not[LessEqual[x, 2.1e-112]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-179} \lor \neg \left(x \leq 2.1 \cdot 10^{-112}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if x < -1.50000000000000003e-179 or 2.1000000000000001e-112 < x Initial program 100.0%
Taylor expanded in y around inf 61.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in x around inf 49.9%
neg-mul-149.9%
unsub-neg49.9%
Simplified49.9%
if -1.50000000000000003e-179 < x < 2.1000000000000001e-112Initial program 100.0%
Taylor expanded in y around inf 62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in t around inf 60.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in x around 0 51.9%
*-commutative51.9%
Simplified51.9%
Final simplification50.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-18) (not (<= y 6.5e-26))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-18) || !(y <= 6.5e-26)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4d-18)) .or. (.not. (y <= 6.5d-26))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-18) || !(y <= 6.5e-26)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4e-18) or not (y <= 6.5e-26): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e-18) || !(y <= 6.5e-26)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4e-18) || ~((y <= 6.5e-26))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e-18], N[Not[LessEqual[y, 6.5e-26]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-18} \lor \neg \left(y \leq 6.5 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.0000000000000003e-18 or 6.5e-26 < y Initial program 100.0%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in t around inf 39.5%
*-commutative39.5%
Simplified39.5%
Taylor expanded in x around 0 38.7%
*-commutative38.7%
Simplified38.7%
if -4.0000000000000003e-18 < y < 6.5e-26Initial program 100.0%
Taylor expanded in t around inf 72.1%
Taylor expanded in x around inf 37.7%
Final simplification38.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return 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 = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 61.9%
Taylor expanded in x around inf 20.7%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - 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 + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024087
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))