
(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 15 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 (* x (+ (- z y) 1.0))))
(if (<= x -1.56e+41)
t_1
(if (<= x 1.45e-182)
(+ x (* y t))
(if (<= x 7.5e+17) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (x <= -1.56e+41) {
tmp = t_1;
} else if (x <= 1.45e-182) {
tmp = x + (y * t);
} else if (x <= 7.5e+17) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((z - y) + 1.0d0)
if (x <= (-1.56d+41)) then
tmp = t_1
else if (x <= 1.45d-182) then
tmp = x + (y * t)
else if (x <= 7.5d+17) then
tmp = x - (z * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (x <= -1.56e+41) {
tmp = t_1;
} else if (x <= 1.45e-182) {
tmp = x + (y * t);
} else if (x <= 7.5e+17) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - y) + 1.0) tmp = 0 if x <= -1.56e+41: tmp = t_1 elif x <= 1.45e-182: tmp = x + (y * t) elif x <= 7.5e+17: tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (x <= -1.56e+41) tmp = t_1; elseif (x <= 1.45e-182) tmp = Float64(x + Float64(y * t)); elseif (x <= 7.5e+17) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((z - y) + 1.0); tmp = 0.0; if (x <= -1.56e+41) tmp = t_1; elseif (x <= 1.45e-182) tmp = x + (y * t); elseif (x <= 7.5e+17) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.56e+41], t$95$1, If[LessEqual[x, 1.45e-182], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+17], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;x \leq -1.56 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-182}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+17}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.56e41 or 7.5e17 < x Initial program 100.0%
Taylor expanded in x around inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
if -1.56e41 < x < 1.44999999999999993e-182Initial program 100.0%
Taylor expanded in y around inf 61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in t around inf 58.6%
*-commutative58.6%
Simplified58.6%
if 1.44999999999999993e-182 < x < 7.5e17Initial program 100.0%
Taylor expanded in t around inf 86.1%
Taylor expanded in y around 0 57.4%
mul-1-neg57.4%
unsub-neg57.4%
*-commutative57.4%
Simplified57.4%
Final simplification71.2%
(FPCore (x y z t) :precision binary64 (if (<= z -9.8e-15) (* x (+ z 1.0)) (if (or (<= z -1e-54) (not (<= z 1.85e+32))) (* z (- t)) (+ x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.8e-15) {
tmp = x * (z + 1.0);
} else if ((z <= -1e-54) || !(z <= 1.85e+32)) {
tmp = z * -t;
} 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 (z <= (-9.8d-15)) then
tmp = x * (z + 1.0d0)
else if ((z <= (-1d-54)) .or. (.not. (z <= 1.85d+32))) then
tmp = z * -t
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 (z <= -9.8e-15) {
tmp = x * (z + 1.0);
} else if ((z <= -1e-54) || !(z <= 1.85e+32)) {
tmp = z * -t;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.8e-15: tmp = x * (z + 1.0) elif (z <= -1e-54) or not (z <= 1.85e+32): tmp = z * -t else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.8e-15) tmp = Float64(x * Float64(z + 1.0)); elseif ((z <= -1e-54) || !(z <= 1.85e+32)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.8e-15) tmp = x * (z + 1.0); elseif ((z <= -1e-54) || ~((z <= 1.85e+32))) tmp = z * -t; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.8e-15], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1e-54], N[Not[LessEqual[z, 1.85e+32]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-54} \lor \neg \left(z \leq 1.85 \cdot 10^{+32}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -9.7999999999999999e-15Initial program 100.0%
Taylor expanded in x around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in y around 0 49.0%
+-commutative49.0%
Simplified49.0%
if -9.7999999999999999e-15 < z < -1e-54 or 1.85e32 < z Initial program 99.9%
Taylor expanded in y around 0 87.4%
mul-1-neg87.4%
unsub-neg87.4%
Simplified87.4%
Taylor expanded in x around inf 78.2%
associate--l+78.2%
cancel-sign-sub-inv78.2%
metadata-eval78.2%
*-lft-identity78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
associate-/l*76.6%
Simplified76.6%
Taylor expanded in x around 0 58.8%
associate-*r*58.8%
neg-mul-158.8%
*-commutative58.8%
Simplified58.8%
if -1e-54 < z < 1.85e32Initial program 100.0%
Taylor expanded in y around inf 94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in t around inf 72.6%
*-commutative72.6%
Simplified72.6%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.1e-15) (* x (+ z 1.0)) (if (or (<= z -1.7e-45) (not (<= z 1.3e+27))) (* z (- t)) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.1e-15) {
tmp = x * (z + 1.0);
} else if ((z <= -1.7e-45) || !(z <= 1.3e+27)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.1d-15)) then
tmp = x * (z + 1.0d0)
else if ((z <= (-1.7d-45)) .or. (.not. (z <= 1.3d+27))) then
tmp = z * -t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.1e-15) {
tmp = x * (z + 1.0);
} else if ((z <= -1.7e-45) || !(z <= 1.3e+27)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.1e-15: tmp = x * (z + 1.0) elif (z <= -1.7e-45) or not (z <= 1.3e+27): tmp = z * -t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.1e-15) tmp = Float64(x * Float64(z + 1.0)); elseif ((z <= -1.7e-45) || !(z <= 1.3e+27)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.1e-15) tmp = x * (z + 1.0); elseif ((z <= -1.7e-45) || ~((z <= 1.3e+27))) tmp = z * -t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.1e-15], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.7e-45], N[Not[LessEqual[z, 1.3e+27]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-45} \lor \neg \left(z \leq 1.3 \cdot 10^{+27}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -2.09999999999999981e-15Initial program 100.0%
Taylor expanded in x around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in y around 0 49.0%
+-commutative49.0%
Simplified49.0%
if -2.09999999999999981e-15 < z < -1.70000000000000002e-45 or 1.30000000000000004e27 < z Initial program 99.9%
Taylor expanded in y around 0 88.6%
mul-1-neg88.6%
unsub-neg88.6%
Simplified88.6%
Taylor expanded in x around inf 79.1%
associate--l+79.1%
cancel-sign-sub-inv79.1%
metadata-eval79.1%
*-lft-identity79.1%
+-commutative79.1%
mul-1-neg79.1%
unsub-neg79.1%
associate-/l*77.5%
Simplified77.5%
Taylor expanded in x around 0 59.1%
associate-*r*59.1%
neg-mul-159.1%
*-commutative59.1%
Simplified59.1%
if -1.70000000000000002e-45 < z < 1.30000000000000004e27Initial program 100.0%
Taylor expanded in x around inf 57.2%
mul-1-neg57.2%
unsub-neg57.2%
Simplified57.2%
Taylor expanded in z around 0 57.2%
Final simplification55.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -4e-13)
(* x (+ z 1.0))
(if (<= z -1e-54)
(* z (- t))
(if (<= z 2e+33) (+ x (* y t)) (- x (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e-13) {
tmp = x * (z + 1.0);
} else if (z <= -1e-54) {
tmp = z * -t;
} else if (z <= 2e+33) {
tmp = x + (y * t);
} 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 (z <= (-4d-13)) then
tmp = x * (z + 1.0d0)
else if (z <= (-1d-54)) then
tmp = z * -t
else if (z <= 2d+33) then
tmp = x + (y * t)
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 (z <= -4e-13) {
tmp = x * (z + 1.0);
} else if (z <= -1e-54) {
tmp = z * -t;
} else if (z <= 2e+33) {
tmp = x + (y * t);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e-13: tmp = x * (z + 1.0) elif z <= -1e-54: tmp = z * -t elif z <= 2e+33: tmp = x + (y * t) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e-13) tmp = Float64(x * Float64(z + 1.0)); elseif (z <= -1e-54) tmp = Float64(z * Float64(-t)); elseif (z <= 2e+33) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e-13) tmp = x * (z + 1.0); elseif (z <= -1e-54) tmp = z * -t; elseif (z <= 2e+33) tmp = x + (y * t); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e-13], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1e-54], N[(z * (-t)), $MachinePrecision], If[LessEqual[z, 2e+33], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-54}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+33}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -4.0000000000000001e-13Initial program 100.0%
Taylor expanded in x around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in y around 0 49.0%
+-commutative49.0%
Simplified49.0%
if -4.0000000000000001e-13 < z < -1e-54Initial program 100.0%
Taylor expanded in y around 0 75.1%
mul-1-neg75.1%
unsub-neg75.1%
Simplified75.1%
Taylor expanded in x around inf 62.8%
associate--l+62.8%
cancel-sign-sub-inv62.8%
metadata-eval62.8%
*-lft-identity62.8%
+-commutative62.8%
mul-1-neg62.8%
unsub-neg62.8%
associate-/l*62.8%
Simplified62.8%
Taylor expanded in x around 0 75.2%
associate-*r*75.2%
neg-mul-175.2%
*-commutative75.2%
Simplified75.2%
if -1e-54 < z < 1.9999999999999999e33Initial program 100.0%
Taylor expanded in y around inf 94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in t around inf 72.6%
*-commutative72.6%
Simplified72.6%
if 1.9999999999999999e33 < z Initial program 99.9%
Taylor expanded in t around inf 64.7%
Taylor expanded in y around 0 57.1%
mul-1-neg57.1%
unsub-neg57.1%
*-commutative57.1%
Simplified57.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e+25) (* z x) (if (or (<= z -4.5e-55) (not (<= z 116000000.0))) (* z (- t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e+25) {
tmp = z * x;
} else if ((z <= -4.5e-55) || !(z <= 116000000.0)) {
tmp = z * -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 (z <= (-1.9d+25)) then
tmp = z * x
else if ((z <= (-4.5d-55)) .or. (.not. (z <= 116000000.0d0))) then
tmp = z * -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 (z <= -1.9e+25) {
tmp = z * x;
} else if ((z <= -4.5e-55) || !(z <= 116000000.0)) {
tmp = z * -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.9e+25: tmp = z * x elif (z <= -4.5e-55) or not (z <= 116000000.0): tmp = z * -t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e+25) tmp = Float64(z * x); elseif ((z <= -4.5e-55) || !(z <= 116000000.0)) tmp = Float64(z * Float64(-t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.9e+25) tmp = z * x; elseif ((z <= -4.5e-55) || ~((z <= 116000000.0))) tmp = z * -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e+25], N[(z * x), $MachinePrecision], If[Or[LessEqual[z, -4.5e-55], N[Not[LessEqual[z, 116000000.0]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+25}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-55} \lor \neg \left(z \leq 116000000\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.9e25Initial 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.4%
if -1.9e25 < z < -4.4999999999999997e-55 or 1.16e8 < z Initial program 99.9%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Taylor expanded in x around inf 74.5%
associate--l+74.5%
cancel-sign-sub-inv74.5%
metadata-eval74.5%
*-lft-identity74.5%
+-commutative74.5%
mul-1-neg74.5%
unsub-neg74.5%
associate-/l*73.2%
Simplified73.2%
Taylor expanded in x around 0 55.0%
associate-*r*55.0%
neg-mul-155.0%
*-commutative55.0%
Simplified55.0%
if -4.4999999999999997e-55 < z < 1.16e8Initial program 100.0%
Taylor expanded in y around inf 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in y around 0 33.5%
Final simplification43.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* z x) (if (<= z 7e-223) x (if (<= z 7.7e+31) (* x (- y)) (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = z * x;
} else if (z <= 7e-223) {
tmp = x;
} else if (z <= 7.7e+31) {
tmp = x * -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.0d0)) then
tmp = z * x
else if (z <= 7d-223) then
tmp = x
else if (z <= 7.7d+31) then
tmp = x * -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.0) {
tmp = z * x;
} else if (z <= 7e-223) {
tmp = x;
} else if (z <= 7.7e+31) {
tmp = x * -y;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = z * x elif z <= 7e-223: tmp = x elif z <= 7.7e+31: tmp = x * -y else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(z * x); elseif (z <= 7e-223) tmp = x; elseif (z <= 7.7e+31) tmp = Float64(x * Float64(-y)); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = z * x; elseif (z <= 7e-223) tmp = x; elseif (z <= 7.7e+31) tmp = x * -y; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 7e-223], x, If[LessEqual[z, 7.7e+31], N[(x * (-y)), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-223}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.7 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1 or 7.69999999999999967e31 < z Initial program 100.0%
Taylor expanded in x around inf 52.8%
mul-1-neg52.8%
unsub-neg52.8%
Simplified52.8%
Taylor expanded in z around inf 46.1%
if -1 < z < 7.00000000000000018e-223Initial program 100.0%
Taylor expanded in y around inf 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in y around 0 33.5%
if 7.00000000000000018e-223 < z < 7.69999999999999967e31Initial program 100.0%
Taylor expanded in x around inf 60.4%
mul-1-neg60.4%
unsub-neg60.4%
Simplified60.4%
Taylor expanded in y around inf 36.9%
neg-mul-136.9%
Simplified36.9%
Final simplification40.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e-45) (not (<= z 1.9e+26))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-45) || !(z <= 1.9e+26)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.7d-45)) .or. (.not. (z <= 1.9d+26))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-45) || !(z <= 1.9e+26)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e-45) or not (z <= 1.9e+26): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e-45) || !(z <= 1.9e+26)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e-45) || ~((z <= 1.9e+26))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e-45], N[Not[LessEqual[z, 1.9e+26]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-45} \lor \neg \left(z \leq 1.9 \cdot 10^{+26}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.70000000000000002e-45 or 1.9000000000000001e26 < z Initial program 100.0%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -1.70000000000000002e-45 < z < 1.9000000000000001e26Initial program 100.0%
Taylor expanded in y around inf 94.2%
*-commutative94.2%
Simplified94.2%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.75e+44) (not (<= x 2.5e+19))) (* x (+ (- z y) 1.0)) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e+44) || !(x <= 2.5e+19)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x - (t * (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 ((x <= (-1.75d+44)) .or. (.not. (x <= 2.5d+19))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = x - (t * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e+44) || !(x <= 2.5e+19)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.75e+44) or not (x <= 2.5e+19): tmp = x * ((z - y) + 1.0) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.75e+44) || !(x <= 2.5e+19)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(x - Float64(t * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.75e+44) || ~((x <= 2.5e+19))) tmp = x * ((z - y) + 1.0); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.75e+44], N[Not[LessEqual[x, 2.5e+19]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+44} \lor \neg \left(x \leq 2.5 \cdot 10^{+19}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -1.75e44 or 2.5e19 < x Initial program 100.0%
Taylor expanded in x around inf 86.1%
mul-1-neg86.1%
unsub-neg86.1%
Simplified86.1%
if -1.75e44 < x < 2.5e19Initial program 100.0%
Taylor expanded in t around inf 89.3%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+118) (* x (+ (- z y) 1.0)) (if (<= z 5.8e+31) (+ x (* y (- t x))) (- x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+118) {
tmp = x * ((z - y) + 1.0);
} else if (z <= 5.8e+31) {
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 (z <= (-4d+118)) then
tmp = x * ((z - y) + 1.0d0)
else if (z <= 5.8d+31) 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 (z <= -4e+118) {
tmp = x * ((z - y) + 1.0);
} else if (z <= 5.8e+31) {
tmp = x + (y * (t - x));
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+118: tmp = x * ((z - y) + 1.0) elif z <= 5.8e+31: tmp = x + (y * (t - x)) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+118) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); elseif (z <= 5.8e+31) 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 (z <= -4e+118) tmp = x * ((z - y) + 1.0); elseif (z <= 5.8e+31) tmp = x + (y * (t - x)); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+118], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e+31], 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}\;z \leq -4 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+31}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -3.99999999999999987e118Initial program 100.0%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
unsub-neg61.4%
Simplified61.4%
if -3.99999999999999987e118 < z < 5.8000000000000001e31Initial program 100.0%
Taylor expanded in y around inf 84.0%
*-commutative84.0%
Simplified84.0%
if 5.8000000000000001e31 < z Initial program 99.9%
Taylor expanded in t around inf 64.7%
Taylor expanded in y around 0 57.1%
mul-1-neg57.1%
unsub-neg57.1%
*-commutative57.1%
Simplified57.1%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.6e+100) (not (<= t 1.02e+33))) (* z (- t)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.6e+100) || !(t <= 1.02e+33)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
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 <= (-4.6d+100)) .or. (.not. (t <= 1.02d+33))) then
tmp = z * -t
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.6e+100) || !(t <= 1.02e+33)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.6e+100) or not (t <= 1.02e+33): tmp = z * -t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.6e+100) || !(t <= 1.02e+33)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.6e+100) || ~((t <= 1.02e+33))) tmp = z * -t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.6e+100], N[Not[LessEqual[t, 1.02e+33]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+100} \lor \neg \left(t \leq 1.02 \cdot 10^{+33}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -4.5999999999999998e100 or 1.02000000000000001e33 < t Initial program 100.0%
Taylor expanded in y around 0 58.2%
mul-1-neg58.2%
unsub-neg58.2%
Simplified58.2%
Taylor expanded in x around inf 49.7%
associate--l+49.7%
cancel-sign-sub-inv49.7%
metadata-eval49.7%
*-lft-identity49.7%
+-commutative49.7%
mul-1-neg49.7%
unsub-neg49.7%
associate-/l*50.6%
Simplified50.6%
Taylor expanded in x around 0 50.5%
associate-*r*50.5%
neg-mul-150.5%
*-commutative50.5%
Simplified50.5%
if -4.5999999999999998e100 < t < 1.02000000000000001e33Initial program 100.0%
Taylor expanded in x around inf 74.2%
mul-1-neg74.2%
unsub-neg74.2%
Simplified74.2%
Taylor expanded in y around 0 53.8%
+-commutative53.8%
Simplified53.8%
Final simplification52.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.7e-10))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.7e-10)) {
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.0d0)) .or. (.not. (z <= 1.7d-10))) 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.0) || !(z <= 1.7e-10)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.7e-10): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.7e-10)) 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.0) || ~((z <= 1.7e-10))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.7e-10]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.7 \cdot 10^{-10}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 1.70000000000000007e-10 < z Initial program 100.0%
Taylor expanded in x around inf 53.1%
mul-1-neg53.1%
unsub-neg53.1%
Simplified53.1%
Taylor expanded in z around inf 44.0%
if -1 < z < 1.70000000000000007e-10Initial program 100.0%
Taylor expanded in y around inf 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in y around 0 32.3%
Final simplification38.5%
(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 (if (<= y -4.5e+46) (* y x) x))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e+46) {
tmp = y * 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 (y <= (-4.5d+46)) then
tmp = y * 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 (y <= -4.5e+46) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.5e+46: tmp = y * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e+46) tmp = Float64(y * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.5e+46) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e+46], N[(y * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+46}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.5000000000000001e46Initial program 100.0%
Taylor expanded in x around inf 43.7%
mul-1-neg43.7%
unsub-neg43.7%
Simplified43.7%
Taylor expanded in y around inf 31.9%
neg-mul-131.9%
Simplified31.9%
add-sqr-sqrt31.9%
sqrt-unprod39.6%
sqr-neg39.6%
sqrt-unprod0.0%
add-sqr-sqrt15.8%
pow115.8%
Applied egg-rr15.8%
unpow115.8%
Simplified15.8%
if -4.5000000000000001e46 < y Initial program 100.0%
Taylor expanded in y around inf 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in y around 0 20.1%
Final simplification19.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 57.2%
*-commutative57.2%
Simplified57.2%
Taylor expanded in y around 0 16.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 2024153
(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))))