
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
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 + ((z - x) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 94.1%
associate-*l/98.4%
Simplified98.4%
*-commutative98.4%
clear-num98.3%
un-div-inv98.4%
Applied egg-rr98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ (- x) t))))
(if (<= t -3.6e-56)
x
(if (<= t -1.9e-296)
t_1
(if (<= t 9.8e-300) (/ x (/ t y)) (if (<= t 8.2e-114) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (-x / t);
double tmp;
if (t <= -3.6e-56) {
tmp = x;
} else if (t <= -1.9e-296) {
tmp = t_1;
} else if (t <= 9.8e-300) {
tmp = x / (t / y);
} else if (t <= 8.2e-114) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * (-x / t)
if (t <= (-3.6d-56)) then
tmp = x
else if (t <= (-1.9d-296)) then
tmp = t_1
else if (t <= 9.8d-300) then
tmp = x / (t / y)
else if (t <= 8.2d-114) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (-x / t);
double tmp;
if (t <= -3.6e-56) {
tmp = x;
} else if (t <= -1.9e-296) {
tmp = t_1;
} else if (t <= 9.8e-300) {
tmp = x / (t / y);
} else if (t <= 8.2e-114) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (-x / t) tmp = 0 if t <= -3.6e-56: tmp = x elif t <= -1.9e-296: tmp = t_1 elif t <= 9.8e-300: tmp = x / (t / y) elif t <= 8.2e-114: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(-x) / t)) tmp = 0.0 if (t <= -3.6e-56) tmp = x; elseif (t <= -1.9e-296) tmp = t_1; elseif (t <= 9.8e-300) tmp = Float64(x / Float64(t / y)); elseif (t <= 8.2e-114) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (-x / t); tmp = 0.0; if (t <= -3.6e-56) tmp = x; elseif (t <= -1.9e-296) tmp = t_1; elseif (t <= 9.8e-300) tmp = x / (t / y); elseif (t <= 8.2e-114) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.6e-56], x, If[LessEqual[t, -1.9e-296], t$95$1, If[LessEqual[t, 9.8e-300], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.2e-114], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-x}{t}\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{-56}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{-296}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 9.8 \cdot 10^{-300}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.59999999999999978e-56 or 8.1999999999999993e-114 < t Initial program 90.9%
+-commutative90.9%
associate-*r/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around 0 56.7%
if -3.59999999999999978e-56 < t < -1.9000000000000001e-296 or 9.8e-300 < t < 8.1999999999999993e-114Initial program 99.2%
associate-/l*88.3%
Simplified88.3%
Taylor expanded in z around 0 51.0%
associate-*r/51.0%
neg-mul-151.0%
Simplified51.0%
Taylor expanded in x around 0 58.2%
mul-1-neg58.2%
sub-neg58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in y around inf 47.3%
associate-*r/47.3%
neg-mul-147.3%
distribute-lft-neg-in47.3%
associate-*r/44.7%
Simplified44.7%
if -1.9000000000000001e-296 < t < 9.8e-300Initial program 99.8%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around 0 7.9%
associate-*r/7.9%
neg-mul-17.9%
Simplified7.9%
Taylor expanded in x around 0 21.3%
mul-1-neg21.3%
sub-neg21.3%
*-commutative21.3%
Simplified21.3%
Taylor expanded in y around inf 7.9%
associate-*r/7.9%
neg-mul-17.9%
distribute-lft-neg-in7.9%
associate-*r/7.9%
Simplified7.9%
add-sqr-sqrt7.9%
sqrt-unprod49.9%
sqr-neg49.9%
sqrt-unprod16.3%
add-sqr-sqrt46.4%
associate-*r/46.4%
*-commutative46.4%
associate-/l*71.6%
Applied egg-rr71.6%
Final simplification52.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.4e-80) (not (<= z 8e-106))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e-80) || !(z <= 8e-106)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (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 <= (-5.4d-80)) .or. (.not. (z <= 8d-106))) then
tmp = x + (z * (y / t))
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e-80) || !(z <= 8e-106)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.4e-80) or not (z <= 8e-106): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.4e-80) || !(z <= 8e-106)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.4e-80) || ~((z <= 8e-106))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.4e-80], N[Not[LessEqual[z, 8e-106]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-80} \lor \neg \left(z \leq 8 \cdot 10^{-106}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -5.4000000000000004e-80 or 7.99999999999999953e-106 < z Initial program 92.7%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in z around inf 85.4%
associate-*l/89.6%
*-commutative89.6%
Simplified89.6%
if -5.4000000000000004e-80 < z < 7.99999999999999953e-106Initial program 96.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around 0 89.0%
associate-*r/89.0%
neg-mul-189.0%
Simplified89.0%
Taylor expanded in x around 0 90.9%
mul-1-neg90.9%
sub-neg90.9%
*-commutative90.9%
Simplified90.9%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.35e-83) (+ x (/ y (/ t z))) (if (<= z 3.5e-104) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.35e-83) {
tmp = x + (y / (t / z));
} else if (z <= 3.5e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (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 <= (-2.35d-83)) then
tmp = x + (y / (t / z))
else if (z <= 3.5d-104) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.35e-83) {
tmp = x + (y / (t / z));
} else if (z <= 3.5e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.35e-83: tmp = x + (y / (t / z)) elif z <= 3.5e-104: tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.35e-83) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 3.5e-104) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.35e-83) tmp = x + (y / (t / z)); elseif (z <= 3.5e-104) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.35e-83], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-104], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-83}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-104}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -2.3500000000000002e-83Initial program 92.2%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 89.4%
if -2.3500000000000002e-83 < z < 3.50000000000000029e-104Initial program 96.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around 0 89.0%
associate-*r/89.0%
neg-mul-189.0%
Simplified89.0%
Taylor expanded in x around 0 90.9%
mul-1-neg90.9%
sub-neg90.9%
*-commutative90.9%
Simplified90.9%
if 3.50000000000000029e-104 < z Initial program 93.0%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 87.1%
associate-*l/91.8%
*-commutative91.8%
Simplified91.8%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.58e-80) (+ x (/ y (/ t z))) (if (<= z 4.3e-104) (* x (- 1.0 (/ y t))) (+ x (/ z (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.58e-80) {
tmp = x + (y / (t / z));
} else if (z <= 4.3e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z / (t / 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 <= (-1.58d-80)) then
tmp = x + (y / (t / z))
else if (z <= 4.3d-104) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (z / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.58e-80) {
tmp = x + (y / (t / z));
} else if (z <= 4.3e-104) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.58e-80: tmp = x + (y / (t / z)) elif z <= 4.3e-104: tmp = x * (1.0 - (y / t)) else: tmp = x + (z / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.58e-80) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 4.3e-104) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.58e-80) tmp = x + (y / (t / z)); elseif (z <= 4.3e-104) tmp = x * (1.0 - (y / t)); else tmp = x + (z / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.58e-80], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e-104], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.58 \cdot 10^{-80}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-104}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -1.58000000000000003e-80Initial program 92.2%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 89.4%
if -1.58000000000000003e-80 < z < 4.3000000000000001e-104Initial program 96.8%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in z around 0 89.0%
associate-*r/89.0%
neg-mul-189.0%
Simplified89.0%
Taylor expanded in x around 0 90.9%
mul-1-neg90.9%
sub-neg90.9%
*-commutative90.9%
Simplified90.9%
if 4.3000000000000001e-104 < z Initial program 93.0%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 87.1%
associate-*l/91.8%
*-commutative91.8%
Simplified91.8%
clear-num91.7%
div-inv91.8%
Applied egg-rr91.8%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (<= z -3.3e-80) (+ x (/ y (/ t z))) (if (<= z 3e-104) (- x (* x (/ y t))) (+ x (/ z (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e-80) {
tmp = x + (y / (t / z));
} else if (z <= 3e-104) {
tmp = x - (x * (y / t));
} else {
tmp = x + (z / (t / 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 <= (-3.3d-80)) then
tmp = x + (y / (t / z))
else if (z <= 3d-104) then
tmp = x - (x * (y / t))
else
tmp = x + (z / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e-80) {
tmp = x + (y / (t / z));
} else if (z <= 3e-104) {
tmp = x - (x * (y / t));
} else {
tmp = x + (z / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.3e-80: tmp = x + (y / (t / z)) elif z <= 3e-104: tmp = x - (x * (y / t)) else: tmp = x + (z / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.3e-80) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 3e-104) tmp = Float64(x - Float64(x * Float64(y / t))); else tmp = Float64(x + Float64(z / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.3e-80) tmp = x + (y / (t / z)); elseif (z <= 3e-104) tmp = x - (x * (y / t)); else tmp = x + (z / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.3e-80], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-104], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-80}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-104}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if z < -3.3e-80Initial program 92.2%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 89.4%
if -3.3e-80 < z < 3.0000000000000002e-104Initial program 96.8%
+-commutative96.8%
associate-*r/95.8%
fma-def95.7%
Simplified95.7%
Taylor expanded in z around 0 88.9%
+-commutative88.9%
mul-1-neg88.9%
unsub-neg88.9%
*-commutative88.9%
associate-*r/90.9%
Simplified90.9%
if 3.0000000000000002e-104 < z Initial program 93.0%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 87.1%
associate-*l/91.8%
*-commutative91.8%
Simplified91.8%
clear-num91.7%
div-inv91.8%
Applied egg-rr91.8%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.35e-55) x (if (<= t 6e-96) (* x (/ (- y) t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.35e-55) {
tmp = x;
} else if (t <= 6e-96) {
tmp = x * (-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 (t <= (-1.35d-55)) then
tmp = x
else if (t <= 6d-96) then
tmp = x * (-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 (t <= -1.35e-55) {
tmp = x;
} else if (t <= 6e-96) {
tmp = x * (-y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.35e-55: tmp = x elif t <= 6e-96: tmp = x * (-y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.35e-55) tmp = x; elseif (t <= 6e-96) tmp = Float64(x * Float64(Float64(-y) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.35e-55) tmp = x; elseif (t <= 6e-96) tmp = x * (-y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.35e-55], x, If[LessEqual[t, 6e-96], N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-55}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-96}:\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.35000000000000002e-55 or 6e-96 < t Initial program 90.6%
+-commutative90.6%
associate-*r/98.6%
fma-def98.5%
Simplified98.5%
Taylor expanded in y around 0 57.5%
if -1.35000000000000002e-55 < t < 6e-96Initial program 99.3%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in z around 0 47.2%
associate-*r/47.2%
neg-mul-147.2%
Simplified47.2%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
sub-neg55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in y around inf 42.9%
associate-*r/42.9%
neg-mul-142.9%
distribute-rgt-neg-in42.9%
associate-*l/45.7%
Simplified45.7%
Final simplification52.7%
(FPCore (x y z t) :precision binary64 (if (<= t -4.4e-54) x (if (<= t 2.1e-97) (/ (- x) (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.4e-54) {
tmp = x;
} else if (t <= 2.1e-97) {
tmp = -x / (t / y);
} 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 <= (-4.4d-54)) then
tmp = x
else if (t <= 2.1d-97) then
tmp = -x / (t / y)
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 <= -4.4e-54) {
tmp = x;
} else if (t <= 2.1e-97) {
tmp = -x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.4e-54: tmp = x elif t <= 2.1e-97: tmp = -x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.4e-54) tmp = x; elseif (t <= 2.1e-97) tmp = Float64(Float64(-x) / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.4e-54) tmp = x; elseif (t <= 2.1e-97) tmp = -x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.4e-54], x, If[LessEqual[t, 2.1e-97], N[((-x) / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{-x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.3999999999999999e-54 or 2.1000000000000001e-97 < t Initial program 90.6%
+-commutative90.6%
associate-*r/98.6%
fma-def98.5%
Simplified98.5%
Taylor expanded in y around 0 57.5%
if -4.3999999999999999e-54 < t < 2.1000000000000001e-97Initial program 99.3%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in z around 0 47.2%
associate-*r/47.2%
neg-mul-147.2%
Simplified47.2%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
sub-neg55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in y around inf 42.9%
associate-*r/42.9%
neg-mul-142.9%
distribute-lft-neg-in42.9%
associate-*r/40.7%
Simplified40.7%
Taylor expanded in y around 0 42.9%
mul-1-neg42.9%
*-commutative42.9%
associate-/l*45.7%
distribute-neg-frac45.7%
Simplified45.7%
Final simplification52.7%
(FPCore (x y z t) :precision binary64 (if (<= t -8.8e-200) x (if (<= t 3e-214) (/ x (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.8e-200) {
tmp = x;
} else if (t <= 3e-214) {
tmp = x / (t / y);
} 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.8d-200)) then
tmp = x
else if (t <= 3d-214) then
tmp = x / (t / y)
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.8e-200) {
tmp = x;
} else if (t <= 3e-214) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.8e-200: tmp = x elif t <= 3e-214: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.8e-200) tmp = x; elseif (t <= 3e-214) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.8e-200) tmp = x; elseif (t <= 3e-214) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.8e-200], x, If[LessEqual[t, 3e-214], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-200}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-214}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -8.80000000000000054e-200 or 2.99999999999999994e-214 < t Initial program 93.0%
+-commutative93.0%
associate-*r/96.7%
fma-def96.7%
Simplified96.7%
Taylor expanded in y around 0 46.4%
if -8.80000000000000054e-200 < t < 2.99999999999999994e-214Initial program 99.8%
associate-/l*85.8%
Simplified85.8%
Taylor expanded in z around 0 30.4%
associate-*r/30.4%
neg-mul-130.4%
Simplified30.4%
Taylor expanded in x around 0 39.7%
mul-1-neg39.7%
sub-neg39.7%
*-commutative39.7%
Simplified39.7%
Taylor expanded in y around inf 35.9%
associate-*r/35.9%
neg-mul-135.9%
distribute-lft-neg-in35.9%
associate-*r/30.4%
Simplified30.4%
add-sqr-sqrt16.0%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod10.4%
add-sqr-sqrt23.1%
associate-*r/21.1%
*-commutative21.1%
associate-/l*27.3%
Applied egg-rr27.3%
Final simplification43.2%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / 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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 94.1%
associate-*l/98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (y / 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 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (y / t));
}
def code(x, y, z, t): return x * (1.0 - (y / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (y / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{y}{t}\right)
\end{array}
Initial program 94.1%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in z around 0 59.7%
associate-*r/59.7%
neg-mul-159.7%
Simplified59.7%
Taylor expanded in x around 0 62.6%
mul-1-neg62.6%
sub-neg62.6%
*-commutative62.6%
Simplified62.6%
Final simplification62.6%
(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.1%
+-commutative94.1%
associate-*r/94.7%
fma-def94.7%
Simplified94.7%
Taylor expanded in y around 0 39.0%
Final simplification39.0%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / 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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2023194
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))