
(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 9 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 (- 3.0 (* 4.0 (/ (- z x) y)))))
double code(double x, double y, double z) {
return 1.0 + (3.0 - (4.0 * ((z - x) / 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 + (3.0d0 - (4.0d0 * ((z - x) / y)))
end function
public static double code(double x, double y, double z) {
return 1.0 + (3.0 - (4.0 * ((z - x) / y)));
}
def code(x, y, z): return 1.0 + (3.0 - (4.0 * ((z - x) / y)))
function code(x, y, z) return Float64(1.0 + Float64(3.0 - Float64(4.0 * Float64(Float64(z - x) / y)))) end
function tmp = code(x, y, z) tmp = 1.0 + (3.0 - (4.0 * ((z - x) / y))); end
code[x_, y_, z_] := N[(1.0 + N[(3.0 - N[(4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(3 - 4 \cdot \frac{z - x}{y}\right)
\end{array}
Initial program 99.2%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.8e+200)
(and (not (<= z -1.4e+82)) (or (<= z -4.6e+57) (not (<= z 2e+159)))))
(+ 1.0 (* (/ z y) -4.0))
(+ 4.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+200) || (!(z <= -1.4e+82) && ((z <= -4.6e+57) || !(z <= 2e+159)))) {
tmp = 1.0 + ((z / y) * -4.0);
} 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 <= (-1.8d+200)) .or. (.not. (z <= (-1.4d+82))) .and. (z <= (-4.6d+57)) .or. (.not. (z <= 2d+159))) then
tmp = 1.0d0 + ((z / y) * (-4.0d0))
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 <= -1.8e+200) || (!(z <= -1.4e+82) && ((z <= -4.6e+57) || !(z <= 2e+159)))) {
tmp = 1.0 + ((z / y) * -4.0);
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+200) or (not (z <= -1.4e+82) and ((z <= -4.6e+57) or not (z <= 2e+159))): tmp = 1.0 + ((z / y) * -4.0) else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+200) || (!(z <= -1.4e+82) && ((z <= -4.6e+57) || !(z <= 2e+159)))) tmp = Float64(1.0 + Float64(Float64(z / y) * -4.0)); 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 <= -1.8e+200) || (~((z <= -1.4e+82)) && ((z <= -4.6e+57) || ~((z <= 2e+159))))) tmp = 1.0 + ((z / y) * -4.0); else tmp = 4.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+200], And[N[Not[LessEqual[z, -1.4e+82]], $MachinePrecision], Or[LessEqual[z, -4.6e+57], N[Not[LessEqual[z, 2e+159]], $MachinePrecision]]]], N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+200} \lor \neg \left(z \leq -1.4 \cdot 10^{+82}\right) \land \left(z \leq -4.6 \cdot 10^{+57} \lor \neg \left(z \leq 2 \cdot 10^{+159}\right)\right):\\
\;\;\;\;1 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.7999999999999999e200 or -1.4e82 < z < -4.5999999999999998e57 or 1.9999999999999999e159 < z Initial program 98.5%
Taylor expanded in z around inf 91.0%
*-commutative91.0%
Simplified91.0%
if -1.7999999999999999e200 < z < -1.4e82 or -4.5999999999999998e57 < z < 1.9999999999999999e159Initial program 99.4%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 84.6%
Taylor expanded in x around 0 84.6%
associate-*r/84.1%
Simplified84.1%
Taylor expanded in x around 0 84.6%
*-commutative84.6%
associate-*l/84.1%
associate-*r/84.5%
Simplified84.5%
Final simplification86.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ z y) -4.0))))
(if (<= z -2.8e+200)
t_0
(if (<= z -5.9e+77)
(+ 4.0 (/ (* 4.0 x) y))
(if (or (<= z -1.9e+45) (not (<= z 2.05e+159)))
t_0
(+ 4.0 (* x (/ 4.0 y))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -2.8e+200) {
tmp = t_0;
} else if (z <= -5.9e+77) {
tmp = 4.0 + ((4.0 * x) / y);
} else if ((z <= -1.9e+45) || !(z <= 2.05e+159)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((z / y) * (-4.0d0))
if (z <= (-2.8d+200)) then
tmp = t_0
else if (z <= (-5.9d+77)) then
tmp = 4.0d0 + ((4.0d0 * x) / y)
else if ((z <= (-1.9d+45)) .or. (.not. (z <= 2.05d+159))) then
tmp = t_0
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 t_0 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -2.8e+200) {
tmp = t_0;
} else if (z <= -5.9e+77) {
tmp = 4.0 + ((4.0 * x) / y);
} else if ((z <= -1.9e+45) || !(z <= 2.05e+159)) {
tmp = t_0;
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z / y) * -4.0) tmp = 0 if z <= -2.8e+200: tmp = t_0 elif z <= -5.9e+77: tmp = 4.0 + ((4.0 * x) / y) elif (z <= -1.9e+45) or not (z <= 2.05e+159): tmp = t_0 else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z / y) * -4.0)) tmp = 0.0 if (z <= -2.8e+200) tmp = t_0; elseif (z <= -5.9e+77) tmp = Float64(4.0 + Float64(Float64(4.0 * x) / y)); elseif ((z <= -1.9e+45) || !(z <= 2.05e+159)) tmp = t_0; else tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z / y) * -4.0); tmp = 0.0; if (z <= -2.8e+200) tmp = t_0; elseif (z <= -5.9e+77) tmp = 4.0 + ((4.0 * x) / y); elseif ((z <= -1.9e+45) || ~((z <= 2.05e+159))) tmp = t_0; else tmp = 4.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e+200], t$95$0, If[LessEqual[z, -5.9e+77], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.9e+45], N[Not[LessEqual[z, 2.05e+159]], $MachinePrecision]], t$95$0, N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.9 \cdot 10^{+77}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{+45} \lor \neg \left(z \leq 2.05 \cdot 10^{+159}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -2.79999999999999985e200 or -5.9e77 < z < -1.9000000000000001e45 or 2.05000000000000007e159 < z Initial program 98.5%
Taylor expanded in z around inf 91.0%
*-commutative91.0%
Simplified91.0%
if -2.79999999999999985e200 < z < -5.9e77Initial program 99.9%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 65.1%
Taylor expanded in x around 0 65.1%
associate-*r/65.1%
Simplified65.1%
if -1.9000000000000001e45 < z < 2.05000000000000007e159Initial program 99.4%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 87.5%
Taylor expanded in x around 0 87.5%
associate-*r/87.0%
Simplified87.0%
Taylor expanded in x around 0 87.5%
*-commutative87.5%
associate-*l/87.0%
associate-*r/87.5%
Simplified87.5%
Final simplification86.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* 4.0 (/ x y)))) (t_1 (+ 1.0 (* (/ z y) -4.0))))
(if (<= z -3.35e+50)
t_1
(if (<= z -7.5e-241)
t_0
(if (<= z 1.1e-180) 4.0 (if (<= z 1.8e+159) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 * (x / y));
double t_1 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -3.35e+50) {
tmp = t_1;
} else if (z <= -7.5e-241) {
tmp = t_0;
} else if (z <= 1.1e-180) {
tmp = 4.0;
} else if (z <= 1.8e+159) {
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 / y))
t_1 = 1.0d0 + ((z / y) * (-4.0d0))
if (z <= (-3.35d+50)) then
tmp = t_1
else if (z <= (-7.5d-241)) then
tmp = t_0
else if (z <= 1.1d-180) then
tmp = 4.0d0
else if (z <= 1.8d+159) 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 / y));
double t_1 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -3.35e+50) {
tmp = t_1;
} else if (z <= -7.5e-241) {
tmp = t_0;
} else if (z <= 1.1e-180) {
tmp = 4.0;
} else if (z <= 1.8e+159) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (4.0 * (x / y)) t_1 = 1.0 + ((z / y) * -4.0) tmp = 0 if z <= -3.35e+50: tmp = t_1 elif z <= -7.5e-241: tmp = t_0 elif z <= 1.1e-180: tmp = 4.0 elif z <= 1.8e+159: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(4.0 * Float64(x / y))) t_1 = Float64(1.0 + Float64(Float64(z / y) * -4.0)) tmp = 0.0 if (z <= -3.35e+50) tmp = t_1; elseif (z <= -7.5e-241) tmp = t_0; elseif (z <= 1.1e-180) tmp = 4.0; elseif (z <= 1.8e+159) 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 / y)); t_1 = 1.0 + ((z / y) * -4.0); tmp = 0.0; if (z <= -3.35e+50) tmp = t_1; elseif (z <= -7.5e-241) tmp = t_0; elseif (z <= 1.1e-180) tmp = 4.0; elseif (z <= 1.8e+159) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.35e+50], t$95$1, If[LessEqual[z, -7.5e-241], t$95$0, If[LessEqual[z, 1.1e-180], 4.0, If[LessEqual[z, 1.8e+159], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 4 \cdot \frac{x}{y}\\
t_1 := 1 + \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -3.35 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-241}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-180}:\\
\;\;\;\;4\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+159}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3499999999999999e50 or 1.80000000000000018e159 < z Initial program 98.9%
Taylor expanded in z around inf 76.9%
*-commutative76.9%
Simplified76.9%
if -3.3499999999999999e50 < z < -7.49999999999999977e-241 or 1.10000000000000007e-180 < z < 1.80000000000000018e159Initial program 99.9%
Taylor expanded in x around inf 52.6%
if -7.49999999999999977e-241 < z < 1.10000000000000007e-180Initial program 97.8%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 95.9%
Taylor expanded in x around 0 63.3%
Final simplification62.7%
(FPCore (x y z)
:precision binary64
(if (or (<= x -3.8e+154)
(not
(or (<= x -3.7e+81) (and (not (<= x -7.5e-43)) (<= x 2.45e+94)))))
(* 4.0 (/ x y))
4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.8e+154) || !((x <= -3.7e+81) || (!(x <= -7.5e-43) && (x <= 2.45e+94)))) {
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 <= (-3.8d+154)) .or. (.not. (x <= (-3.7d+81)) .or. (.not. (x <= (-7.5d-43))) .and. (x <= 2.45d+94))) 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 <= -3.8e+154) || !((x <= -3.7e+81) || (!(x <= -7.5e-43) && (x <= 2.45e+94)))) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.8e+154) or not ((x <= -3.7e+81) or (not (x <= -7.5e-43) and (x <= 2.45e+94))): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.8e+154) || !((x <= -3.7e+81) || (!(x <= -7.5e-43) && (x <= 2.45e+94)))) 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 <= -3.8e+154) || ~(((x <= -3.7e+81) || (~((x <= -7.5e-43)) && (x <= 2.45e+94))))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.8e+154], N[Not[Or[LessEqual[x, -3.7e+81], And[N[Not[LessEqual[x, -7.5e-43]], $MachinePrecision], LessEqual[x, 2.45e+94]]]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+154} \lor \neg \left(x \leq -3.7 \cdot 10^{+81} \lor \neg \left(x \leq -7.5 \cdot 10^{-43}\right) \land x \leq 2.45 \cdot 10^{+94}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -3.7999999999999998e154 or -3.7000000000000001e81 < x < -7.50000000000000068e-43 or 2.4499999999999999e94 < x Initial program 99.1%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 83.2%
Taylor expanded in x around inf 72.4%
if -3.7999999999999998e154 < x < -3.7000000000000001e81 or -7.50000000000000068e-43 < x < 2.4499999999999999e94Initial program 99.3%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 58.5%
Taylor expanded in x around 0 50.5%
Final simplification60.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.4e+33) (not (<= z 1.25e-64))) (+ 1.0 (* (- x z) (/ 4.0 y))) (+ 4.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.4e+33) || !(z <= 1.25e-64)) {
tmp = 1.0 + ((x - 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 <= (-4.4d+33)) .or. (.not. (z <= 1.25d-64))) then
tmp = 1.0d0 + ((x - 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 <= -4.4e+33) || !(z <= 1.25e-64)) {
tmp = 1.0 + ((x - z) * (4.0 / y));
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.4e+33) or not (z <= 1.25e-64): tmp = 1.0 + ((x - z) * (4.0 / y)) else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.4e+33) || !(z <= 1.25e-64)) tmp = Float64(1.0 + Float64(Float64(x - 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 <= -4.4e+33) || ~((z <= 1.25e-64))) tmp = 1.0 + ((x - 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, -4.4e+33], N[Not[LessEqual[z, 1.25e-64]], $MachinePrecision]], N[(1.0 + N[(N[(x - z), $MachinePrecision] * 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 -4.4 \cdot 10^{+33} \lor \neg \left(z \leq 1.25 \cdot 10^{-64}\right):\\
\;\;\;\;1 + \left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -4.39999999999999988e33 or 1.25000000000000008e-64 < z Initial program 99.2%
Taylor expanded in y around 0 86.6%
*-commutative86.6%
*-rgt-identity86.6%
associate-*r/86.4%
associate-*l*86.4%
associate-*l/86.4%
metadata-eval86.4%
Simplified86.4%
if -4.39999999999999988e33 < z < 1.25000000000000008e-64Initial program 99.1%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 92.8%
Taylor expanded in x around 0 92.8%
associate-*r/92.1%
Simplified92.1%
Taylor expanded in x around 0 92.8%
*-commutative92.8%
associate-*l/92.1%
associate-*r/92.8%
Simplified92.8%
Final simplification89.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e+54) (not (<= z 1.25e-64))) (+ 1.0 (* (- x z) (/ 4.0 y))) (+ 1.0 (+ 3.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+54) || !(z <= 1.25e-64)) {
tmp = 1.0 + ((x - z) * (4.0 / y));
} else {
tmp = 1.0 + (3.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 <= (-6d+54)) .or. (.not. (z <= 1.25d-64))) then
tmp = 1.0d0 + ((x - z) * (4.0d0 / y))
else
tmp = 1.0d0 + (3.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 <= -6e+54) || !(z <= 1.25e-64)) {
tmp = 1.0 + ((x - z) * (4.0 / y));
} else {
tmp = 1.0 + (3.0 + (4.0 * (x / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e+54) or not (z <= 1.25e-64): tmp = 1.0 + ((x - z) * (4.0 / y)) else: tmp = 1.0 + (3.0 + (4.0 * (x / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e+54) || !(z <= 1.25e-64)) tmp = Float64(1.0 + Float64(Float64(x - z) * Float64(4.0 / y))); else tmp = Float64(1.0 + Float64(3.0 + Float64(4.0 * Float64(x / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6e+54) || ~((z <= 1.25e-64))) tmp = 1.0 + ((x - z) * (4.0 / y)); else tmp = 1.0 + (3.0 + (4.0 * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e+54], N[Not[LessEqual[z, 1.25e-64]], $MachinePrecision]], N[(1.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(3.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+54} \lor \neg \left(z \leq 1.25 \cdot 10^{-64}\right):\\
\;\;\;\;1 + \left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(3 + 4 \cdot \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -5.9999999999999998e54 or 1.25000000000000008e-64 < z Initial program 99.2%
Taylor expanded in y around 0 86.6%
*-commutative86.6%
*-rgt-identity86.6%
associate-*r/86.4%
associate-*l*86.4%
associate-*l/86.4%
metadata-eval86.4%
Simplified86.4%
if -5.9999999999999998e54 < z < 1.25000000000000008e-64Initial program 99.1%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 92.8%
Final simplification89.6%
(FPCore (x y z) :precision binary64 (if (<= y -7.8e+95) 4.0 (if (<= y 3.1e+44) (+ 1.0 (* 4.0 (/ x y))) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.8e+95) {
tmp = 4.0;
} else if (y <= 3.1e+44) {
tmp = 1.0 + (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 (y <= (-7.8d+95)) then
tmp = 4.0d0
else if (y <= 3.1d+44) then
tmp = 1.0d0 + (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 (y <= -7.8e+95) {
tmp = 4.0;
} else if (y <= 3.1e+44) {
tmp = 1.0 + (4.0 * (x / y));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.8e+95: tmp = 4.0 elif y <= 3.1e+44: tmp = 1.0 + (4.0 * (x / y)) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.8e+95) tmp = 4.0; elseif (y <= 3.1e+44) tmp = Float64(1.0 + 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 (y <= -7.8e+95) tmp = 4.0; elseif (y <= 3.1e+44) tmp = 1.0 + (4.0 * (x / y)); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.8e+95], 4.0, If[LessEqual[y, 3.1e+44], N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+95}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+44}:\\
\;\;\;\;1 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -7.7999999999999994e95 or 3.09999999999999996e44 < y Initial program 98.9%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 85.7%
Taylor expanded in x around 0 69.8%
if -7.7999999999999994e95 < y < 3.09999999999999996e44Initial program 99.4%
Taylor expanded in x around inf 51.1%
Final simplification57.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 99.2%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 69.6%
Taylor expanded in x around 0 33.5%
Final simplification33.5%
herbie shell --seed 2024046
(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)))