
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
Initial program 86.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x z) (- z t))))
(if (<= z -1.15e+194)
(fma x (/ t z) x)
(if (<= z -0.00115)
t_1
(if (<= z 4.5e-97)
(* (/ x (- t z)) y)
(if (<= z 1.45e-30) t_1 (- x (/ (* x y) z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) / (z - t);
double tmp;
if (z <= -1.15e+194) {
tmp = fma(x, (t / z), x);
} else if (z <= -0.00115) {
tmp = t_1;
} else if (z <= 4.5e-97) {
tmp = (x / (t - z)) * y;
} else if (z <= 1.45e-30) {
tmp = t_1;
} else {
tmp = x - ((x * y) / z);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * z) / Float64(z - t)) tmp = 0.0 if (z <= -1.15e+194) tmp = fma(x, Float64(t / z), x); elseif (z <= -0.00115) tmp = t_1; elseif (z <= 4.5e-97) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (z <= 1.45e-30) tmp = t_1; else tmp = Float64(x - Float64(Float64(x * y) / z)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.15e+194], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, -0.00115], t$95$1, If[LessEqual[z, 4.5e-97], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.45e-30], t$95$1, N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot z}{z - t}\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq -0.00115:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\end{array}
\end{array}
if z < -1.15000000000000003e194Initial program 58.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f643.6
Applied rewrites3.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6458.8
Applied rewrites58.8%
Taylor expanded in t around 0
Applied rewrites92.5%
if -1.15000000000000003e194 < z < -0.00115 or 4.5000000000000001e-97 < z < 1.44999999999999995e-30Initial program 95.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.7
Applied rewrites25.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6465.0
Applied rewrites65.0%
if -0.00115 < z < 4.5000000000000001e-97Initial program 95.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.0
Applied rewrites84.0%
if 1.44999999999999995e-30 < z Initial program 76.4%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
Final simplification78.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -0.00115)
(* (/ z (- z t)) x)
(if (<= z 4.5e-97)
(* (/ x (- t z)) y)
(if (<= z 1.45e-30) (/ (* x z) (- z t)) (* (/ (- z y) z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00115) {
tmp = (z / (z - t)) * x;
} else if (z <= 4.5e-97) {
tmp = (x / (t - z)) * y;
} else if (z <= 1.45e-30) {
tmp = (x * z) / (z - t);
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.00115d0)) then
tmp = (z / (z - t)) * x
else if (z <= 4.5d-97) then
tmp = (x / (t - z)) * y
else if (z <= 1.45d-30) then
tmp = (x * z) / (z - t)
else
tmp = ((z - y) / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00115) {
tmp = (z / (z - t)) * x;
} else if (z <= 4.5e-97) {
tmp = (x / (t - z)) * y;
} else if (z <= 1.45e-30) {
tmp = (x * z) / (z - t);
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00115: tmp = (z / (z - t)) * x elif z <= 4.5e-97: tmp = (x / (t - z)) * y elif z <= 1.45e-30: tmp = (x * z) / (z - t) else: tmp = ((z - y) / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00115) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (z <= 4.5e-97) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (z <= 1.45e-30) tmp = Float64(Float64(x * z) / Float64(z - t)); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00115) tmp = (z / (z - t)) * x; elseif (z <= 4.5e-97) tmp = (x / (t - z)) * y; elseif (z <= 1.45e-30) tmp = (x * z) / (z - t); else tmp = ((z - y) / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00115], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 4.5e-97], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.45e-30], N[(N[(x * z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00115:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-30}:\\
\;\;\;\;\frac{x \cdot z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if z < -0.00115Initial program 81.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6476.0
Applied rewrites76.0%
if -0.00115 < z < 4.5000000000000001e-97Initial program 95.3%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.0
Applied rewrites84.0%
if 4.5000000000000001e-97 < z < 1.44999999999999995e-30Initial program 99.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.2
Applied rewrites40.2%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6475.4
Applied rewrites75.4%
if 1.44999999999999995e-30 < z Initial program 76.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.7
Applied rewrites84.7%
Final simplification81.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+194)
(fma x (/ t z) x)
(if (<= z -0.00145)
(- x (/ (* x y) z))
(if (<= z 1.4e+98) (* (/ x (- t z)) y) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+194) {
tmp = fma(x, (t / z), x);
} else if (z <= -0.00145) {
tmp = x - ((x * y) / z);
} else if (z <= 1.4e+98) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+194) tmp = fma(x, Float64(t / z), x); elseif (z <= -0.00145) tmp = Float64(x - Float64(Float64(x * y) / z)); elseif (z <= 1.4e+98) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+194], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, -0.00145], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+98], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq -0.00145:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -4.4999999999999998e194Initial program 58.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f643.6
Applied rewrites3.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6458.8
Applied rewrites58.8%
Taylor expanded in t around 0
Applied rewrites92.5%
if -4.4999999999999998e194 < z < -0.00145Initial program 93.3%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.9
Applied rewrites58.9%
if -0.00145 < z < 1.4e98Initial program 95.8%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
if 1.4e98 < z Initial program 68.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.1%
Final simplification76.2%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+194) (* (/ z (- z t)) x) (if (<= z 1.6e+90) (* (/ x (- t z)) (- y z)) (* (/ (- z y) z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+194) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.6e+90) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.8d+194)) then
tmp = (z / (z - t)) * x
else if (z <= 1.6d+90) then
tmp = (x / (t - z)) * (y - z)
else
tmp = ((z - y) / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+194) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.6e+90) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+194: tmp = (z / (z - t)) * x elif z <= 1.6e+90: tmp = (x / (t - z)) * (y - z) else: tmp = ((z - y) / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+194) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (z <= 1.6e+90) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+194) tmp = (z / (z - t)) * x; elseif (z <= 1.6e+90) tmp = (x / (t - z)) * (y - z); else tmp = ((z - y) / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+194], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.6e+90], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+194}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if z < -5.8000000000000001e194Initial program 61.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6499.4
Applied rewrites99.4%
if -5.8000000000000001e194 < z < 1.59999999999999999e90Initial program 95.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.9
Applied rewrites91.9%
if 1.59999999999999999e90 < z Initial program 68.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6492.4
Applied rewrites92.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ z (- z t)) x))) (if (<= z -0.00115) t_1 (if (<= z 1.4e+98) (* (/ x (- t z)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (z / (z - t)) * x;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= 1.4e+98) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z / (z - t)) * x
if (z <= (-0.00115d0)) then
tmp = t_1
else if (z <= 1.4d+98) then
tmp = (x / (t - z)) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / (z - t)) * x;
double tmp;
if (z <= -0.00115) {
tmp = t_1;
} else if (z <= 1.4e+98) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / (z - t)) * x tmp = 0 if z <= -0.00115: tmp = t_1 elif z <= 1.4e+98: tmp = (x / (t - z)) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / Float64(z - t)) * x) tmp = 0.0 if (z <= -0.00115) tmp = t_1; elseif (z <= 1.4e+98) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / (z - t)) * x; tmp = 0.0; if (z <= -0.00115) tmp = t_1; elseif (z <= 1.4e+98) tmp = (x / (t - z)) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -0.00115], t$95$1, If[LessEqual[z, 1.4e+98], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{z - t} \cdot x\\
\mathbf{if}\;z \leq -0.00115:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.00115 or 1.4e98 < z Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6482.0
Applied rewrites82.0%
if -0.00115 < z < 1.4e98Initial program 95.8%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.26e+87) (fma x (/ t z) x) (if (<= z 1.4e+98) (* (/ x (- t z)) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.26e+87) {
tmp = fma(x, (t / z), x);
} else if (z <= 1.4e+98) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.26e+87) tmp = fma(x, Float64(t / z), x); elseif (z <= 1.4e+98) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.26e+87], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.4e+98], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.26 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.26000000000000005e87Initial program 71.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f643.7
Applied rewrites3.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6459.7
Applied rewrites59.7%
Taylor expanded in t around 0
Applied rewrites68.8%
if -1.26000000000000005e87 < z < 1.4e98Initial program 95.8%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6470.4
Applied rewrites70.4%
if 1.4e98 < z Initial program 68.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.9e+94) (fma x (/ t z) x) (if (<= z 6e+101) (* (/ x t) (- y z)) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e+94) {
tmp = fma(x, (t / z), x);
} else if (z <= 6e+101) {
tmp = (x / t) * (y - z);
} else {
tmp = 1.0 * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e+94) tmp = fma(x, Float64(t / z), x); elseif (z <= 6e+101) tmp = Float64(Float64(x / t) * Float64(y - z)); else tmp = Float64(1.0 * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+94], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 6e+101], N[(N[(x / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.8999999999999998e94Initial program 72.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f643.6
Applied rewrites3.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6459.0
Applied rewrites59.0%
Taylor expanded in t around 0
Applied rewrites71.6%
if -2.8999999999999998e94 < z < 5.99999999999999986e101Initial program 95.3%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.3
Applied rewrites68.3%
Applied rewrites66.0%
if 5.99999999999999986e101 < z Initial program 68.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.1%
(FPCore (x y z t) :precision binary64 (if (<= z -7e+30) (fma x (/ t z) x) (if (<= z 1.3e+97) (* (/ y t) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+30) {
tmp = fma(x, (t / z), x);
} else if (z <= 1.3e+97) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+30) tmp = fma(x, Float64(t / z), x); elseif (z <= 1.3e+97) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+30], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.3e+97], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -7.00000000000000042e30Initial program 78.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6412.2
Applied rewrites12.2%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6461.5
Applied rewrites61.5%
Taylor expanded in t around 0
Applied rewrites59.3%
if -7.00000000000000042e30 < z < 1.3e97Initial program 96.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
Taylor expanded in z around 0
lower-/.f6461.2
Applied rewrites61.2%
if 1.3e97 < z Initial program 68.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.1%
(FPCore (x y z t) :precision binary64 (if (<= z -7e+30) (* 1.0 x) (if (<= z 1.3e+97) (* (/ y t) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+30) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-7d+30)) then
tmp = 1.0d0 * x
else if (z <= 1.3d+97) then
tmp = (y / t) * x
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+30) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e+30: tmp = 1.0 * x elif z <= 1.3e+97: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+30) tmp = Float64(1.0 * x); elseif (z <= 1.3e+97) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e+30) tmp = 1.0 * x; elseif (z <= 1.3e+97) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+30], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.3e+97], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+30}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -7.00000000000000042e30 or 1.3e97 < z Initial program 73.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites70.4%
if -7.00000000000000042e30 < z < 1.3e97Initial program 96.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
Taylor expanded in z around 0
lower-/.f6461.2
Applied rewrites61.2%
(FPCore (x y z t) :precision binary64 (if (<= z -4.5e+30) (* 1.0 x) (if (<= z 1.3e+97) (/ (* x y) t) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+30) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.5d+30)) then
tmp = 1.0d0 * x
else if (z <= 1.3d+97) then
tmp = (x * y) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+30) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+30: tmp = 1.0 * x elif z <= 1.3e+97: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+30) tmp = Float64(1.0 * x); elseif (z <= 1.3e+97) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+30) tmp = 1.0 * x; elseif (z <= 1.3e+97) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+30], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.3e+97], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+30}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -4.49999999999999995e30 or 1.3e97 < z Initial program 73.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites70.4%
if -4.49999999999999995e30 < z < 1.3e97Initial program 96.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.5
Applied rewrites60.5%
Final simplification64.6%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00145) (* 1.0 x) (if (<= z 1.3e+97) (* (/ x t) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00145) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.00145d0)) then
tmp = 1.0d0 * x
else if (z <= 1.3d+97) then
tmp = (x / t) * y
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00145) {
tmp = 1.0 * x;
} else if (z <= 1.3e+97) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00145: tmp = 1.0 * x elif z <= 1.3e+97: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00145) tmp = Float64(1.0 * x); elseif (z <= 1.3e+97) tmp = Float64(Float64(x / t) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00145) tmp = 1.0 * x; elseif (z <= 1.3e+97) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00145], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.3e+97], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00145:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+97}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -0.00145 or 1.3e97 < z Initial program 75.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites67.4%
if -0.00145 < z < 1.3e97Initial program 95.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.3
Applied rewrites62.3%
Applied rewrites61.6%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 86.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites36.9%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024244
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))