
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\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.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 4.0 (* (/ 4.0 y) (- x z))))
double code(double x, double y, double z) {
return 4.0 + ((4.0 / y) * (x - z));
}
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 + ((4.0d0 / y) * (x - z))
end function
public static double code(double x, double y, double z) {
return 4.0 + ((4.0 / y) * (x - z));
}
def code(x, y, z): return 4.0 + ((4.0 / y) * (x - z))
function code(x, y, z) return Float64(4.0 + Float64(Float64(4.0 / y) * Float64(x - z))) end
function tmp = code(x, y, z) tmp = 4.0 + ((4.0 / y) * (x - z)); end
code[x_, y_, z_] := N[(4.0 + N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + \frac{4}{y} \cdot \left(x - z\right)
\end{array}
Initial program 98.8%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.3%
Simplified99.3%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(if (<= x -11500.0)
(* (/ 4.0 y) x)
(if (<= x -3.7e-119)
(/ (* z -4.0) y)
(if (<= x 8e+38) 4.0 (/ (* 4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -11500.0) {
tmp = (4.0 / y) * x;
} else if (x <= -3.7e-119) {
tmp = (z * -4.0) / y;
} else if (x <= 8e+38) {
tmp = 4.0;
} else {
tmp = (4.0 * x) / 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 = (4.0d0 / y) * x
else if (x <= (-3.7d-119)) then
tmp = (z * (-4.0d0)) / y
else if (x <= 8d+38) then
tmp = 4.0d0
else
tmp = (4.0d0 * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -11500.0) {
tmp = (4.0 / y) * x;
} else if (x <= -3.7e-119) {
tmp = (z * -4.0) / y;
} else if (x <= 8e+38) {
tmp = 4.0;
} else {
tmp = (4.0 * x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -11500.0: tmp = (4.0 / y) * x elif x <= -3.7e-119: tmp = (z * -4.0) / y elif x <= 8e+38: tmp = 4.0 else: tmp = (4.0 * x) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -11500.0) tmp = Float64(Float64(4.0 / y) * x); elseif (x <= -3.7e-119) tmp = Float64(Float64(z * -4.0) / y); elseif (x <= 8e+38) tmp = 4.0; else tmp = Float64(Float64(4.0 * x) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -11500.0) tmp = (4.0 / y) * x; elseif (x <= -3.7e-119) tmp = (z * -4.0) / y; elseif (x <= 8e+38) tmp = 4.0; else tmp = (4.0 * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -11500.0], N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -3.7e-119], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 8e+38], 4.0, N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -11500:\\
\;\;\;\;\frac{4}{y} \cdot x\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-119}:\\
\;\;\;\;\frac{z \cdot -4}{y}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+38}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;\frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if x < -11500Initial program 97.3%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6497.3%
Simplified97.3%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6476.8%
Simplified76.8%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6477.9%
Applied egg-rr77.9%
if -11500 < x < -3.7000000000000001e-119Initial program 96.4%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
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.8%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified54.2%
if 7.99999999999999982e38 < x Initial program 100.0%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6478.4%
Simplified78.4%
Final simplification66.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ 4.0 y) x)))
(if (<= x -6200.0)
t_0
(if (<= x -4.8e-123) (/ (* z -4.0) y) (if (<= x 1e+39) 4.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = (4.0 / y) * x;
double tmp;
if (x <= -6200.0) {
tmp = t_0;
} else if (x <= -4.8e-123) {
tmp = (z * -4.0) / y;
} else if (x <= 1e+39) {
tmp = 4.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 = (4.0d0 / y) * x
if (x <= (-6200.0d0)) then
tmp = t_0
else if (x <= (-4.8d-123)) then
tmp = (z * (-4.0d0)) / y
else if (x <= 1d+39) then
tmp = 4.0d0
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 / y) * x;
double tmp;
if (x <= -6200.0) {
tmp = t_0;
} else if (x <= -4.8e-123) {
tmp = (z * -4.0) / y;
} else if (x <= 1e+39) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 / y) * x tmp = 0 if x <= -6200.0: tmp = t_0 elif x <= -4.8e-123: tmp = (z * -4.0) / y elif x <= 1e+39: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 / y) * x) tmp = 0.0 if (x <= -6200.0) tmp = t_0; elseif (x <= -4.8e-123) tmp = Float64(Float64(z * -4.0) / y); elseif (x <= 1e+39) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 / y) * x; tmp = 0.0; if (x <= -6200.0) tmp = t_0; elseif (x <= -4.8e-123) tmp = (z * -4.0) / y; elseif (x <= 1e+39) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6200.0], t$95$0, If[LessEqual[x, -4.8e-123], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1e+39], 4.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{y} \cdot x\\
\mathbf{if}\;x \leq -6200:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-123}:\\
\;\;\;\;\frac{z \cdot -4}{y}\\
\mathbf{elif}\;x \leq 10^{+39}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6200 or 9.9999999999999994e38 < x Initial program 98.4%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.4%
Simplified98.4%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6477.5%
Simplified77.5%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6478.1%
Applied egg-rr78.1%
if -6200 < x < -4.8e-123Initial program 96.4%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
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.8%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified54.2%
Final simplification66.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ 4.0 y) x)))
(if (<= x -19000.0)
t_0
(if (<= x -3.6e-123) (* z (/ -4.0 y)) (if (<= x 4.2e+40) 4.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = (4.0 / y) * x;
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 = 4.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 = (4.0d0 / y) * x
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 = 4.0d0
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 / y) * x;
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 = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 / y) * x 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 = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 / y) * x) 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 = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 / y) * x; 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 = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $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], 4.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{y} \cdot x\\
\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}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -19000 or 4.2000000000000002e40 < x Initial program 98.4%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.4%
Simplified98.4%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6477.5%
Simplified77.5%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6478.1%
Applied egg-rr78.1%
if -19000 < x < -3.5999999999999997e-123Initial program 96.4%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
Taylor expanded in z around inf
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
*-lowering-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6461.1%
Simplified61.1%
if -3.5999999999999997e-123 < x < 4.2000000000000002e40Initial program 99.8%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified54.2%
Final simplification66.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ (- x z) y))))
(if (<= x -1.65e+35)
t_0
(if (<= x 3.05e+40) (+ 4.0 (/ (* z -4.0) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = 4.0 * ((x - z) / y);
double tmp;
if (x <= -1.65e+35) {
tmp = t_0;
} else if (x <= 3.05e+40) {
tmp = 4.0 + ((z * -4.0) / 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 * ((x - z) / y)
if (x <= (-1.65d+35)) then
tmp = t_0
else if (x <= 3.05d+40) then
tmp = 4.0d0 + ((z * (-4.0d0)) / 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 * ((x - z) / y);
double tmp;
if (x <= -1.65e+35) {
tmp = t_0;
} else if (x <= 3.05e+40) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * ((x - z) / y) tmp = 0 if x <= -1.65e+35: tmp = t_0 elif x <= 3.05e+40: tmp = 4.0 + ((z * -4.0) / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(Float64(x - z) / y)) tmp = 0.0 if (x <= -1.65e+35) tmp = t_0; elseif (x <= 3.05e+40) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * ((x - z) / y); tmp = 0.0; if (x <= -1.65e+35) tmp = t_0; elseif (x <= 3.05e+40) tmp = 4.0 + ((z * -4.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+35], t$95$0, If[LessEqual[x, 3.05e+40], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x - z}{y}\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{+40}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.6500000000000001e35 or 3.05e40 < x Initial program 98.3%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in y around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.0%
Simplified93.0%
if -1.6500000000000001e35 < x < 3.05e40Initial program 99.2%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6490.8%
Simplified90.8%
Final simplification91.7%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+137) 4.0 (if (<= y 4.5e+111) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+137) {
tmp = 4.0;
} else if (y <= 4.5e+111) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.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 = 4.0d0
else if (y <= 4.5d+111) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 4.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 = 4.0;
} else if (y <= 4.5e+111) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+137: tmp = 4.0 elif y <= 4.5e+111: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+137) tmp = 4.0; elseif (y <= 4.5e+111) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+137) tmp = 4.0; elseif (y <= 4.5e+111) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+137], 4.0, If[LessEqual[y, 4.5e+111], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+137}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+111}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -5.79999999999999969e137 or 4.50000000000000001e111 < y Initial program 98.5%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified70.1%
if -5.79999999999999969e137 < y < 4.50000000000000001e111Initial program 99.0%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.0%
Simplified99.0%
Taylor expanded in y around 0
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6483.6%
Simplified83.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (/ 4.0 y) x))) (if (<= x -7e+35) t_0 (if (<= x 7.4e+37) 4.0 t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 / y) * x;
double tmp;
if (x <= -7e+35) {
tmp = t_0;
} else if (x <= 7.4e+37) {
tmp = 4.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 = (4.0d0 / y) * x
if (x <= (-7d+35)) then
tmp = t_0
else if (x <= 7.4d+37) then
tmp = 4.0d0
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 / y) * x;
double tmp;
if (x <= -7e+35) {
tmp = t_0;
} else if (x <= 7.4e+37) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 / y) * x tmp = 0 if x <= -7e+35: tmp = t_0 elif x <= 7.4e+37: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 / y) * x) tmp = 0.0 if (x <= -7e+35) tmp = t_0; elseif (x <= 7.4e+37) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 / y) * x; tmp = 0.0; if (x <= -7e+35) tmp = t_0; elseif (x <= 7.4e+37) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7e+35], t$95$0, If[LessEqual[x, 7.4e+37], 4.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4}{y} \cdot x\\
\mathbf{if}\;x \leq -7 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{+37}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.0000000000000001e35 or 7.3999999999999999e37 < x Initial program 98.3%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in x around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f6481.0%
Simplified81.0%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.7%
Applied egg-rr81.7%
if -7.0000000000000001e35 < x < 7.3999999999999999e37Initial program 99.2%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified50.3%
Final simplification63.9%
(FPCore (x y z) :precision binary64 4.0)
double code(double x, double y, double z) {
return 4.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
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 98.8%
associate-*l/N/A
+-commutativeN/A
associate--l+N/A
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.3%
Simplified99.3%
Taylor expanded in y around inf
Simplified31.9%
herbie shell --seed 2024138
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))