
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- 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
(let* ((t_1 (* t (- z))))
(if (<= z -3.6e-43)
t_1
(if (<= z 1.65e-277)
x
(if (<= z 2e+35) (* x (- y)) (if (<= z 1.6e+203) (* x z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -3.6e-43) {
tmp = t_1;
} else if (z <= 1.65e-277) {
tmp = x;
} else if (z <= 2e+35) {
tmp = x * -y;
} else if (z <= 1.6e+203) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-3.6d-43)) then
tmp = t_1
else if (z <= 1.65d-277) then
tmp = x
else if (z <= 2d+35) then
tmp = x * -y
else if (z <= 1.6d+203) then
tmp = x * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -3.6e-43) {
tmp = t_1;
} else if (z <= 1.65e-277) {
tmp = x;
} else if (z <= 2e+35) {
tmp = x * -y;
} else if (z <= 1.6e+203) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -3.6e-43: tmp = t_1 elif z <= 1.65e-277: tmp = x elif z <= 2e+35: tmp = x * -y elif z <= 1.6e+203: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -3.6e-43) tmp = t_1; elseif (z <= 1.65e-277) tmp = x; elseif (z <= 2e+35) tmp = Float64(x * Float64(-y)); elseif (z <= 1.6e+203) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -3.6e-43) tmp = t_1; elseif (z <= 1.65e-277) tmp = x; elseif (z <= 2e+35) tmp = x * -y; elseif (z <= 1.6e+203) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -3.6e-43], t$95$1, If[LessEqual[z, 1.65e-277], x, If[LessEqual[z, 2e+35], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 1.6e+203], N[(x * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-277}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+203}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.5999999999999999e-43 or 1.5999999999999998e203 < z Initial program 100.0%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in x around 0 78.1%
neg-mul-178.1%
Simplified78.1%
Taylor expanded in x around 0 49.0%
mul-1-neg49.0%
*-commutative49.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
if -3.5999999999999999e-43 < z < 1.64999999999999991e-277Initial program 100.0%
Taylor expanded in y around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 43.4%
if 1.64999999999999991e-277 < z < 1.9999999999999999e35Initial program 100.0%
Taylor expanded in t around 0 52.1%
mul-1-neg52.1%
distribute-rgt-neg-in52.1%
sub-neg52.1%
+-commutative52.1%
distribute-neg-in52.1%
remove-double-neg52.1%
sub-neg52.1%
Simplified52.1%
Taylor expanded in z around inf 37.5%
associate-+r+37.5%
mul-1-neg37.5%
unsub-neg37.5%
associate-/l*37.6%
Simplified37.6%
Taylor expanded in y around inf 31.3%
neg-mul-131.3%
distribute-rgt-neg-in31.3%
Simplified31.3%
if 1.9999999999999999e35 < z < 1.5999999999999998e203Initial program 100.0%
Taylor expanded in t around 0 60.2%
mul-1-neg60.2%
distribute-rgt-neg-in60.2%
sub-neg60.2%
+-commutative60.2%
distribute-neg-in60.2%
remove-double-neg60.2%
sub-neg60.2%
Simplified60.2%
Taylor expanded in z around inf 49.0%
Taylor expanded in z around inf 49.0%
*-commutative49.0%
Simplified49.0%
Final simplification42.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -9.5e-37)
t_1
(if (<= z 4e+25) (* x (- 1.0 y)) (if (<= z 8.5e+202) (* x z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -9.5e-37) {
tmp = t_1;
} else if (z <= 4e+25) {
tmp = x * (1.0 - y);
} else if (z <= 8.5e+202) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-9.5d-37)) then
tmp = t_1
else if (z <= 4d+25) then
tmp = x * (1.0d0 - y)
else if (z <= 8.5d+202) then
tmp = x * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -9.5e-37) {
tmp = t_1;
} else if (z <= 4e+25) {
tmp = x * (1.0 - y);
} else if (z <= 8.5e+202) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -9.5e-37: tmp = t_1 elif z <= 4e+25: tmp = x * (1.0 - y) elif z <= 8.5e+202: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -9.5e-37) tmp = t_1; elseif (z <= 4e+25) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 8.5e+202) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -9.5e-37) tmp = t_1; elseif (z <= 4e+25) tmp = x * (1.0 - y); elseif (z <= 8.5e+202) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -9.5e-37], t$95$1, If[LessEqual[z, 4e+25], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+202], N[(x * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+25}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+202}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.49999999999999927e-37 or 8.5000000000000003e202 < z Initial program 100.0%
Taylor expanded in y around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
Simplified84.4%
Taylor expanded in x around 0 78.9%
neg-mul-178.9%
Simplified78.9%
Taylor expanded in x around 0 49.5%
mul-1-neg49.5%
*-commutative49.5%
distribute-rgt-neg-in49.5%
Simplified49.5%
if -9.49999999999999927e-37 < z < 4.00000000000000036e25Initial program 100.0%
Taylor expanded in t around 0 58.2%
mul-1-neg58.2%
distribute-rgt-neg-in58.2%
sub-neg58.2%
+-commutative58.2%
distribute-neg-in58.2%
remove-double-neg58.2%
sub-neg58.2%
Simplified58.2%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
*-rgt-identity58.2%
distribute-rgt-neg-out58.2%
distribute-lft-in58.2%
unsub-neg58.2%
Simplified58.2%
if 4.00000000000000036e25 < z < 8.5000000000000003e202Initial program 100.0%
Taylor expanded in t around 0 60.2%
mul-1-neg60.2%
distribute-rgt-neg-in60.2%
sub-neg60.2%
+-commutative60.2%
distribute-neg-in60.2%
remove-double-neg60.2%
sub-neg60.2%
Simplified60.2%
Taylor expanded in z around inf 49.0%
Taylor expanded in z around inf 49.0%
*-commutative49.0%
Simplified49.0%
Final simplification53.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00052) (* x z) (if (<= z 2.1e-275) x (if (<= z 500000000000.0) (* x (- y)) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00052) {
tmp = x * z;
} else if (z <= 2.1e-275) {
tmp = x;
} else if (z <= 500000000000.0) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.00052d0)) then
tmp = x * z
else if (z <= 2.1d-275) then
tmp = x
else if (z <= 500000000000.0d0) then
tmp = x * -y
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00052) {
tmp = x * z;
} else if (z <= 2.1e-275) {
tmp = x;
} else if (z <= 500000000000.0) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00052: tmp = x * z elif z <= 2.1e-275: tmp = x elif z <= 500000000000.0: tmp = x * -y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00052) tmp = Float64(x * z); elseif (z <= 2.1e-275) tmp = x; elseif (z <= 500000000000.0) tmp = Float64(x * Float64(-y)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00052) tmp = x * z; elseif (z <= 2.1e-275) tmp = x; elseif (z <= 500000000000.0) tmp = x * -y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00052], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.1e-275], x, If[LessEqual[z, 500000000000.0], N[(x * (-y)), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00052:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-275}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 500000000000:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.19999999999999954e-4 or 5e11 < z Initial program 100.0%
Taylor expanded in t around 0 54.3%
mul-1-neg54.3%
distribute-rgt-neg-in54.3%
sub-neg54.3%
+-commutative54.3%
distribute-neg-in54.3%
remove-double-neg54.3%
sub-neg54.3%
Simplified54.3%
Taylor expanded in z around inf 45.4%
Taylor expanded in z around inf 45.4%
*-commutative45.4%
Simplified45.4%
if -5.19999999999999954e-4 < z < 2.09999999999999988e-275Initial program 100.0%
Taylor expanded in y around inf 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in y around 0 38.9%
if 2.09999999999999988e-275 < z < 5e11Initial program 100.0%
Taylor expanded in t around 0 52.1%
mul-1-neg52.1%
distribute-rgt-neg-in52.1%
sub-neg52.1%
+-commutative52.1%
distribute-neg-in52.1%
remove-double-neg52.1%
sub-neg52.1%
Simplified52.1%
Taylor expanded in z around inf 37.5%
associate-+r+37.5%
mul-1-neg37.5%
unsub-neg37.5%
associate-/l*37.6%
Simplified37.6%
Taylor expanded in y around inf 31.3%
neg-mul-131.3%
distribute-rgt-neg-in31.3%
Simplified31.3%
Final simplification39.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-14) (not (<= z 3.6e+19))) (* z (- x t)) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-14) || !(z <= 3.6e+19)) {
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 <= (-1.6d-14)) .or. (.not. (z <= 3.6d+19))) 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 <= -1.6e-14) || !(z <= 3.6e+19)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-14) or not (z <= 3.6e+19): tmp = z * (x - t) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-14) || !(z <= 3.6e+19)) 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 <= -1.6e-14) || ~((z <= 3.6e+19))) tmp = z * (x - t); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-14], N[Not[LessEqual[z, 3.6e+19]], $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 -1.6 \cdot 10^{-14} \lor \neg \left(z \leq 3.6 \cdot 10^{+19}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -1.6000000000000001e-14 or 3.6e19 < z Initial program 100.0%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Taylor expanded in x around 0 78.7%
neg-mul-178.7%
Simplified78.7%
Taylor expanded in z around inf 83.7%
if -1.6000000000000001e-14 < z < 3.6e19Initial program 100.0%
Taylor expanded in y around inf 94.1%
*-commutative94.1%
Simplified94.1%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e-14) (* z (- x t)) (if (<= z 1e+36) (- x (* y (- x t))) (- x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-14) {
tmp = z * (x - t);
} else if (z <= 1e+36) {
tmp = x - (y * (x - t));
} else {
tmp = x - (z * (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.6d-14)) then
tmp = z * (x - t)
else if (z <= 1d+36) then
tmp = x - (y * (x - t))
else
tmp = x - (z * (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.6e-14) {
tmp = z * (x - t);
} else if (z <= 1e+36) {
tmp = x - (y * (x - t));
} else {
tmp = x - (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e-14: tmp = z * (x - t) elif z <= 1e+36: tmp = x - (y * (x - t)) else: tmp = x - (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-14) tmp = Float64(z * Float64(x - t)); elseif (z <= 1e+36) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x - Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e-14) tmp = z * (x - t); elseif (z <= 1e+36) tmp = x - (y * (x - t)); else tmp = x - (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e-14], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+36], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-14}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{elif}\;z \leq 10^{+36}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.6000000000000001e-14Initial program 100.0%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
Taylor expanded in x around 0 77.9%
neg-mul-177.9%
Simplified77.9%
Taylor expanded in z around inf 85.6%
if -1.6000000000000001e-14 < z < 1.00000000000000004e36Initial program 100.0%
Taylor expanded in y around inf 94.1%
*-commutative94.1%
Simplified94.1%
if 1.00000000000000004e36 < z Initial program 100.0%
Taylor expanded in y around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
Simplified81.4%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-14) (not (<= z 420000000000.0))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-14) || !(z <= 420000000000.0)) {
tmp = z * (x - 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 <= (-1.6d-14)) .or. (.not. (z <= 420000000000.0d0))) then
tmp = z * (x - 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 <= -1.6e-14) || !(z <= 420000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-14) or not (z <= 420000000000.0): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-14) || !(z <= 420000000000.0)) tmp = Float64(z * Float64(x - 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 <= -1.6e-14) || ~((z <= 420000000000.0))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-14], N[Not[LessEqual[z, 420000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-14} \lor \neg \left(z \leq 420000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.6000000000000001e-14 or 4.2e11 < z Initial program 100.0%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
unsub-neg83.7%
Simplified83.7%
Taylor expanded in x around 0 78.7%
neg-mul-178.7%
Simplified78.7%
Taylor expanded in z around inf 83.7%
if -1.6000000000000001e-14 < z < 4.2e11Initial program 100.0%
Taylor expanded in t around inf 76.8%
Taylor expanded in y around inf 71.0%
Final simplification77.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-37) (not (<= z 20000000000000.0))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-37) || !(z <= 20000000000000.0)) {
tmp = z * (x - 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 <= (-9d-37)) .or. (.not. (z <= 20000000000000.0d0))) then
tmp = z * (x - 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 <= -9e-37) || !(z <= 20000000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-37) or not (z <= 20000000000000.0): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-37) || !(z <= 20000000000000.0)) tmp = Float64(z * Float64(x - 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 <= -9e-37) || ~((z <= 20000000000000.0))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-37], N[Not[LessEqual[z, 20000000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-37} \lor \neg \left(z \leq 20000000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -9.00000000000000081e-37 or 2e13 < z Initial program 100.0%
Taylor expanded in y around 0 82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
Taylor expanded in x around 0 77.4%
neg-mul-177.4%
Simplified77.4%
Taylor expanded in z around inf 81.4%
if -9.00000000000000081e-37 < z < 2e13Initial program 100.0%
Taylor expanded in t around 0 58.2%
mul-1-neg58.2%
distribute-rgt-neg-in58.2%
sub-neg58.2%
+-commutative58.2%
distribute-neg-in58.2%
remove-double-neg58.2%
sub-neg58.2%
Simplified58.2%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
*-rgt-identity58.2%
distribute-rgt-neg-out58.2%
distribute-lft-in58.2%
unsub-neg58.2%
Simplified58.2%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.12e-10))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.12e-10)) {
tmp = x * z;
} 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.12d-10))) then
tmp = x * z
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.12e-10)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.12e-10): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.12e-10)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.12e-10))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.12e-10]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.12 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 1.12e-10 < z Initial program 100.0%
Taylor expanded in t around 0 54.5%
mul-1-neg54.5%
distribute-rgt-neg-in54.5%
sub-neg54.5%
+-commutative54.5%
distribute-neg-in54.5%
remove-double-neg54.5%
sub-neg54.5%
Simplified54.5%
Taylor expanded in z around inf 43.0%
Taylor expanded in z around inf 43.0%
*-commutative43.0%
Simplified43.0%
if -1 < z < 1.12e-10Initial program 100.0%
Taylor expanded in y around inf 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around 0 31.6%
Final simplification37.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.25e+129) (* z t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.25e+129) {
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 <= (-2.25d+129)) 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 <= -2.25e+129) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.25e+129: tmp = z * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.25e+129) tmp = Float64(z * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.25e+129) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.25e+129], N[(z * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+129}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.2500000000000001e129Initial program 100.0%
Taylor expanded in y around 0 86.2%
mul-1-neg86.2%
unsub-neg86.2%
Simplified86.2%
Taylor expanded in x around 0 73.8%
neg-mul-173.8%
Simplified73.8%
Taylor expanded in x around 0 39.4%
mul-1-neg39.4%
*-commutative39.4%
distribute-rgt-neg-in39.4%
Simplified39.4%
add-sqr-sqrt18.4%
sqrt-unprod21.8%
sqr-neg21.8%
sqrt-unprod3.5%
add-sqr-sqrt12.0%
pow112.0%
Applied egg-rr12.0%
unpow112.0%
Simplified12.0%
if -2.2500000000000001e129 < z Initial program 100.0%
Taylor expanded in y around inf 66.5%
*-commutative66.5%
Simplified66.5%
Taylor expanded in y around 0 20.3%
(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.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in y around 0 17.4%
(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 2024182
(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))))