
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ (* 4.0 (/ (- x z) y)) 2.0))
double code(double x, double y, double z) {
return (4.0 * ((x - z) / y)) + 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (4.0d0 * ((x - z) / y)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - z) / y)) + 2.0;
}
def code(x, y, z): return (4.0 * ((x - z) / y)) + 2.0
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - z) / y)) + 2.0) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - z) / y)) + 2.0; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x - z}{y} + 2
\end{array}
Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 4.0 (/ y x)))) (t_1 (+ 1.0 (* -4.0 (/ z y)))))
(if (<= z -640.0)
t_1
(if (<= z -4.6e-249)
t_0
(if (<= z 6.2e-278)
2.0
(if (<= z 7.2e-179) t_0 (if (<= z 950000.0) 2.0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 / (y / x));
double t_1 = 1.0 + (-4.0 * (z / y));
double tmp;
if (z <= -640.0) {
tmp = t_1;
} else if (z <= -4.6e-249) {
tmp = t_0;
} else if (z <= 6.2e-278) {
tmp = 2.0;
} else if (z <= 7.2e-179) {
tmp = t_0;
} else if (z <= 950000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (4.0d0 / (y / x))
t_1 = 1.0d0 + ((-4.0d0) * (z / y))
if (z <= (-640.0d0)) then
tmp = t_1
else if (z <= (-4.6d-249)) then
tmp = t_0
else if (z <= 6.2d-278) then
tmp = 2.0d0
else if (z <= 7.2d-179) then
tmp = t_0
else if (z <= 950000.0d0) then
tmp = 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 / (y / x));
double t_1 = 1.0 + (-4.0 * (z / y));
double tmp;
if (z <= -640.0) {
tmp = t_1;
} else if (z <= -4.6e-249) {
tmp = t_0;
} else if (z <= 6.2e-278) {
tmp = 2.0;
} else if (z <= 7.2e-179) {
tmp = t_0;
} else if (z <= 950000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (4.0 / (y / x)) t_1 = 1.0 + (-4.0 * (z / y)) tmp = 0 if z <= -640.0: tmp = t_1 elif z <= -4.6e-249: tmp = t_0 elif z <= 6.2e-278: tmp = 2.0 elif z <= 7.2e-179: tmp = t_0 elif z <= 950000.0: tmp = 2.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(4.0 / Float64(y / x))) t_1 = Float64(1.0 + Float64(-4.0 * Float64(z / y))) tmp = 0.0 if (z <= -640.0) tmp = t_1; elseif (z <= -4.6e-249) tmp = t_0; elseif (z <= 6.2e-278) tmp = 2.0; elseif (z <= 7.2e-179) tmp = t_0; elseif (z <= 950000.0) tmp = 2.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (4.0 / (y / x)); t_1 = 1.0 + (-4.0 * (z / y)); tmp = 0.0; if (z <= -640.0) tmp = t_1; elseif (z <= -4.6e-249) tmp = t_0; elseif (z <= 6.2e-278) tmp = 2.0; elseif (z <= 7.2e-179) tmp = t_0; elseif (z <= 950000.0) tmp = 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(4.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -640.0], t$95$1, If[LessEqual[z, -4.6e-249], t$95$0, If[LessEqual[z, 6.2e-278], 2.0, If[LessEqual[z, 7.2e-179], t$95$0, If[LessEqual[z, 950000.0], 2.0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{4}{\frac{y}{x}}\\
t_1 := 1 + -4 \cdot \frac{z}{y}\\
\mathbf{if}\;z \leq -640:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-249}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-278}:\\
\;\;\;\;2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 950000:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -640 or 9.5e5 < z Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 68.3%
*-commutative68.3%
Simplified68.3%
if -640 < z < -4.5999999999999996e-249 or 6.19999999999999983e-278 < z < 7.20000000000000015e-179Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in x around inf 65.4%
associate-*r/65.4%
associate-/l*65.2%
Simplified65.2%
if -4.5999999999999996e-249 < z < 6.19999999999999983e-278 or 7.20000000000000015e-179 < z < 9.5e5Initial program 100.0%
associate-/l*99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around inf 67.1%
Final simplification67.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* 4.0 x) y))) (t_1 (+ 1.0 (* -4.0 (/ z y)))))
(if (<= z -1600.0)
t_1
(if (<= z -8.8e-250)
t_0
(if (<= z 1.45e-276)
2.0
(if (<= z 7.6e-181) t_0 (if (<= z 245000.0) 2.0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((4.0 * x) / y);
double t_1 = 1.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1600.0) {
tmp = t_1;
} else if (z <= -8.8e-250) {
tmp = t_0;
} else if (z <= 1.45e-276) {
tmp = 2.0;
} else if (z <= 7.6e-181) {
tmp = t_0;
} else if (z <= 245000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((4.0d0 * x) / y)
t_1 = 1.0d0 + ((-4.0d0) * (z / y))
if (z <= (-1600.0d0)) then
tmp = t_1
else if (z <= (-8.8d-250)) then
tmp = t_0
else if (z <= 1.45d-276) then
tmp = 2.0d0
else if (z <= 7.6d-181) then
tmp = t_0
else if (z <= 245000.0d0) then
tmp = 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((4.0 * x) / y);
double t_1 = 1.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1600.0) {
tmp = t_1;
} else if (z <= -8.8e-250) {
tmp = t_0;
} else if (z <= 1.45e-276) {
tmp = 2.0;
} else if (z <= 7.6e-181) {
tmp = t_0;
} else if (z <= 245000.0) {
tmp = 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((4.0 * x) / y) t_1 = 1.0 + (-4.0 * (z / y)) tmp = 0 if z <= -1600.0: tmp = t_1 elif z <= -8.8e-250: tmp = t_0 elif z <= 1.45e-276: tmp = 2.0 elif z <= 7.6e-181: tmp = t_0 elif z <= 245000.0: tmp = 2.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(4.0 * x) / y)) t_1 = Float64(1.0 + Float64(-4.0 * Float64(z / y))) tmp = 0.0 if (z <= -1600.0) tmp = t_1; elseif (z <= -8.8e-250) tmp = t_0; elseif (z <= 1.45e-276) tmp = 2.0; elseif (z <= 7.6e-181) tmp = t_0; elseif (z <= 245000.0) tmp = 2.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((4.0 * x) / y); t_1 = 1.0 + (-4.0 * (z / y)); tmp = 0.0; if (z <= -1600.0) tmp = t_1; elseif (z <= -8.8e-250) tmp = t_0; elseif (z <= 1.45e-276) tmp = 2.0; elseif (z <= 7.6e-181) tmp = t_0; elseif (z <= 245000.0) tmp = 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1600.0], t$95$1, If[LessEqual[z, -8.8e-250], t$95$0, If[LessEqual[z, 1.45e-276], 2.0, If[LessEqual[z, 7.6e-181], t$95$0, If[LessEqual[z, 245000.0], 2.0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{4 \cdot x}{y}\\
t_1 := 1 + -4 \cdot \frac{z}{y}\\
\mathbf{if}\;z \leq -1600:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8.8 \cdot 10^{-250}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-276}:\\
\;\;\;\;2\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-181}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 245000:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1600 or 245000 < z Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 68.3%
*-commutative68.3%
Simplified68.3%
if -1600 < z < -8.8e-250 or 1.44999999999999994e-276 < z < 7.5999999999999996e-181Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in x around inf 65.4%
associate-*r/65.4%
*-commutative65.4%
Simplified65.4%
if -8.8e-250 < z < 1.44999999999999994e-276 or 7.5999999999999996e-181 < z < 245000Initial program 100.0%
associate-/l*99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around inf 67.1%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.2e-31) (not (<= y 1.75e+136))) (+ 2.0 (* -4.0 (/ z y))) (+ 1.0 (/ 4.0 (/ y (- x z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e-31) || !(y <= 1.75e+136)) {
tmp = 2.0 + (-4.0 * (z / y));
} else {
tmp = 1.0 + (4.0 / (y / (x - z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-7.2d-31)) .or. (.not. (y <= 1.75d+136))) then
tmp = 2.0d0 + ((-4.0d0) * (z / y))
else
tmp = 1.0d0 + (4.0d0 / (y / (x - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e-31) || !(y <= 1.75e+136)) {
tmp = 2.0 + (-4.0 * (z / y));
} else {
tmp = 1.0 + (4.0 / (y / (x - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.2e-31) or not (y <= 1.75e+136): tmp = 2.0 + (-4.0 * (z / y)) else: tmp = 1.0 + (4.0 / (y / (x - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.2e-31) || !(y <= 1.75e+136)) tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); else tmp = Float64(1.0 + Float64(4.0 / Float64(y / Float64(x - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.2e-31) || ~((y <= 1.75e+136))) tmp = 2.0 + (-4.0 * (z / y)); else tmp = 1.0 + (4.0 / (y / (x - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.2e-31], N[Not[LessEqual[y, 1.75e+136]], $MachinePrecision]], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(4.0 / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-31} \lor \neg \left(y \leq 1.75 \cdot 10^{+136}\right):\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{4}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if y < -7.20000000000000007e-31 or 1.75000000000000001e136 < y Initial program 99.9%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 89.4%
if -7.20000000000000007e-31 < y < 1.75000000000000001e136Initial program 100.0%
associate-/l*99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 90.0%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.95e+31) (not (<= z 450000.0))) (+ 1.0 (* -4.0 (/ z y))) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e+31) || !(z <= 450000.0)) {
tmp = 1.0 + (-4.0 * (z / y));
} else {
tmp = 2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.95d+31)) .or. (.not. (z <= 450000.0d0))) then
tmp = 1.0d0 + ((-4.0d0) * (z / y))
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e+31) || !(z <= 450000.0)) {
tmp = 1.0 + (-4.0 * (z / y));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.95e+31) or not (z <= 450000.0): tmp = 1.0 + (-4.0 * (z / y)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.95e+31) || !(z <= 450000.0)) tmp = Float64(1.0 + Float64(-4.0 * Float64(z / y))); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.95e+31) || ~((z <= 450000.0))) tmp = 1.0 + (-4.0 * (z / y)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.95e+31], N[Not[LessEqual[z, 450000.0]], $MachinePrecision]], N[(1.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+31} \lor \neg \left(z \leq 450000\right):\\
\;\;\;\;1 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if z < -1.95e31 or 4.5e5 < z Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 70.7%
*-commutative70.7%
Simplified70.7%
if -1.95e31 < z < 4.5e5Initial program 100.0%
associate-/l*99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around inf 50.4%
Final simplification60.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.62e+112) (not (<= x 5e+140))) (+ 1.0 (/ (* 4.0 x) y)) (+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.62e+112) || !(x <= 5e+140)) {
tmp = 1.0 + ((4.0 * x) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.62d+112)) .or. (.not. (x <= 5d+140))) then
tmp = 1.0d0 + ((4.0d0 * x) / y)
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.62e+112) || !(x <= 5e+140)) {
tmp = 1.0 + ((4.0 * x) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.62e+112) or not (x <= 5e+140): tmp = 1.0 + ((4.0 * x) / y) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.62e+112) || !(x <= 5e+140)) tmp = Float64(1.0 + Float64(Float64(4.0 * x) / y)); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.62e+112) || ~((x <= 5e+140))) tmp = 1.0 + ((4.0 * x) / y); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.62e+112], N[Not[LessEqual[x, 5e+140]], $MachinePrecision]], N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.62 \cdot 10^{+112} \lor \neg \left(x \leq 5 \cdot 10^{+140}\right):\\
\;\;\;\;1 + \frac{4 \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -1.61999999999999994e112 or 5.00000000000000008e140 < x Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in x around inf 77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
if -1.61999999999999994e112 < x < 5.00000000000000008e140Initial program 100.0%
associate-/l*99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 85.5%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.1e+107) (not (<= x 1.25e+107))) (+ 2.0 (* 4.0 (/ x y))) (+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.1e+107) || !(x <= 1.25e+107)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-4.1d+107)) .or. (.not. (x <= 1.25d+107))) then
tmp = 2.0d0 + (4.0d0 * (x / y))
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.1e+107) || !(x <= 1.25e+107)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.1e+107) or not (x <= 1.25e+107): tmp = 2.0 + (4.0 * (x / y)) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.1e+107) || !(x <= 1.25e+107)) tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.1e+107) || ~((x <= 1.25e+107))) tmp = 2.0 + (4.0 * (x / y)); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.1e+107], N[Not[LessEqual[x, 1.25e+107]], $MachinePrecision]], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{+107} \lor \neg \left(x \leq 1.25 \cdot 10^{+107}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -4.0999999999999999e107 or 1.25e107 < x Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 86.7%
if -4.0999999999999999e107 < x < 1.25e107Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 87.2%
Final simplification87.0%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 45.9%
*-commutative45.9%
Simplified45.9%
Taylor expanded in z around 0 8.3%
Final simplification8.3%
(FPCore (x y z) :precision binary64 2.0)
double code(double x, double y, double z) {
return 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0
end function
public static double code(double x, double y, double z) {
return 2.0;
}
def code(x, y, z): return 2.0
function code(x, y, z) return 2.0 end
function tmp = code(x, y, z) tmp = 2.0; end
code[x_, y_, z_] := 2.0
\begin{array}{l}
\\
2
\end{array}
Initial program 100.0%
associate-/l*99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around inf 34.5%
Final simplification34.5%
herbie shell --seed 2023178
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))