
(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 14 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 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e-54) (* y t) (if (<= t -5e-169) (* z x) (if (<= t 13.5) (* y (- x)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e-54) {
tmp = y * t;
} else if (t <= -5e-169) {
tmp = z * x;
} else if (t <= 13.5) {
tmp = y * -x;
} 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 (t <= (-1.8d-54)) then
tmp = y * t
else if (t <= (-5d-169)) then
tmp = z * x
else if (t <= 13.5d0) then
tmp = y * -x
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 (t <= -1.8e-54) {
tmp = y * t;
} else if (t <= -5e-169) {
tmp = z * x;
} else if (t <= 13.5) {
tmp = y * -x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e-54: tmp = y * t elif t <= -5e-169: tmp = z * x elif t <= 13.5: tmp = y * -x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e-54) tmp = Float64(y * t); elseif (t <= -5e-169) tmp = Float64(z * x); elseif (t <= 13.5) tmp = Float64(y * Float64(-x)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.8e-54) tmp = y * t; elseif (t <= -5e-169) tmp = z * x; elseif (t <= 13.5) tmp = y * -x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e-54], N[(y * t), $MachinePrecision], If[LessEqual[t, -5e-169], N[(z * x), $MachinePrecision], If[LessEqual[t, 13.5], N[(y * (-x)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-54}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-169}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;t \leq 13.5:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -1.79999999999999988e-54 or 13.5 < t Initial program 100.0%
Taylor expanded in y around inf 77.7%
associate--l+77.7%
+-commutative77.7%
mul-1-neg77.7%
unsub-neg77.7%
div-sub79.3%
unsub-neg79.3%
mul-1-neg79.3%
mul-1-neg79.3%
distribute-rgt-neg-in79.3%
sub-neg79.3%
+-commutative79.3%
distribute-neg-in79.3%
remove-double-neg79.3%
sub-neg79.3%
Simplified79.3%
Taylor expanded in z around 0 48.3%
Taylor expanded in t around inf 41.6%
*-commutative41.6%
Simplified41.6%
if -1.79999999999999988e-54 < t < -5.0000000000000002e-169Initial program 100.0%
Taylor expanded in t around 0 74.9%
mul-1-neg74.9%
distribute-rgt-neg-in74.9%
sub-neg74.9%
+-commutative74.9%
distribute-neg-in74.9%
remove-double-neg74.9%
sub-neg74.9%
Simplified74.9%
Taylor expanded in z around inf 49.8%
Taylor expanded in z around inf 45.8%
if -5.0000000000000002e-169 < t < 13.5Initial program 100.0%
Taylor expanded in y around inf 89.2%
associate--l+89.2%
+-commutative89.2%
mul-1-neg89.2%
unsub-neg89.2%
div-sub90.3%
unsub-neg90.3%
mul-1-neg90.3%
mul-1-neg90.3%
distribute-rgt-neg-in90.3%
sub-neg90.3%
+-commutative90.3%
distribute-neg-in90.3%
remove-double-neg90.3%
sub-neg90.3%
Simplified90.3%
Taylor expanded in y around inf 50.9%
Taylor expanded in t around 0 43.6%
neg-mul-143.6%
Simplified43.6%
Final simplification42.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.7e-56) (not (<= t 180000000.0))) (+ x (* (- y z) t)) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.7e-56) || !(t <= 180000000.0)) {
tmp = x + ((y - z) * t);
} 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 <= (-3.7d-56)) .or. (.not. (t <= 180000000.0d0))) then
tmp = x + ((y - z) * t)
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 <= -3.7e-56) || !(t <= 180000000.0)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.7e-56) or not (t <= 180000000.0): tmp = x + ((y - z) * t) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.7e-56) || !(t <= 180000000.0)) tmp = Float64(x + Float64(Float64(y - z) * t)); 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 <= -3.7e-56) || ~((t <= 180000000.0))) tmp = x + ((y - z) * t); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.7e-56], N[Not[LessEqual[t, 180000000.0]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{-56} \lor \neg \left(t \leq 180000000\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -3.7000000000000002e-56 or 1.8e8 < t Initial program 100.0%
Taylor expanded in t around inf 91.8%
if -3.7000000000000002e-56 < t < 1.8e8Initial program 100.0%
Taylor expanded in t around 0 84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
sub-neg84.2%
+-commutative84.2%
distribute-neg-in84.2%
remove-double-neg84.2%
sub-neg84.2%
Simplified84.2%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (- t x)))) (if (<= y -6.9e+44) t_1 (if (<= y 5.1e-53) (- x (* z t)) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -6.9e+44) {
tmp = t_1;
} else if (y <= 5.1e-53) {
tmp = x - (z * t);
} else {
tmp = x + 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 = y * (t - x)
if (y <= (-6.9d+44)) then
tmp = t_1
else if (y <= 5.1d-53) then
tmp = x - (z * t)
else
tmp = x + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -6.9e+44) {
tmp = t_1;
} else if (y <= 5.1e-53) {
tmp = x - (z * t);
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -6.9e+44: tmp = t_1 elif y <= 5.1e-53: tmp = x - (z * t) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -6.9e+44) tmp = t_1; elseif (y <= 5.1e-53) tmp = Float64(x - Float64(z * t)); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -6.9e+44) tmp = t_1; elseif (y <= 5.1e-53) tmp = x - (z * t); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.9e+44], t$95$1, If[LessEqual[y, 5.1e-53], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -6.9 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{-53}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if y < -6.8999999999999997e44Initial program 100.0%
Taylor expanded in y around inf 96.9%
associate--l+96.9%
+-commutative96.9%
mul-1-neg96.9%
unsub-neg96.9%
div-sub96.9%
unsub-neg96.9%
mul-1-neg96.9%
mul-1-neg96.9%
distribute-rgt-neg-in96.9%
sub-neg96.9%
+-commutative96.9%
distribute-neg-in96.9%
remove-double-neg96.9%
sub-neg96.9%
Simplified96.9%
Taylor expanded in y around inf 88.5%
if -6.8999999999999997e44 < y < 5.10000000000000045e-53Initial program 100.0%
Taylor expanded in y around 0 91.3%
mul-1-neg91.3%
unsub-neg91.3%
Simplified91.3%
Taylor expanded in t around inf 68.0%
if 5.10000000000000045e-53 < y Initial program 100.0%
Taylor expanded in y around inf 64.6%
*-commutative64.6%
Simplified64.6%
Final simplification72.2%
(FPCore (x y z t) :precision binary64 (if (<= t -7e-55) (- x (* z t)) (if (<= t 580000000.0) (+ x (* x (- z y))) (+ x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-55) {
tmp = x - (z * t);
} else if (t <= 580000000.0) {
tmp = x + (x * (z - y));
} else {
tmp = x + (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 (t <= (-7d-55)) then
tmp = x - (z * t)
else if (t <= 580000000.0d0) then
tmp = x + (x * (z - y))
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-55) {
tmp = x - (z * t);
} else if (t <= 580000000.0) {
tmp = x + (x * (z - y));
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e-55: tmp = x - (z * t) elif t <= 580000000.0: tmp = x + (x * (z - y)) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e-55) tmp = Float64(x - Float64(z * t)); elseif (t <= 580000000.0) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7e-55) tmp = x - (z * t); elseif (t <= 580000000.0) tmp = x + (x * (z - y)); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e-55], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 580000000.0], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-55}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;t \leq 580000000:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if t < -7.00000000000000051e-55Initial program 100.0%
Taylor expanded in y around 0 69.0%
mul-1-neg69.0%
unsub-neg69.0%
Simplified69.0%
Taylor expanded in t around inf 65.5%
if -7.00000000000000051e-55 < t < 5.8e8Initial program 100.0%
Taylor expanded in t around 0 84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
sub-neg84.2%
+-commutative84.2%
distribute-neg-in84.2%
remove-double-neg84.2%
sub-neg84.2%
Simplified84.2%
if 5.8e8 < t Initial program 100.0%
Taylor expanded in t around inf 90.7%
Taylor expanded in y around inf 56.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.2e+44) (not (<= y 2.25e+16))) (* y (- t x)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.2e+44) || !(y <= 2.25e+16)) {
tmp = y * (t - x);
} else {
tmp = x - (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 ((y <= (-8.2d+44)) .or. (.not. (y <= 2.25d+16))) then
tmp = y * (t - x)
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.2e+44) || !(y <= 2.25e+16)) {
tmp = y * (t - x);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.2e+44) or not (y <= 2.25e+16): tmp = y * (t - x) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.2e+44) || !(y <= 2.25e+16)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8.2e+44) || ~((y <= 2.25e+16))) tmp = y * (t - x); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.2e+44], N[Not[LessEqual[y, 2.25e+16]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+44} \lor \neg \left(y \leq 2.25 \cdot 10^{+16}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -8.1999999999999993e44 or 2.25e16 < y Initial program 100.0%
Taylor expanded in y around inf 97.6%
associate--l+97.6%
+-commutative97.6%
mul-1-neg97.6%
unsub-neg97.6%
div-sub97.6%
unsub-neg97.6%
mul-1-neg97.6%
mul-1-neg97.6%
distribute-rgt-neg-in97.6%
sub-neg97.6%
+-commutative97.6%
distribute-neg-in97.6%
remove-double-neg97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in y around inf 78.0%
if -8.1999999999999993e44 < y < 2.25e16Initial program 100.0%
Taylor expanded in y around 0 88.3%
mul-1-neg88.3%
unsub-neg88.3%
Simplified88.3%
Taylor expanded in t around inf 64.5%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3e+45) (not (<= y 2.2e-12))) (* y (- t x)) (+ x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e+45) || !(y <= 2.2e-12)) {
tmp = y * (t - x);
} else {
tmp = x + (z * 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 <= (-3d+45)) .or. (.not. (y <= 2.2d-12))) then
tmp = y * (t - x)
else
tmp = x + (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e+45) || !(y <= 2.2e-12)) {
tmp = y * (t - x);
} else {
tmp = x + (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3e+45) or not (y <= 2.2e-12): tmp = y * (t - x) else: tmp = x + (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3e+45) || !(y <= 2.2e-12)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3e+45) || ~((y <= 2.2e-12))) tmp = y * (t - x); else tmp = x + (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3e+45], N[Not[LessEqual[y, 2.2e-12]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+45} \lor \neg \left(y \leq 2.2 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot x\\
\end{array}
\end{array}
if y < -3.00000000000000011e45 or 2.19999999999999992e-12 < y Initial program 100.0%
Taylor expanded in y around inf 97.7%
associate--l+97.7%
+-commutative97.7%
mul-1-neg97.7%
unsub-neg97.7%
div-sub97.7%
unsub-neg97.7%
mul-1-neg97.7%
mul-1-neg97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
+-commutative97.7%
distribute-neg-in97.7%
remove-double-neg97.7%
sub-neg97.7%
Simplified97.7%
Taylor expanded in y around inf 76.8%
if -3.00000000000000011e45 < y < 2.19999999999999992e-12Initial program 100.0%
Taylor expanded in t around 0 52.5%
mul-1-neg52.5%
distribute-rgt-neg-in52.5%
sub-neg52.5%
+-commutative52.5%
distribute-neg-in52.5%
remove-double-neg52.5%
sub-neg52.5%
Simplified52.5%
Taylor expanded in z around inf 51.0%
Final simplification64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.6e+44) (not (<= y 2.3e-58))) (* y (- t x)) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.6e+44) || !(y <= 2.3e-58)) {
tmp = y * (t - x);
} else {
tmp = 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 ((y <= (-6.6d+44)) .or. (.not. (y <= 2.3d-58))) then
tmp = y * (t - x)
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.6e+44) || !(y <= 2.3e-58)) {
tmp = y * (t - x);
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.6e+44) or not (y <= 2.3e-58): tmp = y * (t - x) else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.6e+44) || !(y <= 2.3e-58)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.6e+44) || ~((y <= 2.3e-58))) tmp = y * (t - x); else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.6e+44], N[Not[LessEqual[y, 2.3e-58]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{+44} \lor \neg \left(y \leq 2.3 \cdot 10^{-58}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if y < -6.60000000000000027e44 or 2.2999999999999999e-58 < y Initial program 100.0%
Taylor expanded in y around inf 97.1%
associate--l+97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
div-sub97.8%
unsub-neg97.8%
mul-1-neg97.8%
mul-1-neg97.8%
distribute-rgt-neg-in97.8%
sub-neg97.8%
+-commutative97.8%
distribute-neg-in97.8%
remove-double-neg97.8%
sub-neg97.8%
Simplified97.8%
Taylor expanded in y around inf 73.3%
if -6.60000000000000027e44 < y < 2.2999999999999999e-58Initial program 100.0%
Taylor expanded in y around 0 91.3%
mul-1-neg91.3%
unsub-neg91.3%
Simplified91.3%
Taylor expanded in t around inf 68.0%
Taylor expanded in x around 0 46.6%
associate-*r*46.6%
neg-mul-146.6%
Simplified46.6%
Final simplification61.5%
(FPCore (x y z t) :precision binary64 (if (<= t -1.5e-111) (* z (- t)) (if (<= t 36000000.0) (* x (- 1.0 y)) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-111) {
tmp = z * -t;
} else if (t <= 36000000.0) {
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 (t <= (-1.5d-111)) then
tmp = z * -t
else if (t <= 36000000.0d0) 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 (t <= -1.5e-111) {
tmp = z * -t;
} else if (t <= 36000000.0) {
tmp = x * (1.0 - y);
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-111: tmp = z * -t elif t <= 36000000.0: tmp = x * (1.0 - y) else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-111) tmp = Float64(z * Float64(-t)); elseif (t <= 36000000.0) 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 (t <= -1.5e-111) tmp = z * -t; elseif (t <= 36000000.0) tmp = x * (1.0 - y); else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-111], N[(z * (-t)), $MachinePrecision], If[LessEqual[t, 36000000.0], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-111}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 36000000:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -1.50000000000000004e-111Initial program 100.0%
Taylor expanded in y around 0 71.1%
mul-1-neg71.1%
unsub-neg71.1%
Simplified71.1%
Taylor expanded in t around inf 63.4%
Taylor expanded in x around 0 54.3%
associate-*r*54.3%
neg-mul-154.3%
Simplified54.3%
if -1.50000000000000004e-111 < t < 3.6e7Initial program 100.0%
Taylor expanded in t around 0 86.3%
mul-1-neg86.3%
distribute-rgt-neg-in86.3%
sub-neg86.3%
+-commutative86.3%
distribute-neg-in86.3%
remove-double-neg86.3%
sub-neg86.3%
Simplified86.3%
Taylor expanded in z around 0 57.6%
*-rgt-identity57.6%
mul-1-neg57.6%
distribute-rgt-neg-in57.6%
distribute-lft-in57.6%
unsub-neg57.6%
Simplified57.6%
if 3.6e7 < t Initial program 100.0%
Taylor expanded in y around inf 76.9%
associate--l+76.9%
+-commutative76.9%
mul-1-neg76.9%
unsub-neg76.9%
div-sub80.3%
unsub-neg80.3%
mul-1-neg80.3%
mul-1-neg80.3%
distribute-rgt-neg-in80.3%
sub-neg80.3%
+-commutative80.3%
distribute-neg-in80.3%
remove-double-neg80.3%
sub-neg80.3%
Simplified80.3%
Taylor expanded in z around 0 52.7%
Taylor expanded in t around inf 48.8%
*-commutative48.8%
Simplified48.8%
Final simplification54.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.3e-111) (* z (- t)) (if (<= t 10.0) (* y (- x)) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.3e-111) {
tmp = z * -t;
} else if (t <= 10.0) {
tmp = y * -x;
} 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 (t <= (-1.3d-111)) then
tmp = z * -t
else if (t <= 10.0d0) then
tmp = y * -x
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 (t <= -1.3e-111) {
tmp = z * -t;
} else if (t <= 10.0) {
tmp = y * -x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.3e-111: tmp = z * -t elif t <= 10.0: tmp = y * -x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.3e-111) tmp = Float64(z * Float64(-t)); elseif (t <= 10.0) tmp = Float64(y * Float64(-x)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.3e-111) tmp = z * -t; elseif (t <= 10.0) tmp = y * -x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.3e-111], N[(z * (-t)), $MachinePrecision], If[LessEqual[t, 10.0], N[(y * (-x)), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-111}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;t \leq 10:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -1.29999999999999991e-111Initial program 100.0%
Taylor expanded in y around 0 71.1%
mul-1-neg71.1%
unsub-neg71.1%
Simplified71.1%
Taylor expanded in t around inf 63.4%
Taylor expanded in x around 0 54.3%
associate-*r*54.3%
neg-mul-154.3%
Simplified54.3%
if -1.29999999999999991e-111 < t < 10Initial program 100.0%
Taylor expanded in y around inf 87.8%
associate--l+87.8%
+-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
div-sub90.8%
unsub-neg90.8%
mul-1-neg90.8%
mul-1-neg90.8%
distribute-rgt-neg-in90.8%
sub-neg90.8%
+-commutative90.8%
distribute-neg-in90.8%
remove-double-neg90.8%
sub-neg90.8%
Simplified90.8%
Taylor expanded in y around inf 50.9%
Taylor expanded in t around 0 42.7%
neg-mul-142.7%
Simplified42.7%
if 10 < t Initial program 100.0%
Taylor expanded in y around inf 76.9%
associate--l+76.9%
+-commutative76.9%
mul-1-neg76.9%
unsub-neg76.9%
div-sub80.3%
unsub-neg80.3%
mul-1-neg80.3%
mul-1-neg80.3%
distribute-rgt-neg-in80.3%
sub-neg80.3%
+-commutative80.3%
distribute-neg-in80.3%
remove-double-neg80.3%
sub-neg80.3%
Simplified80.3%
Taylor expanded in z around 0 52.7%
Taylor expanded in t around inf 48.8%
*-commutative48.8%
Simplified48.8%
Final simplification48.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.2e+100) (not (<= z 2.9e+77))) (* z x) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e+100) || !(z <= 2.9e+77)) {
tmp = z * x;
} 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 ((z <= (-6.2d+100)) .or. (.not. (z <= 2.9d+77))) then
tmp = z * x
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 ((z <= -6.2e+100) || !(z <= 2.9e+77)) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.2e+100) or not (z <= 2.9e+77): tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.2e+100) || !(z <= 2.9e+77)) tmp = Float64(z * x); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.2e+100) || ~((z <= 2.9e+77))) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.2e+100], N[Not[LessEqual[z, 2.9e+77]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+100} \lor \neg \left(z \leq 2.9 \cdot 10^{+77}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -6.20000000000000014e100 or 2.9000000000000002e77 < z Initial program 100.0%
Taylor expanded in t around 0 48.6%
mul-1-neg48.6%
distribute-rgt-neg-in48.6%
sub-neg48.6%
+-commutative48.6%
distribute-neg-in48.6%
remove-double-neg48.6%
sub-neg48.6%
Simplified48.6%
Taylor expanded in z around inf 44.0%
Taylor expanded in z around inf 44.0%
if -6.20000000000000014e100 < z < 2.9000000000000002e77Initial program 100.0%
Taylor expanded in y around inf 84.7%
associate--l+84.7%
+-commutative84.7%
mul-1-neg84.7%
unsub-neg84.7%
div-sub84.9%
unsub-neg84.9%
mul-1-neg84.9%
mul-1-neg84.9%
distribute-rgt-neg-in84.9%
sub-neg84.9%
+-commutative84.9%
distribute-neg-in84.9%
remove-double-neg84.9%
sub-neg84.9%
Simplified84.9%
Taylor expanded in z around 0 72.7%
Taylor expanded in t around inf 36.8%
*-commutative36.8%
Simplified36.8%
Final simplification39.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e-11) (not (<= z 1.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-11) || !(z <= 1.0)) {
tmp = z * x;
} 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 ((z <= (-1.8d-11)) .or. (.not. (z <= 1.0d0))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-11) || !(z <= 1.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e-11) or not (z <= 1.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e-11) || !(z <= 1.0)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e-11) || ~((z <= 1.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e-11], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-11} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.79999999999999992e-11 or 1 < z Initial program 100.0%
Taylor expanded in t around 0 49.9%
mul-1-neg49.9%
distribute-rgt-neg-in49.9%
sub-neg49.9%
+-commutative49.9%
distribute-neg-in49.9%
remove-double-neg49.9%
sub-neg49.9%
Simplified49.9%
Taylor expanded in z around inf 38.0%
Taylor expanded in z around inf 37.6%
if -1.79999999999999992e-11 < z < 1Initial program 100.0%
Taylor expanded in y around inf 86.5%
associate--l+86.5%
+-commutative86.5%
mul-1-neg86.5%
unsub-neg86.5%
div-sub86.7%
unsub-neg86.7%
mul-1-neg86.7%
mul-1-neg86.7%
distribute-rgt-neg-in86.7%
sub-neg86.7%
+-commutative86.7%
distribute-neg-in86.7%
remove-double-neg86.7%
sub-neg86.7%
Simplified86.7%
Taylor expanded in z around 0 78.5%
Taylor expanded in y around 0 25.1%
Final simplification31.8%
(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 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 81.7%
associate--l+81.7%
+-commutative81.7%
mul-1-neg81.7%
unsub-neg81.7%
div-sub84.2%
unsub-neg84.2%
mul-1-neg84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
sub-neg84.2%
+-commutative84.2%
distribute-neg-in84.2%
remove-double-neg84.2%
sub-neg84.2%
Simplified84.2%
Taylor expanded in z around 0 53.0%
Taylor expanded in y around 0 13.1%
(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 2024146
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))