
(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 12 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) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / 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 + ((y - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 94.0%
associate-/l*96.9%
Simplified96.9%
clear-num96.9%
un-div-inv97.1%
Applied egg-rr97.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -8.2e+104)
x
(if (or (<= t -2.5e+40) (and (not (<= t -2.8e-65)) (<= t 10.5)))
(* x (/ z (- t)))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e+104) {
tmp = x;
} else if ((t <= -2.5e+40) || (!(t <= -2.8e-65) && (t <= 10.5))) {
tmp = x * (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 (t <= (-8.2d+104)) then
tmp = x
else if ((t <= (-2.5d+40)) .or. (.not. (t <= (-2.8d-65))) .and. (t <= 10.5d0)) then
tmp = x * (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 (t <= -8.2e+104) {
tmp = x;
} else if ((t <= -2.5e+40) || (!(t <= -2.8e-65) && (t <= 10.5))) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e+104: tmp = x elif (t <= -2.5e+40) or (not (t <= -2.8e-65) and (t <= 10.5)): tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e+104) tmp = x; elseif ((t <= -2.5e+40) || (!(t <= -2.8e-65) && (t <= 10.5))) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.2e+104) tmp = x; elseif ((t <= -2.5e+40) || (~((t <= -2.8e-65)) && (t <= 10.5))) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e+104], x, If[Or[LessEqual[t, -2.5e+40], And[N[Not[LessEqual[t, -2.8e-65]], $MachinePrecision], LessEqual[t, 10.5]]], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+104}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{+40} \lor \neg \left(t \leq -2.8 \cdot 10^{-65}\right) \land t \leq 10.5:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -8.1999999999999997e104 or -2.50000000000000002e40 < t < -2.8e-65 or 10.5 < t Initial program 89.9%
+-commutative89.9%
associate-/l*97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in z around 0 65.9%
if -8.1999999999999997e104 < t < -2.50000000000000002e40 or -2.8e-65 < t < 10.5Initial program 98.3%
+-commutative98.3%
associate-/l*96.0%
fma-define96.0%
Simplified96.0%
Taylor expanded in y around 0 59.3%
mul-1-neg59.3%
unsub-neg59.3%
*-commutative59.3%
associate-*l/59.9%
cancel-sign-sub-inv59.9%
mul-1-neg59.9%
*-lft-identity59.9%
distribute-rgt-in59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in z around inf 50.1%
mul-1-neg50.1%
distribute-frac-neg250.1%
Simplified50.1%
Final simplification58.2%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.25e+105)
x
(if (<= t -1.9e+40)
(* z (/ x (- t)))
(if (<= t -2.8e-65) x (if (<= t 88000.0) (* x (/ z (- t))) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.25e+105) {
tmp = x;
} else if (t <= -1.9e+40) {
tmp = z * (x / -t);
} else if (t <= -2.8e-65) {
tmp = x;
} else if (t <= 88000.0) {
tmp = x * (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 (t <= (-1.25d+105)) then
tmp = x
else if (t <= (-1.9d+40)) then
tmp = z * (x / -t)
else if (t <= (-2.8d-65)) then
tmp = x
else if (t <= 88000.0d0) then
tmp = x * (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 (t <= -1.25e+105) {
tmp = x;
} else if (t <= -1.9e+40) {
tmp = z * (x / -t);
} else if (t <= -2.8e-65) {
tmp = x;
} else if (t <= 88000.0) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.25e+105: tmp = x elif t <= -1.9e+40: tmp = z * (x / -t) elif t <= -2.8e-65: tmp = x elif t <= 88000.0: tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.25e+105) tmp = x; elseif (t <= -1.9e+40) tmp = Float64(z * Float64(x / Float64(-t))); elseif (t <= -2.8e-65) tmp = x; elseif (t <= 88000.0) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.25e+105) tmp = x; elseif (t <= -1.9e+40) tmp = z * (x / -t); elseif (t <= -2.8e-65) tmp = x; elseif (t <= 88000.0) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.25e+105], x, If[LessEqual[t, -1.9e+40], N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.8e-65], x, If[LessEqual[t, 88000.0], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+105}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\mathbf{elif}\;t \leq -2.8 \cdot 10^{-65}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 88000:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.25000000000000011e105 or -1.90000000000000002e40 < t < -2.8e-65 or 88000 < t Initial program 89.9%
+-commutative89.9%
associate-/l*97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in z around 0 65.9%
if -1.25000000000000011e105 < t < -1.90000000000000002e40Initial program 99.5%
+-commutative99.5%
associate-/l*91.6%
fma-define91.7%
Simplified91.7%
Taylor expanded in y around 0 59.7%
mul-1-neg59.7%
unsub-neg59.7%
*-commutative59.7%
associate-*l/59.9%
cancel-sign-sub-inv59.9%
mul-1-neg59.9%
*-lft-identity59.9%
distribute-rgt-in60.0%
mul-1-neg60.0%
unsub-neg60.0%
Simplified60.0%
Taylor expanded in z around inf 45.7%
mul-1-neg45.7%
distribute-frac-neg245.7%
Simplified45.7%
Taylor expanded in x around 0 45.6%
*-commutative45.6%
associate-/l*45.7%
associate-*r*45.7%
neg-mul-145.7%
Simplified45.7%
if -2.8e-65 < t < 88000Initial program 98.2%
+-commutative98.2%
associate-/l*96.4%
fma-define96.5%
Simplified96.5%
Taylor expanded in y around 0 59.2%
mul-1-neg59.2%
unsub-neg59.2%
*-commutative59.2%
associate-*l/59.9%
cancel-sign-sub-inv59.9%
mul-1-neg59.9%
*-lft-identity59.9%
distribute-rgt-in59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in z around inf 50.5%
mul-1-neg50.5%
distribute-frac-neg250.5%
Simplified50.5%
Final simplification58.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.9e-68) (not (<= z 1.1e-162))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.9e-68) || !(z <= 1.1e-162)) {
tmp = x + (z * ((y - x) / 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 ((z <= (-1.9d-68)) .or. (.not. (z <= 1.1d-162))) then
tmp = x + (z * ((y - x) / 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 ((z <= -1.9e-68) || !(z <= 1.1e-162)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.9e-68) or not (z <= 1.1e-162): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.9e-68) || !(z <= 1.1e-162)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.9e-68) || ~((z <= 1.1e-162))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.9e-68], N[Not[LessEqual[z, 1.1e-162]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-68} \lor \neg \left(z \leq 1.1 \cdot 10^{-162}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.90000000000000019e-68 or 1.1e-162 < z Initial program 92.5%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in y around 0 84.6%
associate-/l*87.2%
associate-*r*87.2%
neg-mul-187.2%
associate-*r/87.6%
distribute-rgt-out97.2%
+-commutative97.2%
sub-neg97.2%
associate-*l/92.5%
associate-*r/98.4%
Simplified98.4%
if -1.90000000000000019e-68 < z < 1.1e-162Initial program 97.4%
Taylor expanded in y around inf 93.7%
*-commutative93.7%
Simplified93.7%
Final simplification97.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e-57) (* x (/ (- t z) t)) (if (<= x 1.76e-32) (+ x (/ (* y z) t)) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 1.76e-32) {
tmp = x + ((y * z) / t);
} else {
tmp = x * (1.0 - (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 <= (-1.45d-57)) then
tmp = x * ((t - z) / t)
else if (x <= 1.76d-32) then
tmp = x + ((y * z) / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 1.76e-32) {
tmp = x + ((y * z) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e-57: tmp = x * ((t - z) / t) elif x <= 1.76e-32: tmp = x + ((y * z) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e-57) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif (x <= 1.76e-32) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.45e-57) tmp = x * ((t - z) / t); elseif (x <= 1.76e-32) tmp = x + ((y * z) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e-57], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.76e-32], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;x \leq 1.76 \cdot 10^{-32}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -1.45000000000000013e-57Initial program 91.0%
+-commutative91.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-*l/90.6%
cancel-sign-sub-inv90.6%
mul-1-neg90.6%
*-lft-identity90.6%
distribute-rgt-in90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Taylor expanded in t around 0 90.7%
if -1.45000000000000013e-57 < x < 1.76000000000000004e-32Initial program 97.7%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
Simplified84.5%
if 1.76000000000000004e-32 < x Initial program 92.8%
+-commutative92.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
*-commutative85.5%
associate-*l/89.2%
cancel-sign-sub-inv89.2%
mul-1-neg89.2%
*-lft-identity89.2%
distribute-rgt-in89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e-57) (* x (/ (- t z) t)) (if (<= x 2.85e-33) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 2.85e-33) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (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 <= (-1.45d-57)) then
tmp = x * ((t - z) / t)
else if (x <= 2.85d-33) then
tmp = x + (y / (t / z))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 2.85e-33) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e-57: tmp = x * ((t - z) / t) elif x <= 2.85e-33: tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e-57) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif (x <= 2.85e-33) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.45e-57) tmp = x * ((t - z) / t); elseif (x <= 2.85e-33) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e-57], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.85e-33], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-33}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -1.45000000000000013e-57Initial program 91.0%
+-commutative91.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-*l/90.6%
cancel-sign-sub-inv90.6%
mul-1-neg90.6%
*-lft-identity90.6%
distribute-rgt-in90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Taylor expanded in t around 0 90.7%
if -1.45000000000000013e-57 < x < 2.85000000000000013e-33Initial program 97.7%
associate-/l*91.5%
Simplified91.5%
clear-num91.4%
un-div-inv92.1%
Applied egg-rr92.1%
Taylor expanded in y around inf 84.5%
associate-*l/80.3%
associate-/r/80.7%
Simplified80.7%
if 2.85000000000000013e-33 < x Initial program 92.8%
+-commutative92.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
*-commutative85.5%
associate-*l/89.2%
cancel-sign-sub-inv89.2%
mul-1-neg89.2%
*-lft-identity89.2%
distribute-rgt-in89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.05e-57) (* x (/ (- t z) t)) (if (<= x 3.75e-32) (+ x (* z (/ y t))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.05e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 3.75e-32) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (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 <= (-1.05d-57)) then
tmp = x * ((t - z) / t)
else if (x <= 3.75d-32) then
tmp = x + (z * (y / t))
else
tmp = x * (1.0d0 - (z / 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-57) {
tmp = x * ((t - z) / t);
} else if (x <= 3.75e-32) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.05e-57: tmp = x * ((t - z) / t) elif x <= 3.75e-32: tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.05e-57) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif (x <= 3.75e-32) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.05e-57) tmp = x * ((t - z) / t); elseif (x <= 3.75e-32) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.05e-57], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.75e-32], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;x \leq 3.75 \cdot 10^{-32}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -1.05e-57Initial program 91.0%
+-commutative91.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-*l/90.6%
cancel-sign-sub-inv90.6%
mul-1-neg90.6%
*-lft-identity90.6%
distribute-rgt-in90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Taylor expanded in t around 0 90.7%
if -1.05e-57 < x < 3.74999999999999977e-32Initial program 97.7%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
associate-/l*80.3%
Simplified80.3%
if 3.74999999999999977e-32 < x Initial program 92.8%
+-commutative92.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
*-commutative85.5%
associate-*l/89.2%
cancel-sign-sub-inv89.2%
mul-1-neg89.2%
*-lft-identity89.2%
distribute-rgt-in89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.1e-57) (* x (/ (- t z) t)) (if (<= x 2.6e-36) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 2.6e-36) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 <= (-1.1d-57)) then
tmp = x * ((t - z) / t)
else if (x <= 2.6d-36) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e-57) {
tmp = x * ((t - z) / t);
} else if (x <= 2.6e-36) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.1e-57: tmp = x * ((t - z) / t) elif x <= 2.6e-36: tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.1e-57) tmp = Float64(x * Float64(Float64(t - z) / t)); elseif (x <= 2.6e-36) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.1e-57) tmp = x * ((t - z) / t); elseif (x <= 2.6e-36) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.1e-57], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e-36], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-36}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -1.09999999999999999e-57Initial program 91.0%
+-commutative91.0%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.0%
mul-1-neg84.0%
unsub-neg84.0%
*-commutative84.0%
associate-*l/90.6%
cancel-sign-sub-inv90.6%
mul-1-neg90.6%
*-lft-identity90.6%
distribute-rgt-in90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Taylor expanded in t around 0 90.7%
if -1.09999999999999999e-57 < x < 2.6e-36Initial program 97.7%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in y around inf 84.5%
associate-*r/80.1%
Simplified80.1%
if 2.6e-36 < x Initial program 92.8%
+-commutative92.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
*-commutative85.5%
associate-*l/89.2%
cancel-sign-sub-inv89.2%
mul-1-neg89.2%
*-lft-identity89.2%
distribute-rgt-in89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
(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 94.0%
associate-/l*96.9%
Simplified96.9%
(FPCore (x y z t) :precision binary64 (* x (/ (- t z) t)))
double code(double x, double y, double z, double t) {
return x * ((t - 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 * ((t - z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x * ((t - z) / t);
}
def code(x, y, z, t): return x * ((t - z) / t)
function code(x, y, z, t) return Float64(x * Float64(Float64(t - z) / t)) end
function tmp = code(x, y, z, t) tmp = x * ((t - z) / t); end
code[x_, y_, z_, t_] := N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{t - z}{t}
\end{array}
Initial program 94.0%
+-commutative94.0%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 65.1%
mul-1-neg65.1%
unsub-neg65.1%
*-commutative65.1%
associate-*l/68.7%
cancel-sign-sub-inv68.7%
mul-1-neg68.7%
*-lft-identity68.7%
distribute-rgt-in68.7%
mul-1-neg68.7%
unsub-neg68.7%
Simplified68.7%
Taylor expanded in t around 0 68.7%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 94.0%
+-commutative94.0%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 65.1%
mul-1-neg65.1%
unsub-neg65.1%
*-commutative65.1%
associate-*l/68.7%
cancel-sign-sub-inv68.7%
mul-1-neg68.7%
*-lft-identity68.7%
distribute-rgt-in68.7%
mul-1-neg68.7%
unsub-neg68.7%
Simplified68.7%
(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 94.0%
+-commutative94.0%
associate-/l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in z around 0 39.8%
(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 2024086
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(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)))