
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 93.7%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))) (t_2 (* x (- 1.0 (/ z t)))))
(if (<= y -4e+204)
t_1
(if (<= y -5.2e+43)
t_2
(if (<= y -6.4e-27) (* z (/ y t)) (if (<= y 1.6e+112) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double t_2 = x * (1.0 - (z / t));
double tmp;
if (y <= -4e+204) {
tmp = t_1;
} else if (y <= -5.2e+43) {
tmp = t_2;
} else if (y <= -6.4e-27) {
tmp = z * (y / t);
} else if (y <= 1.6e+112) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * (z / t)
t_2 = x * (1.0d0 - (z / t))
if (y <= (-4d+204)) then
tmp = t_1
else if (y <= (-5.2d+43)) then
tmp = t_2
else if (y <= (-6.4d-27)) then
tmp = z * (y / t)
else if (y <= 1.6d+112) then
tmp = t_2
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 t_2 = x * (1.0 - (z / t));
double tmp;
if (y <= -4e+204) {
tmp = t_1;
} else if (y <= -5.2e+43) {
tmp = t_2;
} else if (y <= -6.4e-27) {
tmp = z * (y / t);
} else if (y <= 1.6e+112) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) t_2 = x * (1.0 - (z / t)) tmp = 0 if y <= -4e+204: tmp = t_1 elif y <= -5.2e+43: tmp = t_2 elif y <= -6.4e-27: tmp = z * (y / t) elif y <= 1.6e+112: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) t_2 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (y <= -4e+204) tmp = t_1; elseif (y <= -5.2e+43) tmp = t_2; elseif (y <= -6.4e-27) tmp = Float64(z * Float64(y / t)); elseif (y <= 1.6e+112) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); t_2 = x * (1.0 - (z / t)); tmp = 0.0; if (y <= -4e+204) tmp = t_1; elseif (y <= -5.2e+43) tmp = t_2; elseif (y <= -6.4e-27) tmp = z * (y / t); elseif (y <= 1.6e+112) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e+204], t$95$1, If[LessEqual[y, -5.2e+43], t$95$2, If[LessEqual[y, -6.4e-27], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+112], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{+43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -6.4 \cdot 10^{-27}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+112}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.99999999999999996e204 or 1.59999999999999993e112 < y Initial program 90.4%
associate-/l*98.6%
Simplified98.6%
Taylor expanded in z around inf 61.4%
Taylor expanded in y around inf 67.2%
clear-num67.2%
un-div-inv68.2%
Applied egg-rr68.2%
associate-/r/77.8%
Applied egg-rr77.8%
if -3.99999999999999996e204 < y < -5.20000000000000042e43 or -6.39999999999999982e-27 < y < 1.59999999999999993e112Initial program 95.2%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in x around inf 83.4%
mul-1-neg83.4%
unsub-neg83.4%
Simplified83.4%
if -5.20000000000000042e43 < y < -6.39999999999999982e-27Initial program 91.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 82.0%
Taylor expanded in y around inf 82.2%
Final simplification81.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= y -1.6e-31)
t_1
(if (<= y -4.4e-168) (* x (/ z (- t))) (if (<= y 5.4e+109) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (y <= -1.6e-31) {
tmp = t_1;
} else if (y <= -4.4e-168) {
tmp = x * (z / -t);
} else if (y <= 5.4e+109) {
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 (y <= (-1.6d-31)) then
tmp = t_1
else if (y <= (-4.4d-168)) then
tmp = x * (z / -t)
else if (y <= 5.4d+109) 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 (y <= -1.6e-31) {
tmp = t_1;
} else if (y <= -4.4e-168) {
tmp = x * (z / -t);
} else if (y <= 5.4e+109) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if y <= -1.6e-31: tmp = t_1 elif y <= -4.4e-168: tmp = x * (z / -t) elif y <= 5.4e+109: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (y <= -1.6e-31) tmp = t_1; elseif (y <= -4.4e-168) tmp = Float64(x * Float64(z / Float64(-t))); elseif (y <= 5.4e+109) 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 (y <= -1.6e-31) tmp = t_1; elseif (y <= -4.4e-168) tmp = x * (z / -t); elseif (y <= 5.4e+109) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.6e-31], t$95$1, If[LessEqual[y, -4.4e-168], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+109], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.4 \cdot 10^{-168}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+109}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.60000000000000009e-31 or 5.40000000000000003e109 < y Initial program 92.0%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around inf 63.1%
Taylor expanded in y around inf 61.7%
clear-num61.7%
un-div-inv62.3%
Applied egg-rr62.3%
associate-/r/68.0%
Applied egg-rr68.0%
if -1.60000000000000009e-31 < y < -4.3999999999999996e-168Initial program 89.5%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around inf 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Taylor expanded in z around inf 58.5%
mul-1-neg58.5%
distribute-frac-neg58.5%
Simplified58.5%
if -4.3999999999999996e-168 < y < 5.40000000000000003e109Initial program 96.0%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in z around 0 62.1%
Final simplification64.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.05e-90) (not (<= x 2.15e+62))) (* x (- 1.0 (/ z t))) (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e-90) || !(x <= 2.15e+62)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * ((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 ((x <= (-1.05d-90)) .or. (.not. (x <= 2.15d+62))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = z * ((y - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e-90) || !(x <= 2.15e+62)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * ((y - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.05e-90) or not (x <= 2.15e+62): tmp = x * (1.0 - (z / t)) else: tmp = z * ((y - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.05e-90) || !(x <= 2.15e+62)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(z * Float64(Float64(y - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.05e-90) || ~((x <= 2.15e+62))) tmp = x * (1.0 - (z / t)); else tmp = z * ((y - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.05e-90], N[Not[LessEqual[x, 2.15e+62]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-90} \lor \neg \left(x \leq 2.15 \cdot 10^{+62}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if x < -1.05e-90 or 2.1499999999999998e62 < x Initial program 92.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 87.4%
mul-1-neg87.4%
unsub-neg87.4%
Simplified87.4%
if -1.05e-90 < x < 2.1499999999999998e62Initial program 95.8%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in z around inf 66.5%
Taylor expanded in y around 0 66.5%
mul-1-neg66.5%
distribute-frac-neg266.5%
+-commutative66.5%
distribute-frac-neg266.5%
sub-neg66.5%
div-sub68.6%
Simplified68.6%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+76) (not (<= x 4.2e+137))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+76) || !(x <= 4.2e+137)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-7.2d+76)) .or. (.not. (x <= 4.2d+137))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+76) || !(x <= 4.2e+137)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e+76) or not (x <= 4.2e+137): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e+76) || !(x <= 4.2e+137)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e+76) || ~((x <= 4.2e+137))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+76], N[Not[LessEqual[x, 4.2e+137]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+76} \lor \neg \left(x \leq 4.2 \cdot 10^{+137}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -7.2000000000000006e76 or 4.1999999999999998e137 < x Initial program 90.6%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 94.5%
mul-1-neg94.5%
unsub-neg94.5%
Simplified94.5%
if -7.2000000000000006e76 < x < 4.1999999999999998e137Initial program 95.6%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in y around inf 85.0%
associate-*r/89.2%
Simplified89.2%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02e-22) (not (<= z 1.28e+61))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-22) || !(z <= 1.28e+61)) {
tmp = z * (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 ((z <= (-1.02d-22)) .or. (.not. (z <= 1.28d+61))) then
tmp = z * (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 ((z <= -1.02e-22) || !(z <= 1.28e+61)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02e-22) or not (z <= 1.28e+61): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02e-22) || !(z <= 1.28e+61)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.02e-22) || ~((z <= 1.28e+61))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02e-22], N[Not[LessEqual[z, 1.28e+61]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-22} \lor \neg \left(z \leq 1.28 \cdot 10^{+61}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.02000000000000002e-22 or 1.27999999999999996e61 < z Initial program 87.5%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in z around inf 79.6%
Taylor expanded in y around inf 58.8%
if -1.02000000000000002e-22 < z < 1.27999999999999996e61Initial program 98.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around 0 62.7%
Final simplification61.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e-27) (not (<= y 4.5e+109))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e-27) || !(y <= 4.5e+109)) {
tmp = y * (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 ((y <= (-1.25d-27)) .or. (.not. (y <= 4.5d+109))) then
tmp = y * (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 ((y <= -1.25e-27) || !(y <= 4.5e+109)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e-27) or not (y <= 4.5e+109): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e-27) || !(y <= 4.5e+109)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e-27) || ~((y <= 4.5e+109))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e-27], N[Not[LessEqual[y, 4.5e+109]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-27} \lor \neg \left(y \leq 4.5 \cdot 10^{+109}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.25e-27 or 4.4999999999999996e109 < y Initial program 92.0%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around inf 63.1%
Taylor expanded in y around inf 61.7%
clear-num61.7%
un-div-inv62.3%
Applied egg-rr62.3%
associate-/r/68.0%
Applied egg-rr68.0%
if -1.25e-27 < y < 4.4999999999999996e109Initial program 95.2%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in z around 0 57.4%
Final simplification62.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 93.7%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in z around 0 43.2%
Final simplification43.2%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / 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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024039
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))