
(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 10 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 (/ (- 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}
Initial program 84.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.1
Applied rewrites97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- y z) t) x)))
(if (<= t -7.5e+186)
t_1
(if (<= t -4.8e-61)
(* (/ z (- z t)) x)
(if (<= t 9.4e-42) (fma (- x) (/ y z) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((y - z) / t) * x;
double tmp;
if (t <= -7.5e+186) {
tmp = t_1;
} else if (t <= -4.8e-61) {
tmp = (z / (z - t)) * x;
} else if (t <= 9.4e-42) {
tmp = fma(-x, (y / z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(y - z) / t) * x) tmp = 0.0 if (t <= -7.5e+186) tmp = t_1; elseif (t <= -4.8e-61) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (t <= 9.4e-42) tmp = fma(Float64(-x), Float64(y / z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -7.5e+186], t$95$1, If[LessEqual[t, -4.8e-61], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 9.4e-42], N[((-x) * N[(y / z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{t} \cdot x\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.8 \cdot 10^{-61}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;t \leq 9.4 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.4999999999999998e186 or 9.4000000000000001e-42 < t Initial program 82.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift--.f64N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites95.7%
Taylor expanded in t around inf
mul-1-negN/A
distribute-frac-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-/.f64N/A
lower--.f6484.7
Applied rewrites84.7%
if -7.4999999999999998e186 < t < -4.8000000000000002e-61Initial program 87.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6433.1
Applied rewrites33.1%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/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--.f6465.6
Applied rewrites65.6%
if -4.8000000000000002e-61 < t < 9.4000000000000001e-42Initial program 83.8%
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-*.f6483.4
Applied rewrites83.4%
Applied rewrites84.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z (- z t)) x)))
(if (<= z -0.02)
t_1
(if (<= z 1.22e-123)
(/ (* (- y z) x) t)
(if (<= z 9.5e+89) (* (/ 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.02) {
tmp = t_1;
} else if (z <= 1.22e-123) {
tmp = ((y - z) * x) / t;
} else if (z <= 9.5e+89) {
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.02d0)) then
tmp = t_1
else if (z <= 1.22d-123) then
tmp = ((y - z) * x) / t
else if (z <= 9.5d+89) 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.02) {
tmp = t_1;
} else if (z <= 1.22e-123) {
tmp = ((y - z) * x) / t;
} else if (z <= 9.5e+89) {
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.02: tmp = t_1 elif z <= 1.22e-123: tmp = ((y - z) * x) / t elif z <= 9.5e+89: 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.02) tmp = t_1; elseif (z <= 1.22e-123) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 9.5e+89) 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.02) tmp = t_1; elseif (z <= 1.22e-123) tmp = ((y - z) * x) / t; elseif (z <= 9.5e+89) 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.02], t$95$1, If[LessEqual[z, 1.22e-123], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9.5e+89], 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.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{-123}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+89}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.0200000000000000004 or 9.5000000000000003e89 < z Initial program 71.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6411.6
Applied rewrites11.6%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/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--.f6484.1
Applied rewrites84.1%
if -0.0200000000000000004 < z < 1.22e-123Initial program 95.3%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.9
Applied rewrites81.9%
if 1.22e-123 < z < 9.5000000000000003e89Initial program 84.9%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6469.6
Applied rewrites69.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e+213)
(* 1.0 x)
(if (<= z -24000000000000.0)
(* (/ x (- z t)) z)
(if (<= z 1.4e+93) (* (/ x (- t z)) y) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+213) {
tmp = 1.0 * x;
} else if (z <= -24000000000000.0) {
tmp = (x / (z - t)) * z;
} else if (z <= 1.4e+93) {
tmp = (x / (t - z)) * 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 <= (-1.45d+213)) then
tmp = 1.0d0 * x
else if (z <= (-24000000000000.0d0)) then
tmp = (x / (z - t)) * z
else if (z <= 1.4d+93) then
tmp = (x / (t - z)) * 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 <= -1.45e+213) {
tmp = 1.0 * x;
} else if (z <= -24000000000000.0) {
tmp = (x / (z - t)) * z;
} else if (z <= 1.4e+93) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e+213: tmp = 1.0 * x elif z <= -24000000000000.0: tmp = (x / (z - t)) * z elif z <= 1.4e+93: tmp = (x / (t - z)) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+213) tmp = Float64(1.0 * x); elseif (z <= -24000000000000.0) tmp = Float64(Float64(x / Float64(z - t)) * z); elseif (z <= 1.4e+93) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e+213) tmp = 1.0 * x; elseif (z <= -24000000000000.0) tmp = (x / (z - t)) * z; elseif (z <= 1.4e+93) tmp = (x / (t - z)) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+213], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -24000000000000.0], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 1.4e+93], 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.45 \cdot 10^{+213}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -24000000000000:\\
\;\;\;\;\frac{x}{z - t} \cdot z\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.45000000000000015e213 or 1.39999999999999994e93 < z Initial program 72.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift--.f64N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites82.0%
if -1.45000000000000015e213 < z < -2.4e13Initial program 69.2%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.7
Applied rewrites21.7%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/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--.f6471.4
Applied rewrites71.4%
Applied rewrites71.2%
if -2.4e13 < z < 1.39999999999999994e93Initial program 92.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.9
Applied rewrites72.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.7e+213) (fma (- x) (/ y z) x) (if (<= z 6e+146) (* (/ x (- t z)) (- y z)) (* (/ z (- z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e+213) {
tmp = fma(-x, (y / z), x);
} else if (z <= 6e+146) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e+213) tmp = fma(Float64(-x), Float64(y / z), x); elseif (z <= 6e+146) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = Float64(Float64(z / Float64(z - t)) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e+213], N[((-x) * N[(y / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 6e+146], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+213}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{z}, x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+146}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
\end{array}
if z < -1.69999999999999996e213Initial program 66.9%
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-*.f6485.6
Applied rewrites85.6%
Applied rewrites95.2%
if -1.69999999999999996e213 < z < 6.00000000000000005e146Initial program 87.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.7
Applied rewrites90.7%
if 6.00000000000000005e146 < z Initial program 74.4%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f644.6
Applied rewrites4.6%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/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--.f6496.9
Applied rewrites96.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z (- z t)) x)))
(if (<= z -24000000000000.0)
t_1
(if (<= z 9.5e+89) (* (/ 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 <= -24000000000000.0) {
tmp = t_1;
} else if (z <= 9.5e+89) {
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 <= (-24000000000000.0d0)) then
tmp = t_1
else if (z <= 9.5d+89) 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 <= -24000000000000.0) {
tmp = t_1;
} else if (z <= 9.5e+89) {
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 <= -24000000000000.0: tmp = t_1 elif z <= 9.5e+89: 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 <= -24000000000000.0) tmp = t_1; elseif (z <= 9.5e+89) 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 <= -24000000000000.0) tmp = t_1; elseif (z <= 9.5e+89) 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, -24000000000000.0], t$95$1, If[LessEqual[z, 9.5e+89], 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 -24000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+89}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4e13 or 9.5000000000000003e89 < z Initial program 71.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6410.8
Applied rewrites10.8%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/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--.f6484.6
Applied rewrites84.6%
if -2.4e13 < z < 9.5000000000000003e89Initial program 92.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.9
Applied rewrites72.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.42e+106) (* 1.0 x) (if (<= z 1.4e+93) (* (/ x (- t z)) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.42e+106) {
tmp = 1.0 * x;
} else if (z <= 1.4e+93) {
tmp = (x / (t - z)) * 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 <= (-1.42d+106)) then
tmp = 1.0d0 * x
else if (z <= 1.4d+93) then
tmp = (x / (t - z)) * 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 <= -1.42e+106) {
tmp = 1.0 * x;
} else if (z <= 1.4e+93) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.42e+106: tmp = 1.0 * x elif z <= 1.4e+93: tmp = (x / (t - z)) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.42e+106) tmp = Float64(1.0 * x); elseif (z <= 1.4e+93) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.42e+106) tmp = 1.0 * x; elseif (z <= 1.4e+93) tmp = (x / (t - z)) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.42e+106], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.4e+93], 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.42 \cdot 10^{+106}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.4200000000000001e106 or 1.39999999999999994e93 < z Initial program 68.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift--.f64N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites74.7%
if -1.4200000000000001e106 < z < 1.39999999999999994e93Initial program 91.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6469.6
Applied rewrites69.6%
(FPCore (x y z t) :precision binary64 (if (<= z -4.9e+51) (* 1.0 x) (if (<= z 9.5e+92) (* (/ y t) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.9e+51) {
tmp = 1.0 * x;
} else if (z <= 9.5e+92) {
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 <= (-4.9d+51)) then
tmp = 1.0d0 * x
else if (z <= 9.5d+92) 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 <= -4.9e+51) {
tmp = 1.0 * x;
} else if (z <= 9.5e+92) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.9e+51: tmp = 1.0 * x elif z <= 9.5e+92: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.9e+51) tmp = Float64(1.0 * x); elseif (z <= 9.5e+92) 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 <= -4.9e+51) tmp = 1.0 * x; elseif (z <= 9.5e+92) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.9e+51], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 9.5e+92], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+51}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -4.89999999999999983e51 or 9.4999999999999995e92 < z Initial program 67.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift--.f64N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites70.4%
if -4.89999999999999983e51 < z < 9.4999999999999995e92Initial program 92.5%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.3
Applied rewrites62.3%
Applied rewrites63.9%
Final simplification66.1%
(FPCore (x y z t) :precision binary64 (* (/ (- y z) (- t z)) x))
double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * 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 = ((y - z) / (t - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
def code(x, y, z, t): return ((y - z) / (t - z)) * x
function code(x, y, z, t) return Float64(Float64(Float64(y - z) / Float64(t - z)) * x) end
function tmp = code(x, y, z, t) tmp = ((y - z) / (t - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - z}{t - z} \cdot x
\end{array}
Initial program 84.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
(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 84.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.1
Applied rewrites97.1%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift--.f64N/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.5%
Taylor expanded in z around inf
Applied rewrites33.4%
(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 2024270
(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)))