
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= (* z 3.0) -5e+15)
(+
x
(+ (/ -0.3333333333333333 (/ z y)) (* (/ t (* z y)) 0.3333333333333333)))
(if (<= (* z 3.0) 4e-7)
(+ x (/ (- y (/ t y)) (* z -3.0)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= -5e+15) {
tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333));
} else if ((z * 3.0) <= 4e-7) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.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 * 3.0d0) <= (-5d+15)) then
tmp = x + (((-0.3333333333333333d0) / (z / y)) + ((t / (z * y)) * 0.3333333333333333d0))
else if ((z * 3.0d0) <= 4d-7) then
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
else
tmp = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= -5e+15) {
tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333));
} else if ((z * 3.0) <= 4e-7) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= -5e+15: tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333)) elif (z * 3.0) <= 4e-7: tmp = x + ((y - (t / y)) / (z * -3.0)) else: tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= -5e+15) tmp = Float64(x + Float64(Float64(-0.3333333333333333 / Float64(z / y)) + Float64(Float64(t / Float64(z * y)) * 0.3333333333333333))); elseif (Float64(z * 3.0) <= 4e-7) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))); else tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= -5e+15) tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333)); elseif ((z * 3.0) <= 4e-7) tmp = x + ((y - (t / y)) / (z * -3.0)); else tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], -5e+15], N[(x + N[(N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * 3.0), $MachinePrecision], 4e-7], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -5 \cdot 10^{+15}:\\
\;\;\;\;x + \left(\frac{-0.3333333333333333}{\frac{z}{y}} + \frac{t}{z \cdot y} \cdot 0.3333333333333333\right)\\
\mathbf{elif}\;z \cdot 3 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\end{array}
\end{array}
if (*.f64 z 3) < -5e15Initial program 99.6%
associate-+l-99.6%
sub-neg99.6%
sub-neg99.6%
distribute-neg-in99.6%
distribute-neg-frac99.6%
neg-mul-199.6%
*-commutative99.6%
times-frac99.6%
remove-double-neg99.6%
fma-def99.6%
metadata-eval99.6%
associate-*l*99.7%
associate-/r*95.9%
associate-/l/95.9%
Simplified95.9%
fma-udef95.9%
clear-num95.9%
un-div-inv95.9%
div-inv95.8%
associate-/l/99.7%
metadata-eval99.7%
Applied egg-rr99.7%
if -5e15 < (*.f64 z 3) < 3.9999999999999998e-7Initial program 93.6%
associate-+l-93.6%
sub-neg93.6%
sub-neg93.6%
distribute-neg-in93.6%
unsub-neg93.6%
neg-mul-193.6%
associate-*r/93.6%
associate-*l/93.6%
distribute-neg-frac93.6%
neg-mul-193.6%
times-frac97.7%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if 3.9999999999999998e-7 < (*.f64 z 3) Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* z 3.0) -5e+15) (not (<= (* z 3.0) 2e+40)))
(+
x
(+ (/ -0.3333333333333333 (/ z y)) (* (/ t (* z y)) 0.3333333333333333)))
(+ x (/ (- y (/ t y)) (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * 3.0) <= -5e+15) || !((z * 3.0) <= 2e+40)) {
tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333));
} else {
tmp = x + ((y - (t / y)) / (z * -3.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z * 3.0d0) <= (-5d+15)) .or. (.not. ((z * 3.0d0) <= 2d+40))) then
tmp = x + (((-0.3333333333333333d0) / (z / y)) + ((t / (z * y)) * 0.3333333333333333d0))
else
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z * 3.0) <= -5e+15) || !((z * 3.0) <= 2e+40)) {
tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333));
} else {
tmp = x + ((y - (t / y)) / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * 3.0) <= -5e+15) or not ((z * 3.0) <= 2e+40): tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333)) else: tmp = x + ((y - (t / y)) / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * 3.0) <= -5e+15) || !(Float64(z * 3.0) <= 2e+40)) tmp = Float64(x + Float64(Float64(-0.3333333333333333 / Float64(z / y)) + Float64(Float64(t / Float64(z * y)) * 0.3333333333333333))); else tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * 3.0) <= -5e+15) || ~(((z * 3.0) <= 2e+40))) tmp = x + ((-0.3333333333333333 / (z / y)) + ((t / (z * y)) * 0.3333333333333333)); else tmp = x + ((y - (t / y)) / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * 3.0), $MachinePrecision], -5e+15], N[Not[LessEqual[N[(z * 3.0), $MachinePrecision], 2e+40]], $MachinePrecision]], N[(x + N[(N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -5 \cdot 10^{+15} \lor \neg \left(z \cdot 3 \leq 2 \cdot 10^{+40}\right):\\
\;\;\;\;x + \left(\frac{-0.3333333333333333}{\frac{z}{y}} + \frac{t}{z \cdot y} \cdot 0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\
\end{array}
\end{array}
if (*.f64 z 3) < -5e15 or 2.00000000000000006e40 < (*.f64 z 3) Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
sub-neg99.7%
distribute-neg-in99.7%
distribute-neg-frac99.7%
neg-mul-199.7%
*-commutative99.7%
times-frac99.6%
remove-double-neg99.6%
fma-def99.6%
metadata-eval99.6%
associate-*l*99.7%
associate-/r*96.8%
associate-/l/96.8%
Simplified96.8%
fma-udef96.8%
clear-num96.8%
un-div-inv96.8%
div-inv96.7%
associate-/l/99.7%
metadata-eval99.7%
Applied egg-rr99.7%
if -5e15 < (*.f64 z 3) < 2.00000000000000006e40Initial program 94.2%
associate-+l-94.2%
sub-neg94.2%
sub-neg94.2%
distribute-neg-in94.2%
unsub-neg94.2%
neg-mul-194.2%
associate-*r/94.2%
associate-*l/94.2%
distribute-neg-frac94.2%
neg-mul-194.2%
times-frac97.9%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e-186) (not (<= y 3e-137))) (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))) (+ x (* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-186) || !(y <= 3e-137)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / 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 ((y <= (-4.8d-186)) .or. (.not. (y <= 3d-137))) then
tmp = x + ((y - (t / y)) * ((-0.3333333333333333d0) / z))
else
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-186) || !(y <= 3e-137)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.8e-186) or not (y <= 3e-137): tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)) else: tmp = x + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.8e-186) || !(y <= 3e-137)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.8e-186) || ~((y <= 3e-137))) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); else tmp = x + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.8e-186], N[Not[LessEqual[y, 3e-137]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-186} \lor \neg \left(y \leq 3 \cdot 10^{-137}\right):\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -4.80000000000000006e-186 or 2.9999999999999998e-137 < y Initial program 98.1%
associate-+l-98.1%
sub-neg98.1%
sub-neg98.1%
distribute-neg-in98.1%
unsub-neg98.1%
neg-mul-198.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-neg-frac98.1%
neg-mul-198.1%
times-frac97.6%
distribute-lft-out--99.2%
*-commutative99.2%
associate-/r*99.2%
metadata-eval99.2%
Simplified99.2%
if -4.80000000000000006e-186 < y < 2.9999999999999998e-137Initial program 91.9%
associate-+l-91.9%
sub-neg91.9%
sub-neg91.9%
distribute-neg-in91.9%
unsub-neg91.9%
neg-mul-191.9%
associate-*r/91.9%
associate-*l/91.9%
distribute-neg-frac91.9%
neg-mul-191.9%
times-frac84.0%
distribute-lft-out--84.0%
*-commutative84.0%
associate-/r*83.9%
metadata-eval83.9%
Simplified83.9%
Taylor expanded in y around 0 91.8%
associate-*r/91.9%
Simplified91.9%
times-frac97.2%
*-commutative97.2%
Applied egg-rr97.2%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-186) (not (<= y 1.5e-131))) (+ x (/ (- y (/ t y)) (* z -3.0))) (+ x (* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-186) || !(y <= 1.5e-131)) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / 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 ((y <= (-4d-186)) .or. (.not. (y <= 1.5d-131))) then
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
else
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-186) || !(y <= 1.5e-131)) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4e-186) or not (y <= 1.5e-131): tmp = x + ((y - (t / y)) / (z * -3.0)) else: tmp = x + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e-186) || !(y <= 1.5e-131)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))); else tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4e-186) || ~((y <= 1.5e-131))) tmp = x + ((y - (t / y)) / (z * -3.0)); else tmp = x + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e-186], N[Not[LessEqual[y, 1.5e-131]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-186} \lor \neg \left(y \leq 1.5 \cdot 10^{-131}\right):\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -3.9999999999999996e-186 or 1.49999999999999998e-131 < y Initial program 98.1%
associate-+l-98.1%
sub-neg98.1%
sub-neg98.1%
distribute-neg-in98.1%
unsub-neg98.1%
neg-mul-198.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-neg-frac98.1%
neg-mul-198.1%
times-frac97.6%
distribute-lft-out--99.2%
*-commutative99.2%
associate-/r*99.2%
metadata-eval99.2%
Simplified99.2%
*-commutative99.2%
clear-num99.2%
un-div-inv99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
if -3.9999999999999996e-186 < y < 1.49999999999999998e-131Initial program 91.9%
associate-+l-91.9%
sub-neg91.9%
sub-neg91.9%
distribute-neg-in91.9%
unsub-neg91.9%
neg-mul-191.9%
associate-*r/91.9%
associate-*l/91.9%
distribute-neg-frac91.9%
neg-mul-191.9%
times-frac84.0%
distribute-lft-out--84.0%
*-commutative84.0%
associate-/r*83.9%
metadata-eval83.9%
Simplified83.9%
Taylor expanded in y around 0 91.8%
associate-*r/91.9%
Simplified91.9%
times-frac97.2%
*-commutative97.2%
Applied egg-rr97.2%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.8e-39) (not (<= y 2.6e+86))) (+ x (/ y (* z -3.0))) (+ x (* (/ t y) (/ 0.3333333333333333 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-39) || !(y <= 2.6e+86)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((t / y) * (0.3333333333333333 / 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 ((y <= (-3.8d-39)) .or. (.not. (y <= 2.6d+86))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = x + ((t / y) * (0.3333333333333333d0 / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-39) || !(y <= 2.6e+86)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((t / y) * (0.3333333333333333 / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.8e-39) or not (y <= 2.6e+86): tmp = x + (y / (z * -3.0)) else: tmp = x + ((t / y) * (0.3333333333333333 / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.8e-39) || !(y <= 2.6e+86)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x + Float64(Float64(t / y) * Float64(0.3333333333333333 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.8e-39) || ~((y <= 2.6e+86))) tmp = x + (y / (z * -3.0)); else tmp = x + ((t / y) * (0.3333333333333333 / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.8e-39], N[Not[LessEqual[y, 2.6e+86]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-39} \lor \neg \left(y \leq 2.6 \cdot 10^{+86}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -3.8000000000000002e-39 or 2.5999999999999998e86 < y Initial program 97.2%
associate-+l-97.2%
sub-neg97.2%
sub-neg97.2%
distribute-neg-in97.2%
unsub-neg97.2%
neg-mul-197.2%
associate-*r/97.2%
associate-*l/97.1%
distribute-neg-frac97.1%
neg-mul-197.1%
times-frac97.1%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 92.5%
associate-*r/92.5%
associate-*l/92.6%
metadata-eval92.6%
associate-/r*92.6%
*-commutative92.6%
associate-*l/92.6%
*-lft-identity92.6%
Simplified92.6%
if -3.8000000000000002e-39 < y < 2.5999999999999998e86Initial program 95.6%
associate-+l-95.6%
sub-neg95.6%
sub-neg95.6%
distribute-neg-in95.6%
unsub-neg95.6%
neg-mul-195.6%
associate-*r/95.6%
associate-*l/95.6%
distribute-neg-frac95.6%
neg-mul-195.6%
times-frac90.8%
distribute-lft-out--90.8%
*-commutative90.8%
associate-/r*90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in y around 0 93.8%
*-commutative93.8%
associate-*l/93.8%
times-frac88.9%
Simplified88.9%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.5e-39) (not (<= y 2.6e+86))) (+ x (/ y (* z -3.0))) (+ x (* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.5e-39) || !(y <= 2.6e+86)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / 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 ((y <= (-1.5d-39)) .or. (.not. (y <= 2.6d+86))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.5e-39) || !(y <= 2.6e+86)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.5e-39) or not (y <= 2.6e+86): tmp = x + (y / (z * -3.0)) else: tmp = x + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.5e-39) || !(y <= 2.6e+86)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.5e-39) || ~((y <= 2.6e+86))) tmp = x + (y / (z * -3.0)); else tmp = x + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.5e-39], N[Not[LessEqual[y, 2.6e+86]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-39} \lor \neg \left(y \leq 2.6 \cdot 10^{+86}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -1.50000000000000014e-39 or 2.5999999999999998e86 < y Initial program 97.2%
associate-+l-97.2%
sub-neg97.2%
sub-neg97.2%
distribute-neg-in97.2%
unsub-neg97.2%
neg-mul-197.2%
associate-*r/97.2%
associate-*l/97.1%
distribute-neg-frac97.1%
neg-mul-197.1%
times-frac97.1%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 92.5%
associate-*r/92.5%
associate-*l/92.6%
metadata-eval92.6%
associate-/r*92.6%
*-commutative92.6%
associate-*l/92.6%
*-lft-identity92.6%
Simplified92.6%
if -1.50000000000000014e-39 < y < 2.5999999999999998e86Initial program 95.6%
associate-+l-95.6%
sub-neg95.6%
sub-neg95.6%
distribute-neg-in95.6%
unsub-neg95.6%
neg-mul-195.6%
associate-*r/95.6%
associate-*l/95.6%
distribute-neg-frac95.6%
neg-mul-195.6%
times-frac90.8%
distribute-lft-out--90.8%
*-commutative90.8%
associate-/r*90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in y around 0 93.8%
associate-*r/93.8%
Simplified93.8%
times-frac95.9%
*-commutative95.9%
Applied egg-rr95.9%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / 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 * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + (y * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + (y * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 96.3%
associate-+l-96.3%
sub-neg96.3%
sub-neg96.3%
distribute-neg-in96.3%
unsub-neg96.3%
neg-mul-196.3%
associate-*r/96.3%
associate-*l/96.3%
distribute-neg-frac96.3%
neg-mul-196.3%
times-frac93.6%
distribute-lft-out--94.8%
*-commutative94.8%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in y around inf 58.5%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (+ x (/ y (* z -3.0))))
double code(double x, double y, double z, double t) {
return x + (y / (z * -3.0));
}
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 * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + (y / (z * -3.0));
}
def code(x, y, z, t): return x + (y / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(y / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + (y / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{z \cdot -3}
\end{array}
Initial program 96.3%
associate-+l-96.3%
sub-neg96.3%
sub-neg96.3%
distribute-neg-in96.3%
unsub-neg96.3%
neg-mul-196.3%
associate-*r/96.3%
associate-*l/96.3%
distribute-neg-frac96.3%
neg-mul-196.3%
times-frac93.6%
distribute-lft-out--94.8%
*-commutative94.8%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
*-commutative94.7%
clear-num94.7%
un-div-inv94.8%
div-inv94.8%
metadata-eval94.8%
Applied egg-rr94.8%
Taylor expanded in y around inf 58.5%
associate-*r/58.5%
associate-*l/58.5%
metadata-eval58.5%
associate-/r*58.5%
*-commutative58.5%
associate-*l/58.6%
*-lft-identity58.6%
Simplified58.6%
Final simplification58.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 96.3%
Taylor expanded in x around inf 25.9%
Final simplification25.9%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / 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 - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2023199
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))