
(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
(let* ((t_1 (* z (- t))))
(if (<= z -1.15e+119)
t_1
(if (<= z -5.2e-91)
(* y (- x))
(if (<= z 1.55e+48) (* y t) (if (<= z 3.3e+196) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.15e+119) {
tmp = t_1;
} else if (z <= -5.2e-91) {
tmp = y * -x;
} else if (z <= 1.55e+48) {
tmp = y * t;
} else if (z <= 3.3e+196) {
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.15d+119)) then
tmp = t_1
else if (z <= (-5.2d-91)) then
tmp = y * -x
else if (z <= 1.55d+48) then
tmp = y * t
else if (z <= 3.3d+196) 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.15e+119) {
tmp = t_1;
} else if (z <= -5.2e-91) {
tmp = y * -x;
} else if (z <= 1.55e+48) {
tmp = y * t;
} else if (z <= 3.3e+196) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.15e+119: tmp = t_1 elif z <= -5.2e-91: tmp = y * -x elif z <= 1.55e+48: tmp = y * t elif z <= 3.3e+196: 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.15e+119) tmp = t_1; elseif (z <= -5.2e-91) tmp = Float64(y * Float64(-x)); elseif (z <= 1.55e+48) tmp = Float64(y * t); elseif (z <= 3.3e+196) 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.15e+119) tmp = t_1; elseif (z <= -5.2e-91) tmp = y * -x; elseif (z <= 1.55e+48) tmp = y * t; elseif (z <= 3.3e+196) 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.15e+119], t$95$1, If[LessEqual[z, -5.2e-91], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 1.55e+48], N[(y * t), $MachinePrecision], If[LessEqual[z, 3.3e+196], 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.15 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-91}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+48}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+196}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.15e119 or 1.55000000000000003e48 < z < 3.3000000000000002e196Initial program 100.0%
Taylor expanded in t around inf 58.9%
Taylor expanded in t around inf 59.0%
Taylor expanded in z around inf 52.1%
neg-mul-152.1%
Simplified52.1%
if -1.15e119 < z < -5.20000000000000028e-91Initial program 99.9%
Taylor expanded in x around inf 71.6%
mul-1-neg71.6%
unsub-neg71.6%
Simplified71.6%
Taylor expanded in y around inf 39.6%
neg-mul-139.6%
Simplified39.6%
if -5.20000000000000028e-91 < z < 1.55000000000000003e48Initial program 100.0%
Taylor expanded in t around inf 78.9%
Taylor expanded in t around inf 74.9%
Taylor expanded in y around inf 43.5%
if 3.3000000000000002e196 < z Initial program 100.0%
Taylor expanded in x around inf 74.4%
mul-1-neg74.4%
unsub-neg74.4%
Simplified74.4%
Taylor expanded in z around inf 65.7%
Final simplification47.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -9.5e+113)
t_1
(if (<= z -3e-86) (* x (- 1.0 y)) (if (<= z 2e+18) (+ x (* y t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -9.5e+113) {
tmp = t_1;
} else if (z <= -3e-86) {
tmp = x * (1.0 - y);
} else if (z <= 2e+18) {
tmp = x + (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 = z * (x - t)
if (z <= (-9.5d+113)) then
tmp = t_1
else if (z <= (-3d-86)) then
tmp = x * (1.0d0 - y)
else if (z <= 2d+18) then
tmp = x + (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 = z * (x - t);
double tmp;
if (z <= -9.5e+113) {
tmp = t_1;
} else if (z <= -3e-86) {
tmp = x * (1.0 - y);
} else if (z <= 2e+18) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -9.5e+113: tmp = t_1 elif z <= -3e-86: tmp = x * (1.0 - y) elif z <= 2e+18: tmp = x + (y * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -9.5e+113) tmp = t_1; elseif (z <= -3e-86) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 2e+18) tmp = Float64(x + Float64(y * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -9.5e+113) tmp = t_1; elseif (z <= -3e-86) tmp = x * (1.0 - y); elseif (z <= 2e+18) tmp = x + (y * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+113], t$95$1, If[LessEqual[z, -3e-86], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+18], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-86}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+18}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5000000000000001e113 or 2e18 < z Initial program 100.0%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
Taylor expanded in z around inf 85.5%
if -9.5000000000000001e113 < z < -3.0000000000000001e-86Initial program 99.9%
Taylor expanded in x around inf 68.3%
mul-1-neg68.3%
unsub-neg68.3%
Simplified68.3%
Taylor expanded in z around 0 53.6%
if -3.0000000000000001e-86 < z < 2e18Initial program 100.0%
Taylor expanded in t around inf 80.6%
Taylor expanded in y around inf 73.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -9.5e+113)
t_1
(if (<= z 1.5e-196)
(* x (- 1.0 y))
(if (<= z 1.6e+32) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -9.5e+113) {
tmp = t_1;
} else if (z <= 1.5e-196) {
tmp = x * (1.0 - y);
} else if (z <= 1.6e+32) {
tmp = (y - 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 = z * (x - t)
if (z <= (-9.5d+113)) then
tmp = t_1
else if (z <= 1.5d-196) then
tmp = x * (1.0d0 - y)
else if (z <= 1.6d+32) then
tmp = (y - 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 = z * (x - t);
double tmp;
if (z <= -9.5e+113) {
tmp = t_1;
} else if (z <= 1.5e-196) {
tmp = x * (1.0 - y);
} else if (z <= 1.6e+32) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -9.5e+113: tmp = t_1 elif z <= 1.5e-196: tmp = x * (1.0 - y) elif z <= 1.6e+32: tmp = (y - z) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -9.5e+113) tmp = t_1; elseif (z <= 1.5e-196) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 1.6e+32) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -9.5e+113) tmp = t_1; elseif (z <= 1.5e-196) tmp = x * (1.0 - y); elseif (z <= 1.6e+32) tmp = (y - z) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+113], t$95$1, If[LessEqual[z, 1.5e-196], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+32], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-196}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+32}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5000000000000001e113 or 1.5999999999999999e32 < z Initial program 100.0%
Taylor expanded in y around 0 86.1%
mul-1-neg86.1%
unsub-neg86.1%
Simplified86.1%
Taylor expanded in z around inf 86.1%
if -9.5000000000000001e113 < z < 1.5e-196Initial program 99.9%
Taylor expanded in x around inf 62.8%
mul-1-neg62.8%
unsub-neg62.8%
Simplified62.8%
Taylor expanded in z around 0 57.8%
if 1.5e-196 < z < 1.5999999999999999e32Initial program 100.0%
Taylor expanded in t around inf 80.1%
Taylor expanded in t around inf 78.2%
Taylor expanded in x around 0 59.6%
Final simplification70.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -2.65e-11)
t_1
(if (<= t 5.2e-151) (* z x) (if (<= t 2.65e-120) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -2.65e-11) {
tmp = t_1;
} else if (t <= 5.2e-151) {
tmp = z * x;
} else if (t <= 2.65e-120) {
tmp = x;
} 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 - z) * t
if (t <= (-2.65d-11)) then
tmp = t_1
else if (t <= 5.2d-151) then
tmp = z * x
else if (t <= 2.65d-120) then
tmp = x
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 - z) * t;
double tmp;
if (t <= -2.65e-11) {
tmp = t_1;
} else if (t <= 5.2e-151) {
tmp = z * x;
} else if (t <= 2.65e-120) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -2.65e-11: tmp = t_1 elif t <= 5.2e-151: tmp = z * x elif t <= 2.65e-120: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -2.65e-11) tmp = t_1; elseif (t <= 5.2e-151) tmp = Float64(z * x); elseif (t <= 2.65e-120) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -2.65e-11) tmp = t_1; elseif (t <= 5.2e-151) tmp = z * x; elseif (t <= 2.65e-120) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2.65e-11], t$95$1, If[LessEqual[t, 5.2e-151], N[(z * x), $MachinePrecision], If[LessEqual[t, 2.65e-120], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -2.65 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-151}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{-120}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.6499999999999999e-11 or 2.64999999999999999e-120 < t Initial program 100.0%
Taylor expanded in t around inf 81.8%
Taylor expanded in t around inf 81.8%
Taylor expanded in x around 0 69.5%
if -2.6499999999999999e-11 < t < 5.2000000000000001e-151Initial program 99.9%
Taylor expanded in x around inf 88.0%
mul-1-neg88.0%
unsub-neg88.0%
Simplified88.0%
Taylor expanded in z around inf 43.6%
if 5.2000000000000001e-151 < t < 2.64999999999999999e-120Initial program 100.0%
Taylor expanded in t around inf 64.7%
Taylor expanded in x around inf 55.0%
Final simplification61.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -8.5e+154)
t_1
(if (<= z 1.55e+49) (* y t) (if (<= z 7.2e+199) t_1 (* z x))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8.5e+154) {
tmp = t_1;
} else if (z <= 1.55e+49) {
tmp = y * t;
} else if (z <= 7.2e+199) {
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 <= (-8.5d+154)) then
tmp = t_1
else if (z <= 1.55d+49) then
tmp = y * t
else if (z <= 7.2d+199) 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 <= -8.5e+154) {
tmp = t_1;
} else if (z <= 1.55e+49) {
tmp = y * t;
} else if (z <= 7.2e+199) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -8.5e+154: tmp = t_1 elif z <= 1.55e+49: tmp = y * t elif z <= 7.2e+199: 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 <= -8.5e+154) tmp = t_1; elseif (z <= 1.55e+49) tmp = Float64(y * t); elseif (z <= 7.2e+199) 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 <= -8.5e+154) tmp = t_1; elseif (z <= 1.55e+49) tmp = y * t; elseif (z <= 7.2e+199) 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, -8.5e+154], t$95$1, If[LessEqual[z, 1.55e+49], N[(y * t), $MachinePrecision], If[LessEqual[z, 7.2e+199], t$95$1, N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+49}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+199}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -8.5000000000000002e154 or 1.54999999999999996e49 < z < 7.20000000000000002e199Initial program 100.0%
Taylor expanded in t around inf 56.5%
Taylor expanded in t around inf 56.7%
Taylor expanded in z around inf 54.2%
neg-mul-154.2%
Simplified54.2%
if -8.5000000000000002e154 < z < 1.54999999999999996e49Initial program 99.9%
Taylor expanded in t around inf 71.8%
Taylor expanded in t around inf 68.3%
Taylor expanded in y around inf 38.0%
if 7.20000000000000002e199 < z Initial program 100.0%
Taylor expanded in x around inf 74.4%
mul-1-neg74.4%
unsub-neg74.4%
Simplified74.4%
Taylor expanded in z around inf 65.7%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e+19) (not (<= y 6e+48))) (- x (* y (- x t))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+19) || !(y <= 6e+48)) {
tmp = x - (y * (x - t));
} 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 <= (-7.2d+19)) .or. (.not. (y <= 6d+48))) then
tmp = x - (y * (x - t))
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 <= -7.2e+19) || !(y <= 6e+48)) {
tmp = x - (y * (x - t));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e+19) or not (y <= 6e+48): tmp = x - (y * (x - t)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e+19) || !(y <= 6e+48)) tmp = Float64(x - Float64(y * Float64(x - t))); 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 <= -7.2e+19) || ~((y <= 6e+48))) tmp = x - (y * (x - t)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e+19], N[Not[LessEqual[y, 6e+48]], $MachinePrecision]], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+19} \lor \neg \left(y \leq 6 \cdot 10^{+48}\right):\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -7.2e19 or 5.9999999999999999e48 < y Initial program 100.0%
Taylor expanded in y around inf 82.7%
*-commutative82.7%
Simplified82.7%
if -7.2e19 < y < 5.9999999999999999e48Initial program 100.0%
Taylor expanded in y around 0 90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.6e+140) (not (<= z 2.5e+17))) (* z (- x t)) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e+140) || !(z <= 2.5e+17)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6.6d+140)) .or. (.not. (z <= 2.5d+17))) then
tmp = z * (x - t)
else
tmp = x - (y * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e+140) || !(z <= 2.5e+17)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e+140) or not (z <= 2.5e+17): tmp = z * (x - t) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e+140) || !(z <= 2.5e+17)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x - Float64(y * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.6e+140) || ~((z <= 2.5e+17))) tmp = z * (x - t); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.6e+140], N[Not[LessEqual[z, 2.5e+17]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+140} \lor \neg \left(z \leq 2.5 \cdot 10^{+17}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -6.6000000000000003e140 or 2.5e17 < z Initial program 100.0%
Taylor expanded in y around 0 88.2%
mul-1-neg88.2%
unsub-neg88.2%
Simplified88.2%
Taylor expanded in z around inf 88.2%
if -6.6000000000000003e140 < z < 2.5e17Initial program 99.9%
Taylor expanded in y around inf 85.9%
*-commutative85.9%
Simplified85.9%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -11500000000.0) (not (<= x 2.35e-104))) (* x (+ (- z y) 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -11500000000.0) || !(x <= 2.35e-104)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (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 <= (-11500000000.0d0)) .or. (.not. (x <= 2.35d-104))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = (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 <= -11500000000.0) || !(x <= 2.35e-104)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -11500000000.0) or not (x <= 2.35e-104): tmp = x * ((z - y) + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -11500000000.0) || !(x <= 2.35e-104)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -11500000000.0) || ~((x <= 2.35e-104))) tmp = x * ((z - y) + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -11500000000.0], N[Not[LessEqual[x, 2.35e-104]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -11500000000 \lor \neg \left(x \leq 2.35 \cdot 10^{-104}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.15e10 or 2.35e-104 < x Initial program 100.0%
Taylor expanded in x around inf 79.9%
mul-1-neg79.9%
unsub-neg79.9%
Simplified79.9%
if -1.15e10 < x < 2.35e-104Initial program 100.0%
Taylor expanded in t around inf 84.9%
Taylor expanded in t around inf 84.9%
Taylor expanded in x around 0 80.6%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2e+16) (not (<= x 3.4e+34))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2e+16) || !(x <= 3.4e+34)) {
tmp = x * (z + 1.0);
} else {
tmp = (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 <= (-2d+16)) .or. (.not. (x <= 3.4d+34))) then
tmp = x * (z + 1.0d0)
else
tmp = (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 <= -2e+16) || !(x <= 3.4e+34)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2e+16) or not (x <= 3.4e+34): tmp = x * (z + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2e+16) || !(x <= 3.4e+34)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2e+16) || ~((x <= 3.4e+34))) tmp = x * (z + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2e+16], N[Not[LessEqual[x, 3.4e+34]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+16} \lor \neg \left(x \leq 3.4 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -2e16 or 3.3999999999999999e34 < x Initial program 100.0%
Taylor expanded in x around inf 87.4%
mul-1-neg87.4%
unsub-neg87.4%
Simplified87.4%
Taylor expanded in y around 0 62.4%
+-commutative62.4%
Simplified62.4%
if -2e16 < x < 3.3999999999999999e34Initial program 99.9%
Taylor expanded in t around inf 76.4%
Taylor expanded in t around inf 76.4%
Taylor expanded in x around 0 71.2%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e+141) (not (<= z 9e+56))) (* z x) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e+141) || !(z <= 9e+56)) {
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 <= (-9.2d+141)) .or. (.not. (z <= 9d+56))) 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 <= -9.2e+141) || !(z <= 9e+56)) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e+141) or not (z <= 9e+56): tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e+141) || !(z <= 9e+56)) 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 <= -9.2e+141) || ~((z <= 9e+56))) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e+141], N[Not[LessEqual[z, 9e+56]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+141} \lor \neg \left(z \leq 9 \cdot 10^{+56}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -9.2000000000000006e141 or 9.0000000000000006e56 < z Initial program 100.0%
Taylor expanded in x around inf 55.7%
mul-1-neg55.7%
unsub-neg55.7%
Simplified55.7%
Taylor expanded in z around inf 49.4%
if -9.2000000000000006e141 < z < 9.0000000000000006e56Initial program 99.9%
Taylor expanded in t around inf 72.7%
Taylor expanded in t around inf 69.1%
Taylor expanded in y around inf 38.0%
Final simplification42.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.45e-24) (not (<= y 2.1e-14))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e-24) || !(y <= 2.1e-14)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.45d-24)) .or. (.not. (y <= 2.1d-14))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e-24) || !(y <= 2.1e-14)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.45e-24) or not (y <= 2.1e-14): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.45e-24) || !(y <= 2.1e-14)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.45e-24) || ~((y <= 2.1e-14))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.45e-24], N[Not[LessEqual[y, 2.1e-14]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-24} \lor \neg \left(y \leq 2.1 \cdot 10^{-14}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.4499999999999999e-24 or 2.0999999999999999e-14 < y Initial program 100.0%
Taylor expanded in t around inf 57.5%
Taylor expanded in t around inf 61.4%
Taylor expanded in y around inf 43.7%
if -1.4499999999999999e-24 < y < 2.0999999999999999e-14Initial program 100.0%
Taylor expanded in t around inf 75.1%
Taylor expanded in x around inf 35.6%
Final simplification40.2%
(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 t around inf 65.2%
Taylor expanded in x around inf 17.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 2024141
(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))))