
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= t 1.5e-111) (+ (- x (/ y (* z 3.0))) (/ (/ t z) (* 3.0 y))) (fma t (/ 0.3333333333333333 (* z y)) (- x (/ y (* 3.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.5e-111) {
tmp = (x - (y / (z * 3.0))) + ((t / z) / (3.0 * y));
} else {
tmp = fma(t, (0.3333333333333333 / (z * y)), (x - (y / (3.0 * z))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 1.5e-111) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / z) / Float64(3.0 * y))); else tmp = fma(t, Float64(0.3333333333333333 / Float64(z * y)), Float64(x - Float64(y / Float64(3.0 * z)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.5e-111], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / z), $MachinePrecision] / N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] + N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.5 \cdot 10^{-111}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z}}{3 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{0.3333333333333333}{z \cdot y}, x - \frac{y}{3 \cdot z}\right)\\
\end{array}
\end{array}
if t < 1.50000000000000004e-111Initial program 95.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
if 1.50000000000000004e-111 < t Initial program 95.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
Applied rewrites95.5%
(FPCore (x y z t) :precision binary64 (if (<= t 1e-111) (fma (/ t z) (/ 0.3333333333333333 y) (fma -0.3333333333333333 (/ y z) x)) (fma t (/ 0.3333333333333333 (* z y)) (- x (/ y (* 3.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1e-111) {
tmp = fma((t / z), (0.3333333333333333 / y), fma(-0.3333333333333333, (y / z), x));
} else {
tmp = fma(t, (0.3333333333333333 / (z * y)), (x - (y / (3.0 * z))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 1e-111) tmp = fma(Float64(t / z), Float64(0.3333333333333333 / y), fma(-0.3333333333333333, Float64(y / z), x)); else tmp = fma(t, Float64(0.3333333333333333 / Float64(z * y)), Float64(x - Float64(y / Float64(3.0 * z)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 1e-111], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision] + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(t * N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] + N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 10^{-111}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, \frac{0.3333333333333333}{y}, \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{0.3333333333333333}{z \cdot y}, x - \frac{y}{3 \cdot z}\right)\\
\end{array}
\end{array}
if t < 1.00000000000000009e-111Initial program 95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
mult-flipN/A
metadata-evalN/A
times-fracN/A
metadata-evalN/A
associate-*l*N/A
mult-flipN/A
*-commutativeN/A
Applied rewrites96.0%
if 1.00000000000000009e-111 < t Initial program 95.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
Applied rewrites95.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma -0.3333333333333333 (/ y z) x)))
(if (<= t 1e-111)
(fma (/ t z) (/ 0.3333333333333333 y) t_1)
(fma (/ 0.3333333333333333 (* z y)) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(-0.3333333333333333, (y / z), x);
double tmp;
if (t <= 1e-111) {
tmp = fma((t / z), (0.3333333333333333 / y), t_1);
} else {
tmp = fma((0.3333333333333333 / (z * y)), t, t_1);
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(-0.3333333333333333, Float64(y / z), x) tmp = 0.0 if (t <= 1e-111) tmp = fma(Float64(t / z), Float64(0.3333333333333333 / y), t_1); else tmp = fma(Float64(0.3333333333333333 / Float64(z * y)), t, t_1); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, 1e-111], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] * t + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\mathbf{if}\;t \leq 10^{-111}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, \frac{0.3333333333333333}{y}, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{0.3333333333333333}{z \cdot y}, t, t\_1\right)\\
\end{array}
\end{array}
if t < 1.00000000000000009e-111Initial program 95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
mult-flipN/A
metadata-evalN/A
times-fracN/A
metadata-evalN/A
associate-*l*N/A
mult-flipN/A
*-commutativeN/A
Applied rewrites96.0%
if 1.00000000000000009e-111 < t Initial program 95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-/r*N/A
*-commutativeN/A
mult-flip-revN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites95.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ (* (- (/ t y) y) -0.3333333333333333) z))))
(if (<= y -4.1e-29)
t_1
(if (<= y 7.2e-78) (/ (fma (/ t z) 0.3333333333333333 (* y x)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((((t / y) - y) * -0.3333333333333333) / z);
double tmp;
if (y <= -4.1e-29) {
tmp = t_1;
} else if (y <= 7.2e-78) {
tmp = fma((t / z), 0.3333333333333333, (y * x)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(Float64(Float64(t / y) - y) * -0.3333333333333333) / z)) tmp = 0.0 if (y <= -4.1e-29) tmp = t_1; elseif (y <= 7.2e-78) tmp = Float64(fma(Float64(t / z), 0.3333333333333333, Float64(y * x)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.1e-29], t$95$1, If[LessEqual[y, 7.2e-78], N[(N[(N[(t / z), $MachinePrecision] * 0.3333333333333333 + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{\left(\frac{t}{y} - y\right) \cdot -0.3333333333333333}{z}\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t}{z}, 0.3333333333333333, y \cdot x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.0999999999999998e-29 or 7.2000000000000005e-78 < y Initial program 95.7%
Applied rewrites95.8%
if -4.0999999999999998e-29 < y < 7.2000000000000005e-78Initial program 95.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ (- (/ t y) y) z) 0.3333333333333333 x)))
(if (<= y -4.1e-29)
t_1
(if (<= y 5.5e-82) (/ (fma (/ t z) 0.3333333333333333 (* y x)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((((t / y) - y) / z), 0.3333333333333333, x);
double tmp;
if (y <= -4.1e-29) {
tmp = t_1;
} else if (y <= 5.5e-82) {
tmp = fma((t / z), 0.3333333333333333, (y * x)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(Float64(Float64(t / y) - y) / z), 0.3333333333333333, x) tmp = 0.0 if (y <= -4.1e-29) tmp = t_1; elseif (y <= 5.5e-82) tmp = Float64(fma(Float64(t / z), 0.3333333333333333, Float64(y * x)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -4.1e-29], t$95$1, If[LessEqual[y, 5.5e-82], N[(N[(N[(t / z), $MachinePrecision] * 0.3333333333333333 + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\frac{t}{y} - y}{z}, 0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t}{z}, 0.3333333333333333, y \cdot x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.0999999999999998e-29 or 5.4999999999999998e-82 < y Initial program 95.7%
Applied rewrites95.7%
if -4.0999999999999998e-29 < y < 5.4999999999999998e-82Initial program 95.7%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))) 2e+294) (- x (/ (- (/ y z) (/ t (* z y))) 3.0)) (fma (/ 1.0 z) (* (- (/ t y) y) 0.3333333333333333) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))) <= 2e+294) {
tmp = x - (((y / z) - (t / (z * y))) / 3.0);
} else {
tmp = fma((1.0 / z), (((t / y) - y) * 0.3333333333333333), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) <= 2e+294) tmp = Float64(x - Float64(Float64(Float64(y / z) - Float64(t / Float64(z * y))) / 3.0)); else tmp = fma(Float64(1.0 / z), Float64(Float64(Float64(t / y) - y) * 0.3333333333333333), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+294], N[(x - N[(N[(N[(y / z), $MachinePrecision] - N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 2 \cdot 10^{+294}:\\
\;\;\;\;x - \frac{\frac{y}{z} - \frac{t}{z \cdot y}}{3}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z}, \left(\frac{t}{y} - y\right) \cdot 0.3333333333333333, x\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < 2.00000000000000013e294Initial program 95.7%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-+l-N/A
lower--.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6495.7
Applied rewrites95.7%
if 2.00000000000000013e294 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 95.7%
Applied rewrites95.7%
(FPCore (x y z t) :precision binary64 (fma (/ 0.3333333333333333 (* z y)) t (fma -0.3333333333333333 (/ y z) x)))
double code(double x, double y, double z, double t) {
return fma((0.3333333333333333 / (z * y)), t, fma(-0.3333333333333333, (y / z), x));
}
function code(x, y, z, t) return fma(Float64(0.3333333333333333 / Float64(z * y)), t, fma(-0.3333333333333333, Float64(y / z), x)) end
code[x_, y_, z_, t_] := N[(N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] * t + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{0.3333333333333333}{z \cdot y}, t, \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\right)
\end{array}
Initial program 95.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
mult-flipN/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-/r*N/A
*-commutativeN/A
mult-flip-revN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites95.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.22e+26)
(* (- (/ x y) (/ 0.3333333333333333 z)) y)
(if (<= y 8.5e-49)
(fma (/ t (* z y)) 0.3333333333333333 x)
(if (<= y 1.16e+80)
(* (/ (- (/ t y) y) z) 0.3333333333333333)
(fma (* y (/ 1.0 z)) -0.3333333333333333 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+26) {
tmp = ((x / y) - (0.3333333333333333 / z)) * y;
} else if (y <= 8.5e-49) {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
} else if (y <= 1.16e+80) {
tmp = (((t / y) - y) / z) * 0.3333333333333333;
} else {
tmp = fma((y * (1.0 / z)), -0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.22e+26) tmp = Float64(Float64(Float64(x / y) - Float64(0.3333333333333333 / z)) * y); elseif (y <= 8.5e-49) tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); elseif (y <= 1.16e+80) tmp = Float64(Float64(Float64(Float64(t / y) - y) / z) * 0.3333333333333333); else tmp = fma(Float64(y * Float64(1.0 / z)), -0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.22e+26], N[(N[(N[(x / y), $MachinePrecision] - N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 8.5e-49], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 1.16e+80], N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+26}:\\
\;\;\;\;\left(\frac{x}{y} - \frac{0.3333333333333333}{z}\right) \cdot y\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+80}:\\
\;\;\;\;\frac{\frac{t}{y} - y}{z} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{z}, -0.3333333333333333, x\right)\\
\end{array}
\end{array}
if y < -1.2200000000000001e26Initial program 95.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f6461.2
Applied rewrites61.2%
if -1.2200000000000001e26 < y < 8.50000000000000069e-49Initial program 95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-flipN/A
div-add-revN/A
associate-/r*N/A
mul-1-negN/A
associate-*r/N/A
mult-flipN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
if 8.50000000000000069e-49 < y < 1.15999999999999997e80Initial program 95.7%
Taylor expanded in x around 0
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6467.8
Applied rewrites67.8%
if 1.15999999999999997e80 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f6464.5
Applied rewrites64.5%
(FPCore (x y z t) :precision binary64 (fma (/ (- (/ t y) y) z) 0.3333333333333333 x))
double code(double x, double y, double z, double t) {
return fma((((t / y) - y) / z), 0.3333333333333333, x);
}
function code(x, y, z, t) return fma(Float64(Float64(Float64(t / y) - y) / z), 0.3333333333333333, x) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{\frac{t}{y} - y}{z}, 0.3333333333333333, x\right)
\end{array}
Initial program 95.7%
Applied rewrites95.7%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.22e+26)
(* (- (/ x y) (/ 0.3333333333333333 z)) y)
(if (<= y 2.05e+30)
(fma (/ t (* z y)) 0.3333333333333333 x)
(fma (/ y z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+26) {
tmp = ((x / y) - (0.3333333333333333 / z)) * y;
} else if (y <= 2.05e+30) {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
} else {
tmp = fma((y / z), -0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.22e+26) tmp = Float64(Float64(Float64(x / y) - Float64(0.3333333333333333 / z)) * y); elseif (y <= 2.05e+30) tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); else tmp = fma(Float64(y / z), -0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.22e+26], N[(N[(N[(x / y), $MachinePrecision] - N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 2.05e+30], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+26}:\\
\;\;\;\;\left(\frac{x}{y} - \frac{0.3333333333333333}{z}\right) \cdot y\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\end{array}
\end{array}
if y < -1.2200000000000001e26Initial program 95.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f6461.2
Applied rewrites61.2%
if -1.2200000000000001e26 < y < 2.05000000000000003e30Initial program 95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-flipN/A
div-add-revN/A
associate-/r*N/A
mul-1-negN/A
associate-*r/N/A
mult-flipN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
if 2.05000000000000003e30 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.22e+26)
(fma (/ 1.0 z) (* -0.3333333333333333 y) x)
(if (<= y 2.05e+30)
(fma (/ t (* z y)) 0.3333333333333333 x)
(fma (/ y z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+26) {
tmp = fma((1.0 / z), (-0.3333333333333333 * y), x);
} else if (y <= 2.05e+30) {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
} else {
tmp = fma((y / z), -0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.22e+26) tmp = fma(Float64(1.0 / z), Float64(-0.3333333333333333 * y), x); elseif (y <= 2.05e+30) tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); else tmp = fma(Float64(y / z), -0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.22e+26], N[(N[(1.0 / z), $MachinePrecision] * N[(-0.3333333333333333 * y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 2.05e+30], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z}, -0.3333333333333333 \cdot y, x\right)\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\end{array}
\end{array}
if y < -1.2200000000000001e26Initial program 95.7%
Applied rewrites95.7%
Taylor expanded in y around inf
lower-*.f6464.5
Applied rewrites64.5%
if -1.2200000000000001e26 < y < 2.05000000000000003e30Initial program 95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-flipN/A
div-add-revN/A
associate-/r*N/A
mul-1-negN/A
associate-*r/N/A
mult-flipN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
if 2.05000000000000003e30 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y z) -0.3333333333333333 x)))
(if (<= y -1.22e+26)
t_1
(if (<= y 2.05e+30) (fma (/ t (* z y)) 0.3333333333333333 x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / z), -0.3333333333333333, x);
double tmp;
if (y <= -1.22e+26) {
tmp = t_1;
} else if (y <= 2.05e+30) {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / z), -0.3333333333333333, x) tmp = 0.0 if (y <= -1.22e+26) tmp = t_1; elseif (y <= 2.05e+30) tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -1.22e+26], t$95$1, If[LessEqual[y, 2.05e+30], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -1.22 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.2200000000000001e26 or 2.05000000000000003e30 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
if -1.2200000000000001e26 < y < 2.05000000000000003e30Initial program 95.7%
Applied rewrites95.7%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-flipN/A
div-add-revN/A
associate-/r*N/A
mul-1-negN/A
associate-*r/N/A
mult-flipN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y z) -0.3333333333333333 x)))
(if (<= y -6.6e-102)
t_1
(if (<= y 2.2e-73) (* (/ (/ t z) y) 0.3333333333333333) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / z), -0.3333333333333333, x);
double tmp;
if (y <= -6.6e-102) {
tmp = t_1;
} else if (y <= 2.2e-73) {
tmp = ((t / z) / y) * 0.3333333333333333;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / z), -0.3333333333333333, x) tmp = 0.0 if (y <= -6.6e-102) tmp = t_1; elseif (y <= 2.2e-73) tmp = Float64(Float64(Float64(t / z) / y) * 0.3333333333333333); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -6.6e-102], t$95$1, If[LessEqual[y, 2.2e-73], N[(N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\frac{t}{z}}{y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.6e-102 or 2.2e-73 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
if -6.6e-102 < y < 2.2e-73Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6437.8
Applied rewrites37.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ y z) -0.3333333333333333 x))) (if (<= y -6.6e-102) t_1 (if (<= y 2.2e-73) (/ t (* (* 3.0 z) y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / z), -0.3333333333333333, x);
double tmp;
if (y <= -6.6e-102) {
tmp = t_1;
} else if (y <= 2.2e-73) {
tmp = t / ((3.0 * z) * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / z), -0.3333333333333333, x) tmp = 0.0 if (y <= -6.6e-102) tmp = t_1; elseif (y <= 2.2e-73) tmp = Float64(t / Float64(Float64(3.0 * z) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -6.6e-102], t$95$1, If[LessEqual[y, 2.2e-73], N[(t / N[(N[(3.0 * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{t}{\left(3 \cdot z\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.6e-102 or 2.2e-73 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
if -6.6e-102 < y < 2.2e-73Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
frac-timesN/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
metadata-evalN/A
times-fracN/A
mult-flip-revN/A
*-commutativeN/A
metadata-evalN/A
times-fracN/A
metadata-evalN/A
times-fracN/A
metadata-evalN/A
mult-flipN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6434.7
Applied rewrites34.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y z) -0.3333333333333333 x)))
(if (<= y -6.6e-102)
t_1
(if (<= y 2.2e-73) (* (/ t (* z y)) 0.3333333333333333) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / z), -0.3333333333333333, x);
double tmp;
if (y <= -6.6e-102) {
tmp = t_1;
} else if (y <= 2.2e-73) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / z), -0.3333333333333333, x) tmp = 0.0 if (y <= -6.6e-102) tmp = t_1; elseif (y <= 2.2e-73) tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -6.6e-102], t$95$1, If[LessEqual[y, 2.2e-73], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.6e-102 or 2.2e-73 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
if -6.6e-102 < y < 2.2e-73Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y z) -0.3333333333333333 x)))
(if (<= y -6.6e-102)
t_1
(if (<= y 2.2e-73) (* (/ 0.3333333333333333 (* y z)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / z), -0.3333333333333333, x);
double tmp;
if (y <= -6.6e-102) {
tmp = t_1;
} else if (y <= 2.2e-73) {
tmp = (0.3333333333333333 / (y * z)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / z), -0.3333333333333333, x) tmp = 0.0 if (y <= -6.6e-102) tmp = t_1; elseif (y <= 2.2e-73) tmp = Float64(Float64(0.3333333333333333 / Float64(y * z)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]}, If[LessEqual[y, -6.6e-102], t$95$1, If[LessEqual[y, 2.2e-73], N[(N[(0.3333333333333333 / N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{0.3333333333333333}{y \cdot z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.6e-102 or 2.2e-73 < y Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
if -6.6e-102 < y < 2.2e-73Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
frac-timesN/A
*-commutativeN/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower-*.f6434.5
Applied rewrites34.5%
(FPCore (x y z t) :precision binary64 (fma (/ y z) -0.3333333333333333 x))
double code(double x, double y, double z, double t) {
return fma((y / z), -0.3333333333333333, x);
}
function code(x, y, z, t) return fma(Float64(y / z), -0.3333333333333333, x) end
code[x_, y_, z_, t_] := N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
(FPCore (x y z t) :precision binary64 (/ (* -0.3333333333333333 y) z))
double code(double x, double y, double z, double t) {
return (-0.3333333333333333 * y) / z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((-0.3333333333333333d0) * y) / z
end function
public static double code(double x, double y, double z, double t) {
return (-0.3333333333333333 * y) / z;
}
def code(x, y, z, t): return (-0.3333333333333333 * y) / z
function code(x, y, z, t) return Float64(Float64(-0.3333333333333333 * y) / z) end
function tmp = code(x, y, z, t) tmp = (-0.3333333333333333 * y) / z; end
code[x_, y_, z_, t_] := N[(N[(-0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.3333333333333333 \cdot y}{z}
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f6436.4
Applied rewrites36.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6436.4
Applied rewrites36.4%
(FPCore (x y z t) :precision binary64 (* (/ y z) -0.3333333333333333))
double code(double x, double y, double z, double t) {
return (y / z) * -0.3333333333333333;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y / z) * (-0.3333333333333333d0)
end function
public static double code(double x, double y, double z, double t) {
return (y / z) * -0.3333333333333333;
}
def code(x, y, z, t): return (y / z) * -0.3333333333333333
function code(x, y, z, t) return Float64(Float64(y / z) * -0.3333333333333333) end
function tmp = code(x, y, z, t) tmp = (y / z) * -0.3333333333333333; end
code[x_, y_, z_, t_] := N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z} \cdot -0.3333333333333333
\end{array}
Initial program 95.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6434.6
Applied rewrites34.6%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f6436.4
Applied rewrites36.4%
herbie shell --seed 2025134
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))