
(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 10 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 (/ (- x z) y))))
double code(double x, double y, double z) {
return 4.0 + (4.0 * ((x - 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 = 4.0d0 + (4.0d0 * ((x - z) / y))
end function
public static double code(double x, double y, double z) {
return 4.0 + (4.0 * ((x - z) / y));
}
def code(x, y, z): return 4.0 + (4.0 * ((x - z) / y))
function code(x, y, z) return Float64(4.0 + Float64(4.0 * Float64(Float64(x - z) / y))) end
function tmp = code(x, y, z) tmp = 4.0 + (4.0 * ((x - z) / y)); end
code[x_, y_, z_] := N[(4.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + 4 \cdot \frac{x - z}{y}
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -5.5e+36)
t_0
(if (<= x 4.9e-231) 4.0 (if (<= x 5.5e+116) (* -4.0 (/ z y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -5.5e+36) {
tmp = t_0;
} else if (x <= 4.9e-231) {
tmp = 4.0;
} else if (x <= 5.5e+116) {
tmp = -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 * (x / y)
if (x <= (-5.5d+36)) then
tmp = t_0
else if (x <= 4.9d-231) then
tmp = 4.0d0
else if (x <= 5.5d+116) then
tmp = (-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 * (x / y);
double tmp;
if (x <= -5.5e+36) {
tmp = t_0;
} else if (x <= 4.9e-231) {
tmp = 4.0;
} else if (x <= 5.5e+116) {
tmp = -4.0 * (z / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -5.5e+36: tmp = t_0 elif x <= 4.9e-231: tmp = 4.0 elif x <= 5.5e+116: tmp = -4.0 * (z / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -5.5e+36) tmp = t_0; elseif (x <= 4.9e-231) tmp = 4.0; elseif (x <= 5.5e+116) tmp = 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 * (x / y); tmp = 0.0; if (x <= -5.5e+36) tmp = t_0; elseif (x <= 4.9e-231) tmp = 4.0; elseif (x <= 5.5e+116) tmp = -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[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e+36], t$95$0, If[LessEqual[x, 4.9e-231], 4.0, If[LessEqual[x, 5.5e+116], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-231}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+116}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.5000000000000002e36 or 5.50000000000000035e116 < x Initial program 99.9%
Taylor expanded in x around inf 71.1%
if -5.5000000000000002e36 < x < 4.90000000000000003e-231Initial program 99.9%
Taylor expanded in y around inf 57.6%
if 4.90000000000000003e-231 < x < 5.50000000000000035e116Initial program 100.0%
Taylor expanded in z around inf 50.0%
*-commutative50.0%
Simplified50.0%
Final simplification60.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -2.05e+25)
t_0
(if (<= x 4.8e-231) 4.0 (if (<= x 9.8e+116) (* z (/ -4.0 y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -2.05e+25) {
tmp = t_0;
} else if (x <= 4.8e-231) {
tmp = 4.0;
} else if (x <= 9.8e+116) {
tmp = 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 / y)
if (x <= (-2.05d+25)) then
tmp = t_0
else if (x <= 4.8d-231) then
tmp = 4.0d0
else if (x <= 9.8d+116) then
tmp = 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 / y);
double tmp;
if (x <= -2.05e+25) {
tmp = t_0;
} else if (x <= 4.8e-231) {
tmp = 4.0;
} else if (x <= 9.8e+116) {
tmp = z * (-4.0 / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -2.05e+25: tmp = t_0 elif x <= 4.8e-231: tmp = 4.0 elif x <= 9.8e+116: tmp = z * (-4.0 / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -2.05e+25) tmp = t_0; elseif (x <= 4.8e-231) tmp = 4.0; elseif (x <= 9.8e+116) tmp = Float64(z * Float64(-4.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); tmp = 0.0; if (x <= -2.05e+25) tmp = t_0; elseif (x <= 4.8e-231) tmp = 4.0; elseif (x <= 9.8e+116) tmp = 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[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.05e+25], t$95$0, If[LessEqual[x, 4.8e-231], 4.0, If[LessEqual[x, 9.8e+116], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-231}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+116}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.04999999999999983e25 or 9.7999999999999996e116 < x Initial program 99.9%
Taylor expanded in x around inf 71.1%
if -2.04999999999999983e25 < x < 4.79999999999999983e-231Initial program 99.9%
Taylor expanded in y around inf 57.6%
if 4.79999999999999983e-231 < x < 9.7999999999999996e116Initial program 100.0%
Taylor expanded in z around inf 50.0%
associate-*r/50.0%
*-commutative50.0%
associate-/l*49.8%
Simplified49.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.3e+123) (not (<= z 3.75e+30))) (+ 4.0 (/ (* z -4.0) y)) (+ 4.0 (/ (* 4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e+123) || !(z <= 3.75e+30)) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = 4.0 + ((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 ((z <= (-2.3d+123)) .or. (.not. (z <= 3.75d+30))) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else
tmp = 4.0d0 + ((4.0d0 * x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e+123) || !(z <= 3.75e+30)) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = 4.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.3e+123) or not (z <= 3.75e+30): tmp = 4.0 + ((z * -4.0) / y) else: tmp = 4.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.3e+123) || !(z <= 3.75e+30)) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(4.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.3e+123) || ~((z <= 3.75e+30))) tmp = 4.0 + ((z * -4.0) / y); else tmp = 4.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.3e+123], N[Not[LessEqual[z, 3.75e+30]], $MachinePrecision]], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+123} \lor \neg \left(z \leq 3.75 \cdot 10^{+30}\right):\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if z < -2.2999999999999999e123 or 3.74999999999999986e30 < z Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 92.0%
+-commutative92.0%
associate-*r/92.0%
Simplified92.0%
if -2.2999999999999999e123 < z < 3.74999999999999986e30Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 88.6%
distribute-lft-in88.6%
metadata-eval88.6%
associate-+r+88.6%
metadata-eval88.6%
associate-*r/88.6%
*-commutative88.6%
associate-*r/88.4%
Simplified88.4%
*-commutative88.4%
associate-*l/88.6%
Applied egg-rr88.6%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.22e+123) (not (<= z 3.5e+30))) (+ 4.0 (* z (/ -4.0 y))) (+ 4.0 (/ (* 4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.22e+123) || !(z <= 3.5e+30)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 + ((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 ((z <= (-1.22d+123)) .or. (.not. (z <= 3.5d+30))) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else
tmp = 4.0d0 + ((4.0d0 * x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.22e+123) || !(z <= 3.5e+30)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.22e+123) or not (z <= 3.5e+30): tmp = 4.0 + (z * (-4.0 / y)) else: tmp = 4.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.22e+123) || !(z <= 3.5e+30)) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(4.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.22e+123) || ~((z <= 3.5e+30))) tmp = 4.0 + (z * (-4.0 / y)); else tmp = 4.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.22e+123], N[Not[LessEqual[z, 3.5e+30]], $MachinePrecision]], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+123} \lor \neg \left(z \leq 3.5 \cdot 10^{+30}\right):\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if z < -1.22e123 or 3.50000000000000021e30 < z Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 92.0%
sub-neg92.0%
distribute-lft-in92.0%
metadata-eval92.0%
associate-+r+92.0%
metadata-eval92.0%
neg-mul-192.0%
associate-*r*92.0%
metadata-eval92.0%
associate-*r/92.0%
*-commutative92.0%
associate-/l*91.8%
Simplified91.8%
if -1.22e123 < z < 3.50000000000000021e30Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 88.6%
distribute-lft-in88.6%
metadata-eval88.6%
associate-+r+88.6%
metadata-eval88.6%
associate-*r/88.6%
*-commutative88.6%
associate-*r/88.4%
Simplified88.4%
*-commutative88.4%
associate-*l/88.6%
Applied egg-rr88.6%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.6e+123) (not (<= z 1.05e+28))) (+ 4.0 (* z (/ -4.0 y))) (+ 4.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e+123) || !(z <= 1.05e+28)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 + (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 ((z <= (-6.6d+123)) .or. (.not. (z <= 1.05d+28))) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else
tmp = 4.0d0 + (x * (4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e+123) || !(z <= 1.05e+28)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.6e+123) or not (z <= 1.05e+28): tmp = 4.0 + (z * (-4.0 / y)) else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.6e+123) || !(z <= 1.05e+28)) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.6e+123) || ~((z <= 1.05e+28))) tmp = 4.0 + (z * (-4.0 / y)); else tmp = 4.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.6e+123], N[Not[LessEqual[z, 1.05e+28]], $MachinePrecision]], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+123} \lor \neg \left(z \leq 1.05 \cdot 10^{+28}\right):\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -6.60000000000000006e123 or 1.04999999999999995e28 < z Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 92.0%
sub-neg92.0%
distribute-lft-in92.0%
metadata-eval92.0%
associate-+r+92.0%
metadata-eval92.0%
neg-mul-192.0%
associate-*r*92.0%
metadata-eval92.0%
associate-*r/92.0%
*-commutative92.0%
associate-/l*91.8%
Simplified91.8%
if -6.60000000000000006e123 < z < 1.04999999999999995e28Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 88.6%
distribute-lft-in88.6%
metadata-eval88.6%
associate-+r+88.6%
metadata-eval88.6%
associate-*r/88.6%
*-commutative88.6%
associate-*r/88.4%
Simplified88.4%
Final simplification89.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.8e+152) (not (<= y 2.8e+20))) (+ 4.0 (* x (/ 4.0 y))) (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.8e+152) || !(y <= 2.8e+20)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = (x - z) * (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 ((y <= (-4.8d+152)) .or. (.not. (y <= 2.8d+20))) then
tmp = 4.0d0 + (x * (4.0d0 / y))
else
tmp = (x - z) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.8e+152) || !(y <= 2.8e+20)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = (x - z) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.8e+152) or not (y <= 2.8e+20): tmp = 4.0 + (x * (4.0 / y)) else: tmp = (x - z) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.8e+152) || !(y <= 2.8e+20)) tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); else tmp = Float64(Float64(x - z) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.8e+152) || ~((y <= 2.8e+20))) tmp = 4.0 + (x * (4.0 / y)); else tmp = (x - z) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.8e+152], N[Not[LessEqual[y, 2.8e+20]], $MachinePrecision]], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+152} \lor \neg \left(y \leq 2.8 \cdot 10^{+20}\right):\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if y < -4.7999999999999998e152 or 2.8e20 < y Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub100.0%
sub-neg100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 88.0%
distribute-lft-in88.0%
metadata-eval88.0%
associate-+r+88.0%
metadata-eval88.0%
associate-*r/88.0%
*-commutative88.0%
associate-*r/87.9%
Simplified87.9%
if -4.7999999999999998e152 < y < 2.8e20Initial program 99.9%
Taylor expanded in y around 0 89.1%
*-lft-identity89.1%
associate-*l/88.8%
associate-*r*88.8%
associate-*r/88.8%
metadata-eval88.8%
Simplified88.8%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.3e+173) 4.0 (if (<= y 5.1e+123) (* (- x z) (/ 4.0 y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+173) {
tmp = 4.0;
} else if (y <= 5.1e+123) {
tmp = (x - z) * (4.0 / 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 <= (-2.3d+173)) then
tmp = 4.0d0
else if (y <= 5.1d+123) then
tmp = (x - z) * (4.0d0 / 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 <= -2.3e+173) {
tmp = 4.0;
} else if (y <= 5.1e+123) {
tmp = (x - z) * (4.0 / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.3e+173: tmp = 4.0 elif y <= 5.1e+123: tmp = (x - z) * (4.0 / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.3e+173) tmp = 4.0; elseif (y <= 5.1e+123) tmp = Float64(Float64(x - z) * Float64(4.0 / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.3e+173) tmp = 4.0; elseif (y <= 5.1e+123) tmp = (x - z) * (4.0 / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+173], 4.0, If[LessEqual[y, 5.1e+123], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+173}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+123}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -2.29999999999999995e173 or 5.09999999999999972e123 < y Initial program 99.9%
Taylor expanded in y around inf 81.8%
if -2.29999999999999995e173 < y < 5.09999999999999972e123Initial program 99.9%
Taylor expanded in y around 0 85.0%
*-lft-identity85.0%
associate-*l/84.8%
associate-*r*84.8%
associate-*r/84.8%
metadata-eval84.8%
Simplified84.8%
Final simplification84.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.8e+27) (not (<= x 1.12e+120))) (* 4.0 (/ x y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.8e+27) || !(x <= 1.12e+120)) {
tmp = 4.0 * (x / 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 ((x <= (-9.8d+27)) .or. (.not. (x <= 1.12d+120))) then
tmp = 4.0d0 * (x / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9.8e+27) || !(x <= 1.12e+120)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.8e+27) or not (x <= 1.12e+120): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9.8e+27) || !(x <= 1.12e+120)) tmp = Float64(4.0 * Float64(x / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9.8e+27) || ~((x <= 1.12e+120))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.8e+27], N[Not[LessEqual[x, 1.12e+120]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{+27} \lor \neg \left(x \leq 1.12 \cdot 10^{+120}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -9.8000000000000003e27 or 1.12000000000000005e120 < x Initial program 100.0%
Taylor expanded in x around inf 72.2%
if -9.8000000000000003e27 < x < 1.12000000000000005e120Initial program 99.9%
Taylor expanded in y around inf 46.5%
Final simplification56.4%
(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 99.9%
Taylor expanded in y around inf 33.0%
herbie shell --seed 2024151
(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)))