
(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 (fma 4.0 (+ 0.75 (/ (- x z) y)) 1.0))
double code(double x, double y, double z) {
return fma(4.0, (0.75 + ((x - z) / y)), 1.0);
}
function code(x, y, z) return fma(4.0, Float64(0.75 + Float64(Float64(x - z) / y)), 1.0) end
code[x_, y_, z_] := N[(4.0 * N[(0.75 + N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(4, 0.75 + \frac{x - z}{y}, 1\right)
\end{array}
Initial program 99.2%
+-commutative99.2%
associate-/l*100.0%
fma-define100.0%
associate--l+100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
associate--r+100.0%
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%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= y -3e+58)
(and (not (<= y -1.4e-35))
(or (<= y -3.65e-113) (not (<= y 2.5e+63)))))
(+ 4.0 (* z (/ -4.0 y)))
(* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+58) || (!(y <= -1.4e-35) && ((y <= -3.65e-113) || !(y <= 2.5e+63)))) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 * ((x - 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 ((y <= (-3d+58)) .or. (.not. (y <= (-1.4d-35))) .and. (y <= (-3.65d-113)) .or. (.not. (y <= 2.5d+63))) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else
tmp = 4.0d0 * ((x - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3e+58) || (!(y <= -1.4e-35) && ((y <= -3.65e-113) || !(y <= 2.5e+63)))) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3e+58) or (not (y <= -1.4e-35) and ((y <= -3.65e-113) or not (y <= 2.5e+63))): tmp = 4.0 + (z * (-4.0 / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3e+58) || (!(y <= -1.4e-35) && ((y <= -3.65e-113) || !(y <= 2.5e+63)))) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3e+58) || (~((y <= -1.4e-35)) && ((y <= -3.65e-113) || ~((y <= 2.5e+63))))) tmp = 4.0 + (z * (-4.0 / y)); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3e+58], And[N[Not[LessEqual[y, -1.4e-35]], $MachinePrecision], Or[LessEqual[y, -3.65e-113], N[Not[LessEqual[y, 2.5e+63]], $MachinePrecision]]]], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+58} \lor \neg \left(y \leq -1.4 \cdot 10^{-35}\right) \land \left(y \leq -3.65 \cdot 10^{-113} \lor \neg \left(y \leq 2.5 \cdot 10^{+63}\right)\right):\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -3.0000000000000002e58 or -1.4e-35 < y < -3.65000000000000006e-113 or 2.50000000000000005e63 < y Initial program 98.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 87.0%
+-commutative87.0%
fma-define87.0%
div-sub87.0%
*-commutative87.0%
*-lft-identity87.0%
associate-*l/87.0%
associate-*r*87.0%
lft-mult-inverse87.1%
metadata-eval87.1%
fma-define87.1%
+-commutative87.1%
sub-neg87.1%
distribute-lft-in87.1%
metadata-eval87.1%
associate-+r+87.1%
metadata-eval87.1%
distribute-rgt-neg-out87.1%
*-lft-identity87.1%
associate-*l/87.0%
associate-*l*87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
associate-*r/87.0%
Simplified87.0%
if -3.0000000000000002e58 < y < -1.4e-35 or -3.65000000000000006e-113 < y < 2.50000000000000005e63Initial program 99.4%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 89.6%
*-commutative89.6%
Simplified89.6%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 x) y)))
(if (<= y -7e+55)
4.0
(if (<= y 2.6e-61)
t_0
(if (<= y 1.8e+15) (* -4.0 (/ z y)) (if (<= y 9.8e+59) t_0 4.0))))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double tmp;
if (y <= -7e+55) {
tmp = 4.0;
} else if (y <= 2.6e-61) {
tmp = t_0;
} else if (y <= 1.8e+15) {
tmp = -4.0 * (z / y);
} else if (y <= 9.8e+59) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (4.0d0 * x) / y
if (y <= (-7d+55)) then
tmp = 4.0d0
else if (y <= 2.6d-61) then
tmp = t_0
else if (y <= 1.8d+15) then
tmp = (-4.0d0) * (z / y)
else if (y <= 9.8d+59) then
tmp = t_0
else
tmp = 4.0d0
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 (y <= -7e+55) {
tmp = 4.0;
} else if (y <= 2.6e-61) {
tmp = t_0;
} else if (y <= 1.8e+15) {
tmp = -4.0 * (z / y);
} else if (y <= 9.8e+59) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * x) / y tmp = 0 if y <= -7e+55: tmp = 4.0 elif y <= 2.6e-61: tmp = t_0 elif y <= 1.8e+15: tmp = -4.0 * (z / y) elif y <= 9.8e+59: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / y) tmp = 0.0 if (y <= -7e+55) tmp = 4.0; elseif (y <= 2.6e-61) tmp = t_0; elseif (y <= 1.8e+15) tmp = Float64(-4.0 * Float64(z / y)); elseif (y <= 9.8e+59) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * x) / y; tmp = 0.0; if (y <= -7e+55) tmp = 4.0; elseif (y <= 2.6e-61) tmp = t_0; elseif (y <= 1.8e+15) tmp = -4.0 * (z / y); elseif (y <= 9.8e+59) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -7e+55], 4.0, If[LessEqual[y, 2.6e-61], t$95$0, If[LessEqual[y, 1.8e+15], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e+59], t$95$0, 4.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{y}\\
\mathbf{if}\;y \leq -7 \cdot 10^{+55}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -7.00000000000000021e55 or 9.80000000000000015e59 < y Initial program 98.7%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 73.1%
if -7.00000000000000021e55 < y < 2.6000000000000001e-61 or 1.8e15 < y < 9.80000000000000015e59Initial program 99.4%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 52.1%
*-commutative52.1%
associate-*l/52.1%
Simplified52.1%
if 2.6000000000000001e-61 < y < 1.8e15Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 59.9%
Final simplification59.4%
(FPCore (x y z) :precision binary64 (if (<= y -4.3e+127) 4.0 (if (<= y 1.12e+63) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.3e+127) {
tmp = 4.0;
} else if (y <= 1.12e+63) {
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 <= (-4.3d+127)) then
tmp = 4.0d0
else if (y <= 1.12d+63) 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 <= -4.3e+127) {
tmp = 4.0;
} else if (y <= 1.12e+63) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.3e+127: tmp = 4.0 elif y <= 1.12e+63: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.3e+127) tmp = 4.0; elseif (y <= 1.12e+63) 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 <= -4.3e+127) tmp = 4.0; elseif (y <= 1.12e+63) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.3e+127], 4.0, If[LessEqual[y, 1.12e+63], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{+127}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+63}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -4.29999999999999984e127 or 1.12000000000000006e63 < y Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 78.3%
if -4.29999999999999984e127 < y < 1.12000000000000006e63Initial program 99.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 84.9%
*-commutative84.9%
Simplified84.9%
Final simplification83.0%
(FPCore (x y z) :precision binary64 (if (<= z -4.2e+73) (+ 4.0 (* z (/ -4.0 y))) (if (<= z 1.7e-72) (+ 4.0 (/ (* 4.0 x) y)) (* 4.0 (/ (- x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e+73) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (z <= 1.7e-72) {
tmp = 4.0 + ((4.0 * x) / y);
} else {
tmp = 4.0 * ((x - 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 (z <= (-4.2d+73)) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else if (z <= 1.7d-72) then
tmp = 4.0d0 + ((4.0d0 * x) / y)
else
tmp = 4.0d0 * ((x - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e+73) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (z <= 1.7e-72) {
tmp = 4.0 + ((4.0 * x) / y);
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.2e+73: tmp = 4.0 + (z * (-4.0 / y)) elif z <= 1.7e-72: tmp = 4.0 + ((4.0 * x) / y) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.2e+73) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); elseif (z <= 1.7e-72) tmp = Float64(4.0 + Float64(Float64(4.0 * x) / y)); else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.2e+73) tmp = 4.0 + (z * (-4.0 / y)); elseif (z <= 1.7e-72) tmp = 4.0 + ((4.0 * x) / y); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.2e+73], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e-72], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+73}:\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-72}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if z < -4.2000000000000003e73Initial program 97.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 93.6%
+-commutative93.6%
fma-define93.6%
div-sub93.6%
*-commutative93.6%
*-lft-identity93.6%
associate-*l/93.6%
associate-*r*93.6%
lft-mult-inverse93.7%
metadata-eval93.7%
fma-define93.7%
+-commutative93.7%
sub-neg93.7%
distribute-lft-in93.7%
metadata-eval93.7%
associate-+r+93.7%
metadata-eval93.7%
distribute-rgt-neg-out93.7%
*-lft-identity93.7%
associate-*l/93.5%
associate-*l*93.5%
*-commutative93.5%
distribute-rgt-neg-in93.5%
associate-*r/93.5%
Simplified93.5%
if -4.2000000000000003e73 < z < 1.6999999999999999e-72Initial 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-sub99.9%
sub-neg99.9%
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 91.5%
distribute-lft-in91.5%
metadata-eval91.5%
associate-+r+91.6%
metadata-eval91.6%
*-commutative91.6%
associate-*l/91.6%
Simplified91.6%
if 1.6999999999999999e-72 < z Initial program 98.7%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 84.9%
*-commutative84.9%
Simplified84.9%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+57) 4.0 (if (<= y 5e+39) (* -4.0 (/ z y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+57) {
tmp = 4.0;
} else if (y <= 5e+39) {
tmp = -4.0 * (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 <= (-2.7d+57)) then
tmp = 4.0d0
else if (y <= 5d+39) then
tmp = (-4.0d0) * (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 <= -2.7e+57) {
tmp = 4.0;
} else if (y <= 5e+39) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+57: tmp = 4.0 elif y <= 5e+39: tmp = -4.0 * (z / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+57) tmp = 4.0; elseif (y <= 5e+39) tmp = Float64(-4.0 * Float64(z / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e+57) tmp = 4.0; elseif (y <= 5e+39) tmp = -4.0 * (z / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+57], 4.0, If[LessEqual[y, 5e+39], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+57}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+39}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -2.6999999999999998e57 or 5.00000000000000015e39 < y Initial program 98.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 69.7%
if -2.6999999999999998e57 < y < 5.00000000000000015e39Initial program 99.4%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 46.7%
Final simplification55.1%
(FPCore (x y z) :precision binary64 (+ 1.0 (* 4.0 (/ (+ x (- (* 0.75 y) z)) y))))
double code(double x, double y, double z) {
return 1.0 + (4.0 * ((x + ((0.75 * y) - 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 + ((0.75d0 * y) - z)) / y))
end function
public static double code(double x, double y, double z) {
return 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y));
}
def code(x, y, z): return 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y))
function code(x, y, z) return Float64(1.0 + Float64(4.0 * Float64(Float64(x + Float64(Float64(0.75 * y) - z)) / y))) end
function tmp = code(x, y, z) tmp = 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y)); end
code[x_, y_, z_] := N[(1.0 + N[(4.0 * N[(N[(x + N[(N[(0.75 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 4 \cdot \frac{x + \left(0.75 \cdot y - z\right)}{y}
\end{array}
Initial program 99.2%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (/ (* 4.0 (+ (- x z) y)) y))
double code(double x, double y, double z) {
return (4.0 * ((x - z) + y)) / 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 * ((x - z) + y)) / y
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - z) + y)) / y;
}
def code(x, y, z): return (4.0 * ((x - z) + y)) / y
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - z) + y)) / y) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - z) + y)) / y; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - z), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - z\right) + y\right)}{y}
\end{array}
Initial program 99.2%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
distribute-lft-out98.9%
Simplified98.9%
Final simplification98.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%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 33.0%
Final simplification33.0%
herbie shell --seed 2024079
(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)))