
(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 13 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 (+ 1.0 (+ (/ (* 4.0 (- x z)) y) 3.0)))
double code(double x, double y, double z) {
return 1.0 + (((4.0 * (x - z)) / y) + 3.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 + (((4.0d0 * (x - z)) / y) + 3.0d0)
end function
public static double code(double x, double y, double z) {
return 1.0 + (((4.0 * (x - z)) / y) + 3.0);
}
def code(x, y, z): return 1.0 + (((4.0 * (x - z)) / y) + 3.0)
function code(x, y, z) return Float64(1.0 + Float64(Float64(Float64(4.0 * Float64(x - z)) / y) + 3.0)) end
function tmp = code(x, y, z) tmp = 1.0 + (((4.0 * (x - z)) / y) + 3.0); end
code[x_, y_, z_] := N[(1.0 + N[(N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\frac{4 \cdot \left(x - z\right)}{y} + 3\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* 4.0 (- x z)) y))) (t_1 (+ 4.0 (* -4.0 (/ z y)))))
(if (<= z -1.7e+129)
t_1
(if (<= z -5.8e-19)
t_0
(if (<= z 1.25e+37)
(+ 4.0 (* 4.0 (/ x y)))
(if (<= z 7.2e+130) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((4.0 * (x - z)) / y);
double t_1 = 4.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1.7e+129) {
tmp = t_1;
} else if (z <= -5.8e-19) {
tmp = t_0;
} else if (z <= 1.25e+37) {
tmp = 4.0 + (4.0 * (x / y));
} else if (z <= 7.2e+130) {
tmp = t_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 - z)) / y)
t_1 = 4.0d0 + ((-4.0d0) * (z / y))
if (z <= (-1.7d+129)) then
tmp = t_1
else if (z <= (-5.8d-19)) then
tmp = t_0
else if (z <= 1.25d+37) then
tmp = 4.0d0 + (4.0d0 * (x / y))
else if (z <= 7.2d+130) then
tmp = t_0
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 - z)) / y);
double t_1 = 4.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1.7e+129) {
tmp = t_1;
} else if (z <= -5.8e-19) {
tmp = t_0;
} else if (z <= 1.25e+37) {
tmp = 4.0 + (4.0 * (x / y));
} else if (z <= 7.2e+130) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((4.0 * (x - z)) / y) t_1 = 4.0 + (-4.0 * (z / y)) tmp = 0 if z <= -1.7e+129: tmp = t_1 elif z <= -5.8e-19: tmp = t_0 elif z <= 1.25e+37: tmp = 4.0 + (4.0 * (x / y)) elif z <= 7.2e+130: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(4.0 * Float64(x - z)) / y)) t_1 = Float64(4.0 + Float64(-4.0 * Float64(z / y))) tmp = 0.0 if (z <= -1.7e+129) tmp = t_1; elseif (z <= -5.8e-19) tmp = t_0; elseif (z <= 1.25e+37) tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); elseif (z <= 7.2e+130) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((4.0 * (x - z)) / y); t_1 = 4.0 + (-4.0 * (z / y)); tmp = 0.0; if (z <= -1.7e+129) tmp = t_1; elseif (z <= -5.8e-19) tmp = t_0; elseif (z <= 1.25e+37) tmp = 4.0 + (4.0 * (x / y)); elseif (z <= 7.2e+130) tmp = t_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 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+129], t$95$1, If[LessEqual[z, -5.8e-19], t$95$0, If[LessEqual[z, 1.25e+37], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e+130], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{4 \cdot \left(x - z\right)}{y}\\
t_1 := 4 + -4 \cdot \frac{z}{y}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+37}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+130}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.70000000000000009e129 or 7.2000000000000002e130 < z Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 94.0%
Taylor expanded in z around 0 94.0%
if -1.70000000000000009e129 < z < -5.8e-19 or 1.24999999999999997e37 < z < 7.2000000000000002e130Initial program 100.0%
Taylor expanded in x around inf 86.5%
if -5.8e-19 < z < 1.24999999999999997e37Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 90.9%
associate-*r/90.9%
associate-*l/90.8%
associate-/r/90.8%
Simplified90.8%
Taylor expanded in y around inf 90.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* (- x z) (/ 4.0 y)))) (t_1 (+ 4.0 (* -4.0 (/ z y)))))
(if (<= z -1.75e+130)
t_1
(if (<= z -1.9e-18)
t_0
(if (<= z 8e+35)
(+ 4.0 (* 4.0 (/ x y)))
(if (<= z 2.6e+131) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((x - z) * (4.0 / y));
double t_1 = 4.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1.75e+130) {
tmp = t_1;
} else if (z <= -1.9e-18) {
tmp = t_0;
} else if (z <= 8e+35) {
tmp = 4.0 + (4.0 * (x / y));
} else if (z <= 2.6e+131) {
tmp = t_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 + ((x - z) * (4.0d0 / y))
t_1 = 4.0d0 + ((-4.0d0) * (z / y))
if (z <= (-1.75d+130)) then
tmp = t_1
else if (z <= (-1.9d-18)) then
tmp = t_0
else if (z <= 8d+35) then
tmp = 4.0d0 + (4.0d0 * (x / y))
else if (z <= 2.6d+131) then
tmp = t_0
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 + ((x - z) * (4.0 / y));
double t_1 = 4.0 + (-4.0 * (z / y));
double tmp;
if (z <= -1.75e+130) {
tmp = t_1;
} else if (z <= -1.9e-18) {
tmp = t_0;
} else if (z <= 8e+35) {
tmp = 4.0 + (4.0 * (x / y));
} else if (z <= 2.6e+131) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((x - z) * (4.0 / y)) t_1 = 4.0 + (-4.0 * (z / y)) tmp = 0 if z <= -1.75e+130: tmp = t_1 elif z <= -1.9e-18: tmp = t_0 elif z <= 8e+35: tmp = 4.0 + (4.0 * (x / y)) elif z <= 2.6e+131: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(x - z) * Float64(4.0 / y))) t_1 = Float64(4.0 + Float64(-4.0 * Float64(z / y))) tmp = 0.0 if (z <= -1.75e+130) tmp = t_1; elseif (z <= -1.9e-18) tmp = t_0; elseif (z <= 8e+35) tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); elseif (z <= 2.6e+131) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((x - z) * (4.0 / y)); t_1 = 4.0 + (-4.0 * (z / y)); tmp = 0.0; if (z <= -1.75e+130) tmp = t_1; elseif (z <= -1.9e-18) tmp = t_0; elseif (z <= 8e+35) tmp = 4.0 + (4.0 * (x / y)); elseif (z <= 2.6e+131) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+130], t$95$1, If[LessEqual[z, -1.9e-18], t$95$0, If[LessEqual[z, 8e+35], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+131], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left(x - z\right) \cdot \frac{4}{y}\\
t_1 := 4 + -4 \cdot \frac{z}{y}\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+35}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+131}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.75e130 or 2.6e131 < z Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 94.0%
Taylor expanded in z around 0 94.0%
if -1.75e130 < z < -1.8999999999999999e-18 or 7.9999999999999997e35 < z < 2.6e131Initial program 100.0%
Taylor expanded in y around 0 86.5%
*-lft-identity86.5%
associate-*l/86.3%
associate-*r*86.3%
associate-*r/86.3%
metadata-eval86.3%
Simplified86.3%
if -1.8999999999999999e-18 < z < 7.9999999999999997e35Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 90.9%
associate-*r/90.9%
associate-*l/90.8%
associate-/r/90.8%
Simplified90.8%
Taylor expanded in y around inf 90.9%
Final simplification90.9%
(FPCore (x y z)
:precision binary64
(if (<= y -1.4e+161)
4.0
(if (or (<= y -2.65e+76) (and (not (<= y -1.55e-23)) (<= y 1.55e-18)))
(/ (* z -4.0) y)
4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+161) {
tmp = 4.0;
} else if ((y <= -2.65e+76) || (!(y <= -1.55e-23) && (y <= 1.55e-18))) {
tmp = (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 <= (-1.4d+161)) then
tmp = 4.0d0
else if ((y <= (-2.65d+76)) .or. (.not. (y <= (-1.55d-23))) .and. (y <= 1.55d-18)) then
tmp = (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 <= -1.4e+161) {
tmp = 4.0;
} else if ((y <= -2.65e+76) || (!(y <= -1.55e-23) && (y <= 1.55e-18))) {
tmp = (z * -4.0) / y;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+161: tmp = 4.0 elif (y <= -2.65e+76) or (not (y <= -1.55e-23) and (y <= 1.55e-18)): tmp = (z * -4.0) / y else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+161) tmp = 4.0; elseif ((y <= -2.65e+76) || (!(y <= -1.55e-23) && (y <= 1.55e-18))) tmp = Float64(Float64(z * -4.0) / y); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e+161) tmp = 4.0; elseif ((y <= -2.65e+76) || (~((y <= -1.55e-23)) && (y <= 1.55e-18))) tmp = (z * -4.0) / y; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+161], 4.0, If[Or[LessEqual[y, -2.65e+76], And[N[Not[LessEqual[y, -1.55e-23]], $MachinePrecision], LessEqual[y, 1.55e-18]]], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+161}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -2.65 \cdot 10^{+76} \lor \neg \left(y \leq -1.55 \cdot 10^{-23}\right) \land y \leq 1.55 \cdot 10^{-18}:\\
\;\;\;\;\frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.4000000000000001e161 or -2.65000000000000008e76 < y < -1.5499999999999999e-23 or 1.55000000000000003e-18 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
Taylor expanded in z around 0 61.1%
if -1.4000000000000001e161 < y < -2.65000000000000008e76 or -1.5499999999999999e-23 < y < 1.55000000000000003e-18Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 59.5%
Taylor expanded in z around inf 53.8%
associate-*r/53.8%
Simplified53.8%
Final simplification57.1%
(FPCore (x y z)
:precision binary64
(if (<= y -1.4e+161)
4.0
(if (or (<= y -1.75e+80) (and (not (<= y -8.2e-23)) (<= y 1.55e-18)))
(* z (/ -4.0 y))
4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+161) {
tmp = 4.0;
} else if ((y <= -1.75e+80) || (!(y <= -8.2e-23) && (y <= 1.55e-18))) {
tmp = 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 <= (-1.4d+161)) then
tmp = 4.0d0
else if ((y <= (-1.75d+80)) .or. (.not. (y <= (-8.2d-23))) .and. (y <= 1.55d-18)) then
tmp = 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 <= -1.4e+161) {
tmp = 4.0;
} else if ((y <= -1.75e+80) || (!(y <= -8.2e-23) && (y <= 1.55e-18))) {
tmp = z * (-4.0 / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+161: tmp = 4.0 elif (y <= -1.75e+80) or (not (y <= -8.2e-23) and (y <= 1.55e-18)): tmp = z * (-4.0 / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+161) tmp = 4.0; elseif ((y <= -1.75e+80) || (!(y <= -8.2e-23) && (y <= 1.55e-18))) tmp = Float64(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 <= -1.4e+161) tmp = 4.0; elseif ((y <= -1.75e+80) || (~((y <= -8.2e-23)) && (y <= 1.55e-18))) tmp = z * (-4.0 / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+161], 4.0, If[Or[LessEqual[y, -1.75e+80], And[N[Not[LessEqual[y, -8.2e-23]], $MachinePrecision], LessEqual[y, 1.55e-18]]], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+161}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{+80} \lor \neg \left(y \leq -8.2 \cdot 10^{-23}\right) \land y \leq 1.55 \cdot 10^{-18}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.4000000000000001e161 or -1.74999999999999997e80 < y < -8.20000000000000059e-23 or 1.55000000000000003e-18 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
Taylor expanded in z around 0 61.1%
if -1.4000000000000001e161 < y < -1.74999999999999997e80 or -8.20000000000000059e-23 < y < 1.55000000000000003e-18Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 59.5%
Taylor expanded in z around inf 53.8%
*-commutative53.8%
associate-*l/53.8%
associate-*r/53.6%
Simplified53.6%
Final simplification57.0%
(FPCore (x y z)
:precision binary64
(if (<= y -1.4e+161)
4.0
(if (<= y -1.65e+90)
(* z (/ -4.0 y))
(if (<= y -1.45e-22) 4.0 (if (<= y 1.55e-18) (/ -4.0 (/ y z)) 4.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+161) {
tmp = 4.0;
} else if (y <= -1.65e+90) {
tmp = z * (-4.0 / y);
} else if (y <= -1.45e-22) {
tmp = 4.0;
} else if (y <= 1.55e-18) {
tmp = -4.0 / (y / z);
} 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 <= (-1.4d+161)) then
tmp = 4.0d0
else if (y <= (-1.65d+90)) then
tmp = z * ((-4.0d0) / y)
else if (y <= (-1.45d-22)) then
tmp = 4.0d0
else if (y <= 1.55d-18) then
tmp = (-4.0d0) / (y / z)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+161) {
tmp = 4.0;
} else if (y <= -1.65e+90) {
tmp = z * (-4.0 / y);
} else if (y <= -1.45e-22) {
tmp = 4.0;
} else if (y <= 1.55e-18) {
tmp = -4.0 / (y / z);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+161: tmp = 4.0 elif y <= -1.65e+90: tmp = z * (-4.0 / y) elif y <= -1.45e-22: tmp = 4.0 elif y <= 1.55e-18: tmp = -4.0 / (y / z) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+161) tmp = 4.0; elseif (y <= -1.65e+90) tmp = Float64(z * Float64(-4.0 / y)); elseif (y <= -1.45e-22) tmp = 4.0; elseif (y <= 1.55e-18) tmp = Float64(-4.0 / Float64(y / z)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e+161) tmp = 4.0; elseif (y <= -1.65e+90) tmp = z * (-4.0 / y); elseif (y <= -1.45e-22) tmp = 4.0; elseif (y <= 1.55e-18) tmp = -4.0 / (y / z); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+161], 4.0, If[LessEqual[y, -1.65e+90], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e-22], 4.0, If[LessEqual[y, 1.55e-18], N[(-4.0 / N[(y / z), $MachinePrecision]), $MachinePrecision], 4.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+161}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{+90}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-22}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-18}:\\
\;\;\;\;\frac{-4}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.4000000000000001e161 or -1.65000000000000004e90 < y < -1.4500000000000001e-22 or 1.55000000000000003e-18 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 77.3%
Taylor expanded in z around 0 61.1%
if -1.4000000000000001e161 < y < -1.65000000000000004e90Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 61.4%
Taylor expanded in z around inf 50.2%
*-commutative50.2%
associate-*l/50.2%
associate-*r/49.9%
Simplified49.9%
if -1.4500000000000001e-22 < y < 1.55000000000000003e-18Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 59.3%
Taylor expanded in z around inf 54.1%
*-commutative54.1%
associate-*l/54.1%
associate-*r/54.0%
Simplified54.0%
associate-*r/54.1%
*-commutative54.1%
associate-*r/54.1%
clear-num54.0%
un-div-inv54.0%
Applied egg-rr54.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.2e+66) (not (<= z 1.22e+33))) (+ 4.0 (* -4.0 (/ z y))) (+ 4.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.2e+66) || !(z <= 1.22e+33)) {
tmp = 4.0 + (-4.0 * (z / 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 <= (-8.2d+66)) .or. (.not. (z <= 1.22d+33))) then
tmp = 4.0d0 + ((-4.0d0) * (z / 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 <= -8.2e+66) || !(z <= 1.22e+33)) {
tmp = 4.0 + (-4.0 * (z / y));
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.2e+66) or not (z <= 1.22e+33): tmp = 4.0 + (-4.0 * (z / y)) else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.2e+66) || !(z <= 1.22e+33)) tmp = Float64(4.0 + Float64(-4.0 * Float64(z / y))); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.2e+66) || ~((z <= 1.22e+33))) tmp = 4.0 + (-4.0 * (z / y)); else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.2e+66], N[Not[LessEqual[z, 1.22e+33]], $MachinePrecision]], N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+66} \lor \neg \left(z \leq 1.22 \cdot 10^{+33}\right):\\
\;\;\;\;4 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -8.19999999999999989e66 or 1.22000000000000005e33 < z Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 85.8%
Taylor expanded in z around 0 85.8%
if -8.19999999999999989e66 < z < 1.22000000000000005e33Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 87.1%
associate-*r/87.1%
associate-*l/86.9%
associate-/r/87.0%
Simplified87.0%
Taylor expanded in y around inf 87.1%
Final simplification86.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.3e+136) (not (<= x 6.2e+128))) (+ 1.0 (* 4.0 (/ x y))) (+ 4.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.3e+136) || !(x <= 6.2e+128)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 4.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 <= (-3.3d+136)) .or. (.not. (x <= 6.2d+128))) then
tmp = 1.0d0 + (4.0d0 * (x / y))
else
tmp = 4.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 <= -3.3e+136) || !(x <= 6.2e+128)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 4.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.3e+136) or not (x <= 6.2e+128): tmp = 1.0 + (4.0 * (x / y)) else: tmp = 4.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.3e+136) || !(x <= 6.2e+128)) tmp = Float64(1.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(4.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.3e+136) || ~((x <= 6.2e+128))) tmp = 1.0 + (4.0 * (x / y)); else tmp = 4.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.3e+136], N[Not[LessEqual[x, 6.2e+128]], $MachinePrecision]], N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+136} \lor \neg \left(x \leq 6.2 \cdot 10^{+128}\right):\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -3.29999999999999992e136 or 6.20000000000000008e128 < x Initial program 100.0%
Taylor expanded in x around inf 83.1%
*-commutative83.1%
Simplified83.1%
if -3.29999999999999992e136 < x < 6.20000000000000008e128Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 82.2%
Taylor expanded in z around 0 82.2%
Final simplification82.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.1e-29) (not (<= x 5.2e+87))) (+ 1.0 (* 4.0 (/ x y))) (+ 1.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-29) || !(x <= 5.2e+87)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 1.0 + ((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 ((x <= (-2.1d-29)) .or. (.not. (x <= 5.2d+87))) then
tmp = 1.0d0 + (4.0d0 * (x / y))
else
tmp = 1.0d0 + ((z * (-4.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-29) || !(x <= 5.2e+87)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 1.0 + ((z * -4.0) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.1e-29) or not (x <= 5.2e+87): tmp = 1.0 + (4.0 * (x / y)) else: tmp = 1.0 + ((z * -4.0) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.1e-29) || !(x <= 5.2e+87)) tmp = Float64(1.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(1.0 + Float64(Float64(z * -4.0) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.1e-29) || ~((x <= 5.2e+87))) tmp = 1.0 + (4.0 * (x / y)); else tmp = 1.0 + ((z * -4.0) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.1e-29], N[Not[LessEqual[x, 5.2e+87]], $MachinePrecision]], N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-29} \lor \neg \left(x \leq 5.2 \cdot 10^{+87}\right):\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -2.09999999999999989e-29 or 5.19999999999999997e87 < x Initial program 99.9%
Taylor expanded in x around inf 67.7%
*-commutative67.7%
Simplified67.7%
if -2.09999999999999989e-29 < x < 5.19999999999999997e87Initial program 99.9%
Taylor expanded in z around inf 56.6%
*-commutative56.6%
associate-*l/56.6%
Simplified56.6%
Final simplification61.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.7e-37) (not (<= x 5.8e+87))) (+ 1.0 (* 4.0 (/ x y))) (+ 1.0 (* z (/ -4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e-37) || !(x <= 5.8e+87)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 1.0 + (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 ((x <= (-1.7d-37)) .or. (.not. (x <= 5.8d+87))) then
tmp = 1.0d0 + (4.0d0 * (x / y))
else
tmp = 1.0d0 + (z * ((-4.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.7e-37) || !(x <= 5.8e+87)) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 1.0 + (z * (-4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.7e-37) or not (x <= 5.8e+87): tmp = 1.0 + (4.0 * (x / y)) else: tmp = 1.0 + (z * (-4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.7e-37) || !(x <= 5.8e+87)) tmp = Float64(1.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.7e-37) || ~((x <= 5.8e+87))) tmp = 1.0 + (4.0 * (x / y)); else tmp = 1.0 + (z * (-4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.7e-37], N[Not[LessEqual[x, 5.8e+87]], $MachinePrecision]], N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-37} \lor \neg \left(x \leq 5.8 \cdot 10^{+87}\right):\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\end{array}
\end{array}
if x < -1.70000000000000009e-37 or 5.7999999999999996e87 < x Initial program 99.9%
Taylor expanded in x around inf 67.2%
*-commutative67.2%
Simplified67.2%
if -1.70000000000000009e-37 < x < 5.7999999999999996e87Initial program 99.9%
Taylor expanded in z around inf 56.9%
metadata-eval56.9%
distribute-lft-neg-in56.9%
*-lft-identity56.9%
associate-*l/56.7%
associate-*l*56.7%
*-commutative56.7%
distribute-rgt-neg-in56.7%
associate-*r/56.7%
metadata-eval56.7%
distribute-neg-frac56.7%
metadata-eval56.7%
Simplified56.7%
Final simplification61.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.1e-26) (not (<= z 1.05e+36))) (+ 1.0 (* z (/ -4.0 y))) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.1e-26) || !(z <= 1.05e+36)) {
tmp = 1.0 + (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 ((z <= (-4.1d-26)) .or. (.not. (z <= 1.05d+36))) then
tmp = 1.0d0 + (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 ((z <= -4.1e-26) || !(z <= 1.05e+36)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.1e-26) or not (z <= 1.05e+36): tmp = 1.0 + (z * (-4.0 / y)) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.1e-26) || !(z <= 1.05e+36)) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.1e-26) || ~((z <= 1.05e+36))) tmp = 1.0 + (z * (-4.0 / y)); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.1e-26], N[Not[LessEqual[z, 1.05e+36]], $MachinePrecision]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-26} \lor \neg \left(z \leq 1.05 \cdot 10^{+36}\right):\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if z < -4.0999999999999999e-26 or 1.05000000000000002e36 < z Initial program 100.0%
Taylor expanded in z around inf 64.4%
metadata-eval64.4%
distribute-lft-neg-in64.4%
*-lft-identity64.4%
associate-*l/64.2%
associate-*l*64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
associate-*r/64.2%
metadata-eval64.2%
distribute-neg-frac64.2%
metadata-eval64.2%
Simplified64.2%
if -4.0999999999999999e-26 < z < 1.05000000000000002e36Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 53.7%
Taylor expanded in z around 0 45.1%
Final simplification55.0%
(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 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 67.5%
Taylor expanded in z around 0 31.5%
(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 99.9%
Taylor expanded in x around inf 39.3%
*-commutative39.3%
Simplified39.3%
Taylor expanded in x around 0 7.7%
herbie shell --seed 2024107
(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)))