
(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 11 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 (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -7000000000.0)
(* x z)
(if (<= z 1.2e-84)
(+ x (* y t))
(if (<= z 2.1e-11)
(* x (- 1.0 y))
(if (or (<= z 1.26e+182) (not (<= z 9e+256))) (- x (* z t)) (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7000000000.0) {
tmp = x * z;
} else if (z <= 1.2e-84) {
tmp = x + (y * t);
} else if (z <= 2.1e-11) {
tmp = x * (1.0 - y);
} else if ((z <= 1.26e+182) || !(z <= 9e+256)) {
tmp = x - (z * t);
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-7000000000.0d0)) then
tmp = x * z
else if (z <= 1.2d-84) then
tmp = x + (y * t)
else if (z <= 2.1d-11) then
tmp = x * (1.0d0 - y)
else if ((z <= 1.26d+182) .or. (.not. (z <= 9d+256))) then
tmp = x - (z * t)
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7000000000.0) {
tmp = x * z;
} else if (z <= 1.2e-84) {
tmp = x + (y * t);
} else if (z <= 2.1e-11) {
tmp = x * (1.0 - y);
} else if ((z <= 1.26e+182) || !(z <= 9e+256)) {
tmp = x - (z * t);
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7000000000.0: tmp = x * z elif z <= 1.2e-84: tmp = x + (y * t) elif z <= 2.1e-11: tmp = x * (1.0 - y) elif (z <= 1.26e+182) or not (z <= 9e+256): tmp = x - (z * t) else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7000000000.0) tmp = Float64(x * z); elseif (z <= 1.2e-84) tmp = Float64(x + Float64(y * t)); elseif (z <= 2.1e-11) tmp = Float64(x * Float64(1.0 - y)); elseif ((z <= 1.26e+182) || !(z <= 9e+256)) tmp = Float64(x - Float64(z * t)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7000000000.0) tmp = x * z; elseif (z <= 1.2e-84) tmp = x + (y * t); elseif (z <= 2.1e-11) tmp = x * (1.0 - y); elseif ((z <= 1.26e+182) || ~((z <= 9e+256))) tmp = x - (z * t); else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.2e-84], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e-11], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.26e+182], N[Not[LessEqual[z, 9e+256]], $MachinePrecision]], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-84}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+182} \lor \neg \left(z \leq 9 \cdot 10^{+256}\right):\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7e9 or 1.2600000000000001e182 < z < 8.9999999999999996e256Initial program 100.0%
Taylor expanded in t around 0 56.4%
mul-1-neg56.4%
distribute-rgt-neg-in56.4%
neg-sub056.4%
sub-neg56.4%
+-commutative56.4%
associate--r+56.4%
neg-sub056.4%
remove-double-neg56.4%
Simplified56.4%
sub-neg56.4%
distribute-rgt-in51.4%
Applied egg-rr51.4%
associate-+r+51.4%
distribute-lft-neg-out51.4%
unsub-neg51.4%
distribute-rgt1-in51.4%
*-commutative51.4%
Applied egg-rr51.4%
Taylor expanded in z around inf 49.3%
*-commutative49.3%
Simplified49.3%
if -7e9 < z < 1.20000000000000009e-84Initial program 100.0%
Taylor expanded in y around inf 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around inf 76.6%
*-commutative76.6%
Simplified76.6%
if 1.20000000000000009e-84 < z < 2.0999999999999999e-11Initial program 99.9%
Taylor expanded in t around 0 84.9%
mul-1-neg84.9%
distribute-rgt-neg-in84.9%
neg-sub084.9%
sub-neg84.9%
+-commutative84.9%
associate--r+84.9%
neg-sub084.9%
remove-double-neg84.9%
Simplified84.9%
Taylor expanded in z around 0 84.9%
*-rgt-identity84.9%
mul-1-neg84.9%
distribute-rgt-neg-out84.9%
neg-mul-184.9%
distribute-lft-in84.9%
neg-mul-184.9%
unsub-neg84.9%
Simplified84.9%
if 2.0999999999999999e-11 < z < 1.2600000000000001e182 or 8.9999999999999996e256 < z Initial program 100.0%
Taylor expanded in y around 0 88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
Taylor expanded in t around inf 60.2%
*-commutative60.2%
Simplified60.2%
Final simplification65.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -6.2)
(* x z)
(if (<= z -3.4e-241)
x
(if (<= z -9.8e-291)
(* y t)
(if (<= z 8.5e-239) x (if (<= z 8500000000.0) (* y t) (* x z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2) {
tmp = x * z;
} else if (z <= -3.4e-241) {
tmp = x;
} else if (z <= -9.8e-291) {
tmp = y * t;
} else if (z <= 8.5e-239) {
tmp = x;
} else if (z <= 8500000000.0) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-6.2d0)) then
tmp = x * z
else if (z <= (-3.4d-241)) then
tmp = x
else if (z <= (-9.8d-291)) then
tmp = y * t
else if (z <= 8.5d-239) then
tmp = x
else if (z <= 8500000000.0d0) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2) {
tmp = x * z;
} else if (z <= -3.4e-241) {
tmp = x;
} else if (z <= -9.8e-291) {
tmp = y * t;
} else if (z <= 8.5e-239) {
tmp = x;
} else if (z <= 8500000000.0) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.2: tmp = x * z elif z <= -3.4e-241: tmp = x elif z <= -9.8e-291: tmp = y * t elif z <= 8.5e-239: tmp = x elif z <= 8500000000.0: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.2) tmp = Float64(x * z); elseif (z <= -3.4e-241) tmp = x; elseif (z <= -9.8e-291) tmp = Float64(y * t); elseif (z <= 8.5e-239) tmp = x; elseif (z <= 8500000000.0) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.2) tmp = x * z; elseif (z <= -3.4e-241) tmp = x; elseif (z <= -9.8e-291) tmp = y * t; elseif (z <= 8.5e-239) tmp = x; elseif (z <= 8500000000.0) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.2], N[(x * z), $MachinePrecision], If[LessEqual[z, -3.4e-241], x, If[LessEqual[z, -9.8e-291], N[(y * t), $MachinePrecision], If[LessEqual[z, 8.5e-239], x, If[LessEqual[z, 8500000000.0], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-241}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -9.8 \cdot 10^{-291}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-239}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8500000000:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -6.20000000000000018 or 8.5e9 < z Initial program 100.0%
Taylor expanded in t around 0 49.3%
mul-1-neg49.3%
distribute-rgt-neg-in49.3%
neg-sub049.3%
sub-neg49.3%
+-commutative49.3%
associate--r+49.3%
neg-sub049.3%
remove-double-neg49.3%
Simplified49.3%
sub-neg49.3%
distribute-rgt-in45.1%
Applied egg-rr45.1%
associate-+r+45.1%
distribute-lft-neg-out45.1%
unsub-neg45.1%
distribute-rgt1-in45.1%
*-commutative45.1%
Applied egg-rr45.1%
Taylor expanded in z around inf 43.0%
*-commutative43.0%
Simplified43.0%
if -6.20000000000000018 < z < -3.3999999999999999e-241 or -9.79999999999999988e-291 < z < 8.49999999999999958e-239Initial program 100.0%
Taylor expanded in y around inf 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in y around 0 45.9%
if -3.3999999999999999e-241 < z < -9.79999999999999988e-291 or 8.49999999999999958e-239 < z < 8.5e9Initial program 100.0%
Taylor expanded in y around inf 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around inf 67.0%
*-commutative67.0%
Simplified67.0%
Taylor expanded in x around 0 42.7%
Final simplification43.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* t (- z y)))))
(if (<= t -1.12e-160)
t_1
(if (<= t 9e-284)
(* x (- 1.0 y))
(if (<= t 8.5e-39) (+ x (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x - (t * (z - y));
double tmp;
if (t <= -1.12e-160) {
tmp = t_1;
} else if (t <= 9e-284) {
tmp = x * (1.0 - y);
} else if (t <= 8.5e-39) {
tmp = x + (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 = x - (t * (z - y))
if (t <= (-1.12d-160)) then
tmp = t_1
else if (t <= 9d-284) then
tmp = x * (1.0d0 - y)
else if (t <= 8.5d-39) then
tmp = x + (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 = x - (t * (z - y));
double tmp;
if (t <= -1.12e-160) {
tmp = t_1;
} else if (t <= 9e-284) {
tmp = x * (1.0 - y);
} else if (t <= 8.5e-39) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (t * (z - y)) tmp = 0 if t <= -1.12e-160: tmp = t_1 elif t <= 9e-284: tmp = x * (1.0 - y) elif t <= 8.5e-39: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(t * Float64(z - y))) tmp = 0.0 if (t <= -1.12e-160) tmp = t_1; elseif (t <= 9e-284) tmp = Float64(x * Float64(1.0 - y)); elseif (t <= 8.5e-39) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (t * (z - y)); tmp = 0.0; if (t <= -1.12e-160) tmp = t_1; elseif (t <= 9e-284) tmp = x * (1.0 - y); elseif (t <= 8.5e-39) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.12e-160], t$95$1, If[LessEqual[t, 9e-284], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-39], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - t \cdot \left(z - y\right)\\
\mathbf{if}\;t \leq -1.12 \cdot 10^{-160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-284}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-39}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.11999999999999997e-160 or 8.5000000000000005e-39 < t Initial program 100.0%
Taylor expanded in t around inf 83.0%
if -1.11999999999999997e-160 < t < 8.9999999999999999e-284Initial program 100.0%
Taylor expanded in t around 0 97.4%
mul-1-neg97.4%
distribute-rgt-neg-in97.4%
neg-sub097.4%
sub-neg97.4%
+-commutative97.4%
associate--r+97.4%
neg-sub097.4%
remove-double-neg97.4%
Simplified97.4%
Taylor expanded in z around 0 73.4%
*-rgt-identity73.4%
mul-1-neg73.4%
distribute-rgt-neg-out73.4%
neg-mul-173.4%
distribute-lft-in73.4%
neg-mul-173.4%
unsub-neg73.4%
Simplified73.4%
if 8.9999999999999999e-284 < t < 8.5000000000000005e-39Initial program 100.0%
Taylor expanded in t around 0 84.5%
mul-1-neg84.5%
distribute-rgt-neg-in84.5%
neg-sub084.5%
sub-neg84.5%
+-commutative84.5%
associate--r+84.5%
neg-sub084.5%
remove-double-neg84.5%
Simplified84.5%
Taylor expanded in y around 0 63.0%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))))
(if (<= y -0.04)
t_1
(if (<= y 9e-16) (+ x (* x z)) (if (<= y 6.8e+171) (* y t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (y <= -0.04) {
tmp = t_1;
} else if (y <= 9e-16) {
tmp = x + (x * z);
} else if (y <= 6.8e+171) {
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 * (1.0d0 - y)
if (y <= (-0.04d0)) then
tmp = t_1
else if (y <= 9d-16) then
tmp = x + (x * z)
else if (y <= 6.8d+171) 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 * (1.0 - y);
double tmp;
if (y <= -0.04) {
tmp = t_1;
} else if (y <= 9e-16) {
tmp = x + (x * z);
} else if (y <= 6.8e+171) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) tmp = 0 if y <= -0.04: tmp = t_1 elif y <= 9e-16: tmp = x + (x * z) elif y <= 6.8e+171: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (y <= -0.04) tmp = t_1; elseif (y <= 9e-16) tmp = Float64(x + Float64(x * z)); elseif (y <= 6.8e+171) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); tmp = 0.0; if (y <= -0.04) tmp = t_1; elseif (y <= 9e-16) tmp = x + (x * z); elseif (y <= 6.8e+171) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.04], t$95$1, If[LessEqual[y, 9e-16], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e+171], N[(y * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;y \leq -0.04:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-16}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+171}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -0.0400000000000000008 or 6.8000000000000003e171 < y Initial program 100.0%
Taylor expanded in t around 0 54.8%
mul-1-neg54.8%
distribute-rgt-neg-in54.8%
neg-sub054.8%
sub-neg54.8%
+-commutative54.8%
associate--r+54.8%
neg-sub054.8%
remove-double-neg54.8%
Simplified54.8%
Taylor expanded in z around 0 51.1%
*-rgt-identity51.1%
mul-1-neg51.1%
distribute-rgt-neg-out51.1%
neg-mul-151.1%
distribute-lft-in51.1%
neg-mul-151.1%
unsub-neg51.1%
Simplified51.1%
if -0.0400000000000000008 < y < 9.0000000000000003e-16Initial program 100.0%
Taylor expanded in t around 0 60.3%
mul-1-neg60.3%
distribute-rgt-neg-in60.3%
neg-sub060.3%
sub-neg60.3%
+-commutative60.3%
associate--r+60.3%
neg-sub060.3%
remove-double-neg60.3%
Simplified60.3%
Taylor expanded in y around 0 59.7%
if 9.0000000000000003e-16 < y < 6.8000000000000003e171Initial program 99.9%
Taylor expanded in y around inf 59.8%
*-commutative59.8%
Simplified59.8%
Taylor expanded in t around inf 44.9%
*-commutative44.9%
Simplified44.9%
Taylor expanded in x around 0 45.1%
Final simplification55.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -22000000000000.0)
(* x z)
(if (<= z 2e-84)
(+ x (* y t))
(if (<= z 6.5) (* x (- 1.0 y)) (+ x (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -22000000000000.0) {
tmp = x * z;
} else if (z <= 2e-84) {
tmp = x + (y * t);
} else if (z <= 6.5) {
tmp = x * (1.0 - y);
} 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 (z <= (-22000000000000.0d0)) then
tmp = x * z
else if (z <= 2d-84) then
tmp = x + (y * t)
else if (z <= 6.5d0) then
tmp = x * (1.0d0 - y)
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 (z <= -22000000000000.0) {
tmp = x * z;
} else if (z <= 2e-84) {
tmp = x + (y * t);
} else if (z <= 6.5) {
tmp = x * (1.0 - y);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -22000000000000.0: tmp = x * z elif z <= 2e-84: tmp = x + (y * t) elif z <= 6.5: tmp = x * (1.0 - y) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -22000000000000.0) tmp = Float64(x * z); elseif (z <= 2e-84) tmp = Float64(x + Float64(y * t)); elseif (z <= 6.5) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -22000000000000.0) tmp = x * z; elseif (z <= 2e-84) tmp = x + (y * t); elseif (z <= 6.5) tmp = x * (1.0 - y); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -22000000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 2e-84], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -22000000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-84}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 6.5:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if z < -2.2e13Initial program 99.9%
Taylor expanded in t around 0 52.8%
mul-1-neg52.8%
distribute-rgt-neg-in52.8%
neg-sub052.8%
sub-neg52.8%
+-commutative52.8%
associate--r+52.8%
neg-sub052.8%
remove-double-neg52.8%
Simplified52.8%
sub-neg52.8%
distribute-rgt-in46.4%
Applied egg-rr46.4%
associate-+r+46.4%
distribute-lft-neg-out46.4%
unsub-neg46.4%
distribute-rgt1-in46.4%
*-commutative46.4%
Applied egg-rr46.4%
Taylor expanded in z around inf 45.6%
*-commutative45.6%
Simplified45.6%
if -2.2e13 < z < 2.0000000000000001e-84Initial program 100.0%
Taylor expanded in y around inf 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around inf 76.6%
*-commutative76.6%
Simplified76.6%
if 2.0000000000000001e-84 < z < 6.5Initial program 99.9%
Taylor expanded in t around 0 80.3%
mul-1-neg80.3%
distribute-rgt-neg-in80.3%
neg-sub080.3%
sub-neg80.3%
+-commutative80.3%
associate--r+80.3%
neg-sub080.3%
remove-double-neg80.3%
Simplified80.3%
Taylor expanded in z around 0 80.3%
*-rgt-identity80.3%
mul-1-neg80.3%
distribute-rgt-neg-out80.3%
neg-mul-180.3%
distribute-lft-in80.3%
neg-mul-180.3%
unsub-neg80.3%
Simplified80.3%
if 6.5 < z Initial program 100.0%
Taylor expanded in t around 0 45.1%
mul-1-neg45.1%
distribute-rgt-neg-in45.1%
neg-sub045.1%
sub-neg45.1%
+-commutative45.1%
associate--r+45.1%
neg-sub045.1%
remove-double-neg45.1%
Simplified45.1%
Taylor expanded in y around 0 39.9%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.00055) (not (<= t 1.5e+70))) (- x (* t (- z y))) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.00055) || !(t <= 1.5e+70)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (z - 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 ((t <= (-0.00055d0)) .or. (.not. (t <= 1.5d+70))) then
tmp = x - (t * (z - y))
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.00055) || !(t <= 1.5e+70)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -0.00055) or not (t <= 1.5e+70): tmp = x - (t * (z - y)) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -0.00055) || !(t <= 1.5e+70)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -0.00055) || ~((t <= 1.5e+70))) tmp = x - (t * (z - y)); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -0.00055], N[Not[LessEqual[t, 1.5e+70]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00055 \lor \neg \left(t \leq 1.5 \cdot 10^{+70}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -5.50000000000000033e-4 or 1.49999999999999988e70 < t Initial program 100.0%
Taylor expanded in t around inf 91.0%
if -5.50000000000000033e-4 < t < 1.49999999999999988e70Initial program 100.0%
Taylor expanded in t around 0 83.9%
mul-1-neg83.9%
distribute-rgt-neg-in83.9%
neg-sub083.9%
sub-neg83.9%
+-commutative83.9%
associate--r+83.9%
neg-sub083.9%
remove-double-neg83.9%
Simplified83.9%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e-15) (not (<= z 1.6e-8))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e-15) || !(z <= 1.6e-8)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - 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 ((z <= (-2.4d-15)) .or. (.not. (z <= 1.6d-8))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e-15) || !(z <= 1.6e-8)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.4e-15) or not (z <= 1.6e-8): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.4e-15) || !(z <= 1.6e-8)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.4e-15) || ~((z <= 1.6e-8))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.4e-15], N[Not[LessEqual[z, 1.6e-8]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-15} \lor \neg \left(z \leq 1.6 \cdot 10^{-8}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -2.39999999999999995e-15 or 1.6000000000000001e-8 < z Initial program 100.0%
Taylor expanded in y around 0 85.7%
mul-1-neg85.7%
unsub-neg85.7%
Simplified85.7%
if -2.39999999999999995e-15 < z < 1.6000000000000001e-8Initial program 100.0%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.8e+16) (not (<= z 10.2))) (* x z) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+16) || !(z <= 10.2)) {
tmp = x * z;
} else {
tmp = x * (1.0 - 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 <= (-7.8d+16)) .or. (.not. (z <= 10.2d0))) then
tmp = x * z
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.8e+16) || !(z <= 10.2)) {
tmp = x * z;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.8e+16) or not (z <= 10.2): tmp = x * z else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.8e+16) || !(z <= 10.2)) tmp = Float64(x * z); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.8e+16) || ~((z <= 10.2))) tmp = x * z; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.8e+16], N[Not[LessEqual[z, 10.2]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+16} \lor \neg \left(z \leq 10.2\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -7.8e16 or 10.199999999999999 < z Initial program 100.0%
Taylor expanded in t around 0 48.2%
mul-1-neg48.2%
distribute-rgt-neg-in48.2%
neg-sub048.2%
sub-neg48.2%
+-commutative48.2%
associate--r+48.2%
neg-sub048.2%
remove-double-neg48.2%
Simplified48.2%
sub-neg48.2%
distribute-rgt-in44.0%
Applied egg-rr44.0%
associate-+r+44.0%
distribute-lft-neg-out44.0%
unsub-neg44.0%
distribute-rgt1-in44.0%
*-commutative44.0%
Applied egg-rr44.0%
Taylor expanded in z around inf 42.5%
*-commutative42.5%
Simplified42.5%
if -7.8e16 < z < 10.199999999999999Initial program 100.0%
Taylor expanded in t around 0 61.6%
mul-1-neg61.6%
distribute-rgt-neg-in61.6%
neg-sub061.6%
sub-neg61.6%
+-commutative61.6%
associate--r+61.6%
neg-sub061.6%
remove-double-neg61.6%
Simplified61.6%
Taylor expanded in z around 0 61.0%
*-rgt-identity61.0%
mul-1-neg61.0%
distribute-rgt-neg-out61.0%
neg-mul-161.0%
distribute-lft-in61.0%
neg-mul-161.0%
unsub-neg61.0%
Simplified61.0%
Final simplification52.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.12e-33) (not (<= t 9.4e+95))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.12e-33) || !(t <= 9.4e+95)) {
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 ((t <= (-1.12d-33)) .or. (.not. (t <= 9.4d+95))) 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 ((t <= -1.12e-33) || !(t <= 9.4e+95)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.12e-33) or not (t <= 9.4e+95): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.12e-33) || !(t <= 9.4e+95)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.12e-33) || ~((t <= 9.4e+95))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.12e-33], N[Not[LessEqual[t, 9.4e+95]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{-33} \lor \neg \left(t \leq 9.4 \cdot 10^{+95}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.11999999999999999e-33 or 9.39999999999999945e95 < t Initial program 100.0%
Taylor expanded in y around inf 56.2%
*-commutative56.2%
Simplified56.2%
Taylor expanded in t around inf 50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in x around 0 42.2%
if -1.11999999999999999e-33 < t < 9.39999999999999945e95Initial program 100.0%
Taylor expanded in y around inf 59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in y around 0 32.3%
Final simplification37.0%
(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 y around inf 58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in y around 0 21.2%
Final simplification21.2%
(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 2024115
(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))))