
(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 13 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
(let* ((t_1 (* z (- t))))
(if (<= z -1.9e-56)
t_1
(if (<= z -3.6e-258)
(* x (- 1.0 y))
(if (<= z 2400000000000.0)
(+ x (* y t))
(if (<= z 4.9e+58) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.9e-56) {
tmp = t_1;
} else if (z <= -3.6e-258) {
tmp = x * (1.0 - y);
} else if (z <= 2400000000000.0) {
tmp = x + (y * t);
} else if (z <= 4.9e+58) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-1.9d-56)) then
tmp = t_1
else if (z <= (-3.6d-258)) then
tmp = x * (1.0d0 - y)
else if (z <= 2400000000000.0d0) then
tmp = x + (y * t)
else if (z <= 4.9d+58) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.9e-56) {
tmp = t_1;
} else if (z <= -3.6e-258) {
tmp = x * (1.0 - y);
} else if (z <= 2400000000000.0) {
tmp = x + (y * t);
} else if (z <= 4.9e+58) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.9e-56: tmp = t_1 elif z <= -3.6e-258: tmp = x * (1.0 - y) elif z <= 2400000000000.0: tmp = x + (y * t) elif z <= 4.9e+58: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.9e-56) tmp = t_1; elseif (z <= -3.6e-258) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 2400000000000.0) tmp = Float64(x + Float64(y * t)); elseif (z <= 4.9e+58) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.9e-56) tmp = t_1; elseif (z <= -3.6e-258) tmp = x * (1.0 - y); elseif (z <= 2400000000000.0) tmp = x + (y * t); elseif (z <= 4.9e+58) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.9e-56], t$95$1, If[LessEqual[z, -3.6e-258], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2400000000000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+58], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-258}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 2400000000000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.9000000000000001e-56 or 2.4e12 < z < 4.90000000000000018e58Initial program 99.9%
Taylor expanded in y around 0 76.2%
mul-1-neg76.2%
unsub-neg76.2%
Simplified76.2%
Taylor expanded in t around inf 52.7%
Taylor expanded in x around 0 50.7%
mul-1-neg50.7%
distribute-rgt-neg-out50.7%
Simplified50.7%
if -1.9000000000000001e-56 < z < -3.59999999999999979e-258Initial program 100.0%
Taylor expanded in x around inf 84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
Taylor expanded in z around 0 84.8%
if -3.59999999999999979e-258 < z < 2.4e12Initial program 100.0%
Taylor expanded in t around inf 80.6%
Taylor expanded in y around inf 70.7%
if 4.90000000000000018e58 < z Initial program 100.0%
Taylor expanded in x around inf 57.3%
mul-1-neg57.3%
unsub-neg57.3%
Simplified57.3%
Taylor expanded in z around inf 48.7%
Final simplification62.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= y -21.0)
t_1
(if (<= y 1.4e-9) (* x (+ z 1.0)) (if (<= y 8.2e+101) (* z (- t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -21.0) {
tmp = t_1;
} else if (y <= 1.4e-9) {
tmp = x * (z + 1.0);
} else if (y <= 8.2e+101) {
tmp = 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 = y * -x
if (y <= (-21.0d0)) then
tmp = t_1
else if (y <= 1.4d-9) then
tmp = x * (z + 1.0d0)
else if (y <= 8.2d+101) then
tmp = 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 = y * -x;
double tmp;
if (y <= -21.0) {
tmp = t_1;
} else if (y <= 1.4e-9) {
tmp = x * (z + 1.0);
} else if (y <= 8.2e+101) {
tmp = z * -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if y <= -21.0: tmp = t_1 elif y <= 1.4e-9: tmp = x * (z + 1.0) elif y <= 8.2e+101: tmp = z * -t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (y <= -21.0) tmp = t_1; elseif (y <= 1.4e-9) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 8.2e+101) tmp = Float64(z * Float64(-t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (y <= -21.0) tmp = t_1; elseif (y <= 1.4e-9) tmp = x * (z + 1.0); elseif (y <= 8.2e+101) tmp = z * -t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -21.0], t$95$1, If[LessEqual[y, 1.4e-9], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+101], N[(z * (-t)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -21:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+101}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -21 or 8.1999999999999999e101 < y Initial program 100.0%
Taylor expanded in x around inf 57.9%
mul-1-neg57.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in y around inf 47.0%
mul-1-neg47.0%
Simplified47.0%
if -21 < y < 1.39999999999999992e-9Initial program 100.0%
Taylor expanded in x around inf 59.5%
mul-1-neg59.5%
unsub-neg59.5%
Simplified59.5%
Taylor expanded in y around 0 59.5%
+-commutative59.5%
Simplified59.5%
if 1.39999999999999992e-9 < y < 8.1999999999999999e101Initial program 100.0%
Taylor expanded in y around 0 73.0%
mul-1-neg73.0%
unsub-neg73.0%
Simplified73.0%
Taylor expanded in t around inf 55.7%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
distribute-rgt-neg-out55.9%
Simplified55.9%
Final simplification53.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1.9e-56)
t_1
(if (<= z 1.6e-32) x (if (<= z 4.3e+58) t_1 (* z x))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.9e-56) {
tmp = t_1;
} else if (z <= 1.6e-32) {
tmp = x;
} else if (z <= 4.3e+58) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-1.9d-56)) then
tmp = t_1
else if (z <= 1.6d-32) then
tmp = x
else if (z <= 4.3d+58) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.9e-56) {
tmp = t_1;
} else if (z <= 1.6e-32) {
tmp = x;
} else if (z <= 4.3e+58) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.9e-56: tmp = t_1 elif z <= 1.6e-32: tmp = x elif z <= 4.3e+58: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.9e-56) tmp = t_1; elseif (z <= 1.6e-32) tmp = x; elseif (z <= 4.3e+58) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.9e-56) tmp = t_1; elseif (z <= 1.6e-32) tmp = x; elseif (z <= 4.3e+58) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.9e-56], t$95$1, If[LessEqual[z, 1.6e-32], x, If[LessEqual[z, 4.3e+58], t$95$1, N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.9000000000000001e-56 or 1.6000000000000001e-32 < z < 4.29999999999999991e58Initial program 100.0%
Taylor expanded in y around 0 73.7%
mul-1-neg73.7%
unsub-neg73.7%
Simplified73.7%
Taylor expanded in t around inf 51.6%
Taylor expanded in x around 0 49.8%
mul-1-neg49.8%
distribute-rgt-neg-out49.8%
Simplified49.8%
if -1.9000000000000001e-56 < z < 1.6000000000000001e-32Initial program 100.0%
Taylor expanded in y around inf 94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in y around 0 41.9%
if 4.29999999999999991e58 < z Initial program 100.0%
Taylor expanded in x around inf 57.3%
mul-1-neg57.3%
unsub-neg57.3%
Simplified57.3%
Taylor expanded in z around inf 48.7%
Final simplification46.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -29.0) (not (<= y 2.55e+98))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -29.0) || !(y <= 2.55e+98)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (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 ((y <= (-29.0d0)) .or. (.not. (y <= 2.55d+98))) then
tmp = x + (y * (t - x))
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -29.0) || !(y <= 2.55e+98)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -29.0) or not (y <= 2.55e+98): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -29.0) || !(y <= 2.55e+98)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -29.0) || ~((y <= 2.55e+98))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -29.0], N[Not[LessEqual[y, 2.55e+98]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -29 \lor \neg \left(y \leq 2.55 \cdot 10^{+98}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -29 or 2.54999999999999994e98 < y Initial program 100.0%
Taylor expanded in y around inf 79.4%
*-commutative79.4%
Simplified79.4%
if -29 < y < 2.54999999999999994e98Initial program 100.0%
Taylor expanded in y around 0 90.3%
mul-1-neg90.3%
unsub-neg90.3%
Simplified90.3%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -32.0) (not (<= x 350000000.0))) (* x (+ (- z y) 1.0)) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -32.0) || !(x <= 350000000.0)) {
tmp = x * ((z - y) + 1.0);
} 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 <= (-32.0d0)) .or. (.not. (x <= 350000000.0d0))) then
tmp = x * ((z - y) + 1.0d0)
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 <= -32.0) || !(x <= 350000000.0)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -32.0) or not (x <= 350000000.0): tmp = x * ((z - y) + 1.0) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -32.0) || !(x <= 350000000.0)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); 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 <= -32.0) || ~((x <= 350000000.0))) tmp = x * ((z - y) + 1.0); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -32.0], N[Not[LessEqual[x, 350000000.0]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -32 \lor \neg \left(x \leq 350000000\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -32 or 3.5e8 < x Initial program 100.0%
Taylor expanded in x around inf 83.9%
mul-1-neg83.9%
unsub-neg83.9%
Simplified83.9%
if -32 < x < 3.5e8Initial program 100.0%
Taylor expanded in t around inf 87.5%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -25.0) (not (<= y 2.55e+98))) (+ x (* y (- t x))) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -25.0) || !(y <= 2.55e+98)) {
tmp = x + (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 <= (-25.0d0)) .or. (.not. (y <= 2.55d+98))) then
tmp = x + (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 <= -25.0) || !(y <= 2.55e+98)) {
tmp = x + (y * (t - x));
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -25.0) or not (y <= 2.55e+98): tmp = x + (y * (t - x)) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -25.0) || !(y <= 2.55e+98)) tmp = Float64(x + 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 <= -25.0) || ~((y <= 2.55e+98))) tmp = x + (y * (t - x)); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -25.0], N[Not[LessEqual[y, 2.55e+98]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -25 \lor \neg \left(y \leq 2.55 \cdot 10^{+98}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -25 or 2.54999999999999994e98 < y Initial program 100.0%
Taylor expanded in y around inf 79.4%
*-commutative79.4%
Simplified79.4%
if -25 < y < 2.54999999999999994e98Initial program 100.0%
Taylor expanded in y around 0 90.3%
mul-1-neg90.3%
unsub-neg90.3%
Simplified90.3%
Taylor expanded in t around inf 71.2%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.7e-53) (not (<= x 2.3e-43))) (* x (+ (- z y) 1.0)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.7e-53) || !(x <= 2.3e-43)) {
tmp = x * ((z - y) + 1.0);
} 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 ((x <= (-3.7d-53)) .or. (.not. (x <= 2.3d-43))) then
tmp = x * ((z - y) + 1.0d0)
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 ((x <= -3.7e-53) || !(x <= 2.3e-43)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.7e-53) or not (x <= 2.3e-43): tmp = x * ((z - y) + 1.0) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.7e-53) || !(x <= 2.3e-43)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.7e-53) || ~((x <= 2.3e-43))) tmp = x * ((z - y) + 1.0); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.7e-53], N[Not[LessEqual[x, 2.3e-43]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-53} \lor \neg \left(x \leq 2.3 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if x < -3.69999999999999982e-53 or 2.2999999999999999e-43 < x Initial program 100.0%
Taylor expanded in x around inf 80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
if -3.69999999999999982e-53 < x < 2.2999999999999999e-43Initial program 100.0%
Taylor expanded in y around 0 65.0%
mul-1-neg65.0%
unsub-neg65.0%
Simplified65.0%
Taylor expanded in t around inf 61.1%
Final simplification72.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.4e+81) (not (<= y 2.05e+101))) (* y (- x)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.4e+81) || !(y <= 2.05e+101)) {
tmp = y * -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 <= (-4.4d+81)) .or. (.not. (y <= 2.05d+101))) then
tmp = y * -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 <= -4.4e+81) || !(y <= 2.05e+101)) {
tmp = y * -x;
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.4e+81) or not (y <= 2.05e+101): tmp = y * -x else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.4e+81) || !(y <= 2.05e+101)) tmp = Float64(y * Float64(-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 <= -4.4e+81) || ~((y <= 2.05e+101))) tmp = y * -x; else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.4e+81], N[Not[LessEqual[y, 2.05e+101]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+81} \lor \neg \left(y \leq 2.05 \cdot 10^{+101}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -4.39999999999999974e81 or 2.05e101 < y Initial program 100.0%
Taylor expanded in x around inf 61.7%
mul-1-neg61.7%
unsub-neg61.7%
Simplified61.7%
Taylor expanded in y around inf 49.9%
mul-1-neg49.9%
Simplified49.9%
if -4.39999999999999974e81 < y < 2.05e101Initial program 100.0%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
Taylor expanded in t around inf 67.9%
Final simplification61.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e-56) (* z (- t)) (if (<= z 3.4e+67) (* x (- 1.0 y)) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e-56) {
tmp = z * -t;
} else if (z <= 3.4e+67) {
tmp = x * (1.0 - y);
} else {
tmp = 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 (z <= (-1.9d-56)) then
tmp = z * -t
else if (z <= 3.4d+67) then
tmp = x * (1.0d0 - y)
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e-56) {
tmp = z * -t;
} else if (z <= 3.4e+67) {
tmp = x * (1.0 - y);
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.9e-56: tmp = z * -t elif z <= 3.4e+67: tmp = x * (1.0 - y) else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e-56) tmp = Float64(z * Float64(-t)); elseif (z <= 3.4e+67) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.9e-56) tmp = z * -t; elseif (z <= 3.4e+67) tmp = x * (1.0 - y); else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e-56], N[(z * (-t)), $MachinePrecision], If[LessEqual[z, 3.4e+67], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-56}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.9000000000000001e-56Initial program 99.9%
Taylor expanded in y around 0 80.3%
mul-1-neg80.3%
unsub-neg80.3%
Simplified80.3%
Taylor expanded in t around inf 53.4%
Taylor expanded in x around 0 51.1%
mul-1-neg51.1%
distribute-rgt-neg-out51.1%
Simplified51.1%
if -1.9000000000000001e-56 < z < 3.4000000000000002e67Initial program 100.0%
Taylor expanded in x around inf 64.3%
mul-1-neg64.3%
unsub-neg64.3%
Simplified64.3%
Taylor expanded in z around 0 62.9%
if 3.4000000000000002e67 < z Initial program 100.0%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
unsub-neg54.3%
Simplified54.3%
Taylor expanded in z around inf 49.7%
Final simplification57.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.54) (not (<= z 19000000000000.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.54) || !(z <= 19000000000000.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 <= (-0.54d0)) .or. (.not. (z <= 19000000000000.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 <= -0.54) || !(z <= 19000000000000.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.54) or not (z <= 19000000000000.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.54) || !(z <= 19000000000000.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 <= -0.54) || ~((z <= 19000000000000.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.54], N[Not[LessEqual[z, 19000000000000.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 19000000000000\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.54000000000000004 or 1.9e13 < z Initial program 99.9%
Taylor expanded in x around inf 50.6%
mul-1-neg50.6%
unsub-neg50.6%
Simplified50.6%
Taylor expanded in z around inf 38.4%
if -0.54000000000000004 < z < 1.9e13Initial program 100.0%
Taylor expanded in y around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around 0 37.0%
Final simplification37.7%
(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 59.4%
*-commutative59.4%
Simplified59.4%
Taylor expanded in y around 0 20.3%
(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 2024132
(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))))