
(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 8 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 (/ (- z x) y)) 2.0))
double code(double x, double y, double z) {
return (-4.0 * ((z - x) / 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) * ((z - x) / y)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return (-4.0 * ((z - x) / y)) + 2.0;
}
def code(x, y, z): return (-4.0 * ((z - x) / y)) + 2.0
function code(x, y, z) return Float64(Float64(-4.0 * Float64(Float64(z - x) / y)) + 2.0) end
function tmp = code(x, y, z) tmp = (-4.0 * ((z - x) / y)) + 2.0; end
code[x_, y_, z_] := N[(N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \frac{z - x}{y} + 2
\end{array}
Initial program 99.2%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
(FPCore (x y z)
:precision binary64
(if (<= x -11500.0)
(* x (/ 4.0 y))
(if (<= x -3.7e-119)
(/ (* -4.0 z) y)
(if (<= x 8e+38) 2.0 (/ (* x 4.0) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -11500.0) {
tmp = x * (4.0 / y);
} else if (x <= -3.7e-119) {
tmp = (-4.0 * z) / y;
} else if (x <= 8e+38) {
tmp = 2.0;
} else {
tmp = (x * 4.0) / 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 <= (-11500.0d0)) then
tmp = x * (4.0d0 / y)
else if (x <= (-3.7d-119)) then
tmp = ((-4.0d0) * z) / y
else if (x <= 8d+38) then
tmp = 2.0d0
else
tmp = (x * 4.0d0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -11500.0) {
tmp = x * (4.0 / y);
} else if (x <= -3.7e-119) {
tmp = (-4.0 * z) / y;
} else if (x <= 8e+38) {
tmp = 2.0;
} else {
tmp = (x * 4.0) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -11500.0: tmp = x * (4.0 / y) elif x <= -3.7e-119: tmp = (-4.0 * z) / y elif x <= 8e+38: tmp = 2.0 else: tmp = (x * 4.0) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -11500.0) tmp = Float64(x * Float64(4.0 / y)); elseif (x <= -3.7e-119) tmp = Float64(Float64(-4.0 * z) / y); elseif (x <= 8e+38) tmp = 2.0; else tmp = Float64(Float64(x * 4.0) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -11500.0) tmp = x * (4.0 / y); elseif (x <= -3.7e-119) tmp = (-4.0 * z) / y; elseif (x <= 8e+38) tmp = 2.0; else tmp = (x * 4.0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -11500.0], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7e-119], N[(N[(-4.0 * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 8e+38], 2.0, N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -11500:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-119}:\\
\;\;\;\;\frac{-4 \cdot z}{y}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+38}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 4}{y}\\
\end{array}
\end{array}
if x < -11500Initial program 97.3%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6476.9%
Simplified76.9%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6478.0%
Applied egg-rr78.0%
if -11500 < x < -3.7000000000000001e-119Initial program 100.0%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6461.3%
Simplified61.3%
if -3.7000000000000001e-119 < x < 7.99999999999999982e38Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified54.1%
if 7.99999999999999982e38 < x Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6478.5%
Simplified78.5%
Final simplification66.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ 4.0 y))))
(if (<= x -6200.0)
t_0
(if (<= x -4.8e-123) (/ (* -4.0 z) y) (if (<= x 1e+39) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -6200.0) {
tmp = t_0;
} else if (x <= -4.8e-123) {
tmp = (-4.0 * z) / y;
} else if (x <= 1e+39) {
tmp = 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x * (4.0d0 / y)
if (x <= (-6200.0d0)) then
tmp = t_0
else if (x <= (-4.8d-123)) then
tmp = ((-4.0d0) * z) / y
else if (x <= 1d+39) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -6200.0) {
tmp = t_0;
} else if (x <= -4.8e-123) {
tmp = (-4.0 * z) / y;
} else if (x <= 1e+39) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (4.0 / y) tmp = 0 if x <= -6200.0: tmp = t_0 elif x <= -4.8e-123: tmp = (-4.0 * z) / y elif x <= 1e+39: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (x <= -6200.0) tmp = t_0; elseif (x <= -4.8e-123) tmp = Float64(Float64(-4.0 * z) / y); elseif (x <= 1e+39) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (4.0 / y); tmp = 0.0; if (x <= -6200.0) tmp = t_0; elseif (x <= -4.8e-123) tmp = (-4.0 * z) / y; elseif (x <= 1e+39) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6200.0], t$95$0, If[LessEqual[x, -4.8e-123], N[(N[(-4.0 * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1e+39], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -6200:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-123}:\\
\;\;\;\;\frac{-4 \cdot z}{y}\\
\mathbf{elif}\;x \leq 10^{+39}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6200 or 9.9999999999999994e38 < x Initial program 98.4%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6477.5%
Simplified77.5%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6478.1%
Applied egg-rr78.1%
if -6200 < x < -4.8e-123Initial program 100.0%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6461.3%
Simplified61.3%
if -4.8e-123 < x < 9.9999999999999994e38Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified54.1%
Final simplification66.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ 4.0 y))))
(if (<= x -19000.0)
t_0
(if (<= x -3.6e-123) (* z (/ -4.0 y)) (if (<= x 4.2e+40) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -19000.0) {
tmp = t_0;
} else if (x <= -3.6e-123) {
tmp = z * (-4.0 / y);
} else if (x <= 4.2e+40) {
tmp = 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x * (4.0d0 / y)
if (x <= (-19000.0d0)) then
tmp = t_0
else if (x <= (-3.6d-123)) then
tmp = z * ((-4.0d0) / y)
else if (x <= 4.2d+40) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -19000.0) {
tmp = t_0;
} else if (x <= -3.6e-123) {
tmp = z * (-4.0 / y);
} else if (x <= 4.2e+40) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (4.0 / y) tmp = 0 if x <= -19000.0: tmp = t_0 elif x <= -3.6e-123: tmp = z * (-4.0 / y) elif x <= 4.2e+40: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (x <= -19000.0) tmp = t_0; elseif (x <= -3.6e-123) tmp = Float64(z * Float64(-4.0 / y)); elseif (x <= 4.2e+40) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (4.0 / y); tmp = 0.0; if (x <= -19000.0) tmp = t_0; elseif (x <= -3.6e-123) tmp = z * (-4.0 / y); elseif (x <= 4.2e+40) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -19000.0], t$95$0, If[LessEqual[x, -3.6e-123], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+40], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -19000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-123}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+40}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -19000 or 4.2000000000000002e40 < x Initial program 98.4%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6477.5%
Simplified77.5%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6478.1%
Applied egg-rr78.1%
if -19000 < x < -3.5999999999999997e-123Initial program 100.0%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6461.3%
Simplified61.3%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6461.1%
Applied egg-rr61.1%
if -3.5999999999999997e-123 < x < 4.2000000000000002e40Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified54.1%
Final simplification66.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ (- z x) y))))
(if (<= x -2.85e+35)
t_0
(if (<= x 3.05e+40) (+ 2.0 (* -4.0 (/ z y))) t_0))))
double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double tmp;
if (x <= -2.85e+35) {
tmp = t_0;
} else if (x <= 3.05e+40) {
tmp = 2.0 + (-4.0 * (z / y));
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-4.0d0) * ((z - x) / y)
if (x <= (-2.85d+35)) then
tmp = t_0
else if (x <= 3.05d+40) then
tmp = 2.0d0 + ((-4.0d0) * (z / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * ((z - x) / y);
double tmp;
if (x <= -2.85e+35) {
tmp = t_0;
} else if (x <= 3.05e+40) {
tmp = 2.0 + (-4.0 * (z / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * ((z - x) / y) tmp = 0 if x <= -2.85e+35: tmp = t_0 elif x <= 3.05e+40: tmp = 2.0 + (-4.0 * (z / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(Float64(z - x) / y)) tmp = 0.0 if (x <= -2.85e+35) tmp = t_0; elseif (x <= 3.05e+40) tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * ((z - x) / y); tmp = 0.0; if (x <= -2.85e+35) tmp = t_0; elseif (x <= 3.05e+40) tmp = 2.0 + (-4.0 * (z / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.85e+35], t$95$0, If[LessEqual[x, 3.05e+40], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z - x}{y}\\
\mathbf{if}\;x \leq -2.85 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{+40}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.84999999999999997e35 or 3.05e40 < x Initial program 98.3%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around 0
Simplified93.0%
if -2.84999999999999997e35 < x < 3.05e40Initial program 100.0%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in z around inf
/-lowering-/.f6490.8%
Simplified90.8%
Final simplification91.8%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+137) 2.0 (if (<= y 4.5e+111) (* -4.0 (/ (- z x) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+137) {
tmp = 2.0;
} else if (y <= 4.5e+111) {
tmp = -4.0 * ((z - x) / 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 (y <= (-5.8d+137)) then
tmp = 2.0d0
else if (y <= 4.5d+111) then
tmp = (-4.0d0) * ((z - x) / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+137) {
tmp = 2.0;
} else if (y <= 4.5e+111) {
tmp = -4.0 * ((z - x) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+137: tmp = 2.0 elif y <= 4.5e+111: tmp = -4.0 * ((z - x) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+137) tmp = 2.0; elseif (y <= 4.5e+111) tmp = Float64(-4.0 * Float64(Float64(z - x) / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+137) tmp = 2.0; elseif (y <= 4.5e+111) tmp = -4.0 * ((z - x) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+137], 2.0, If[LessEqual[y, 4.5e+111], N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+137}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+111}:\\
\;\;\;\;-4 \cdot \frac{z - x}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -5.79999999999999969e137 or 4.50000000000000001e111 < y Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified70.0%
if -5.79999999999999969e137 < y < 4.50000000000000001e111Initial program 99.0%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around 0
Simplified83.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (/ -4.0 y)))) (if (<= z -9e+81) t_0 (if (<= z 6.2e+21) 2.0 t_0))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -9e+81) {
tmp = t_0;
} else if (z <= 6.2e+21) {
tmp = 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = z * ((-4.0d0) / y)
if (z <= (-9d+81)) then
tmp = t_0
else if (z <= 6.2d+21) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -9e+81) {
tmp = t_0;
} else if (z <= 6.2e+21) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) tmp = 0 if z <= -9e+81: tmp = t_0 elif z <= 6.2e+21: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) tmp = 0.0 if (z <= -9e+81) tmp = t_0; elseif (z <= 6.2e+21) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); tmp = 0.0; if (z <= -9e+81) tmp = t_0; elseif (z <= 6.2e+21) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e+81], t$95$0, If[LessEqual[z, 6.2e+21], 2.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
\mathbf{if}\;z \leq -9 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+21}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.00000000000000034e81 or 6.2e21 < z Initial program 98.2%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6460.8%
Simplified60.8%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6461.4%
Applied egg-rr61.4%
if -9.00000000000000034e81 < z < 6.2e21Initial program 99.9%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified43.8%
Final simplification51.1%
(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 99.2%
+-commutativeN/A
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in y around inf
Simplified31.8%
herbie shell --seed 2024138
(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)))