
(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 15 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
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= (+ t_1 (/ t (* (* z 3.0) y))) 2e+249)
(+ t_1 (/ (/ t (* 3.0 z)) y))
(fma (/ (- (/ t y) y) z) 0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if ((t_1 + (t / ((z * 3.0) * y))) <= 2e+249) {
tmp = t_1 + ((t / (3.0 * z)) / y);
} else {
tmp = fma((((t / y) - y) / z), 0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(z * 3.0))) tmp = 0.0 if (Float64(t_1 + Float64(t / Float64(Float64(z * 3.0) * y))) <= 2e+249) tmp = Float64(t_1 + Float64(Float64(t / Float64(3.0 * z)) / y)); else tmp = fma(Float64(Float64(Float64(t / y) - y) / z), 0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+249], N[(t$95$1 + N[(N[(t / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t\_1 + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 2 \cdot 10^{+249}:\\
\;\;\;\;t\_1 + \frac{\frac{t}{3 \cdot z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{t}{y} - y}{z}, 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))) < 1.9999999999999998e249Initial program 95.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6496.0
Applied rewrites96.0%
if 1.9999999999999998e249 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= (+ t_1 (/ t (* (* z 3.0) y))) 5e+302)
(+ t_1 (/ t (* (* 3.0 y) z)))
(/ (fma z x (* (- (/ t y) y) 0.3333333333333333)) z))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if ((t_1 + (t / ((z * 3.0) * y))) <= 5e+302) {
tmp = t_1 + (t / ((3.0 * y) * z));
} else {
tmp = fma(z, x, (((t / y) - y) * 0.3333333333333333)) / z;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(z * 3.0))) tmp = 0.0 if (Float64(t_1 + Float64(t / Float64(Float64(z * 3.0) * y))) <= 5e+302) tmp = Float64(t_1 + Float64(t / Float64(Float64(3.0 * y) * z))); else tmp = Float64(fma(z, x, Float64(Float64(Float64(t / y) - y) * 0.3333333333333333)) / z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+302], N[(t$95$1 + N[(t / N[(N[(3.0 * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t\_1 + \frac{t}{\left(z \cdot 3\right) \cdot y} \leq 5 \cdot 10^{+302}:\\
\;\;\;\;t\_1 + \frac{t}{\left(3 \cdot y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, x, \left(\frac{t}{y} - y\right) \cdot 0.3333333333333333\right)}{z}\\
\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))) < 5e302Initial program 95.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6495.9
Applied rewrites95.9%
if 5e302 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 95.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))) 5e+302) (- x (- (/ y (* 3.0 z)) (/ t (* (* 3.0 z) y)))) (/ (fma z x (* (- (/ t y) y) 0.3333333333333333)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))) <= 5e+302) {
tmp = x - ((y / (3.0 * z)) - (t / ((3.0 * z) * y)));
} else {
tmp = fma(z, x, (((t / y) - y) * 0.3333333333333333)) / z;
}
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))) <= 5e+302) tmp = Float64(x - Float64(Float64(y / Float64(3.0 * z)) - Float64(t / Float64(Float64(3.0 * z) * y)))); else tmp = Float64(fma(z, x, Float64(Float64(Float64(t / y) - y) * 0.3333333333333333)) / z); 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], 5e+302], N[(x - N[(N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] - N[(t / N[(N[(3.0 * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / z), $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 5 \cdot 10^{+302}:\\
\;\;\;\;x - \left(\frac{y}{3 \cdot z} - \frac{t}{\left(3 \cdot z\right) \cdot y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, x, \left(\frac{t}{y} - y\right) \cdot 0.3333333333333333\right)}{z}\\
\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))) < 5e302Initial program 95.9%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6495.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
if 5e302 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 95.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
(FPCore (x y z t) :precision binary64 (- x (* -0.3333333333333333 (/ (- (/ t y) y) z))))
double code(double x, double y, double z, double t) {
return x - (-0.3333333333333333 * (((t / y) - 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 = x - ((-0.3333333333333333d0) * (((t / y) - y) / z))
end function
public static double code(double x, double y, double z, double t) {
return x - (-0.3333333333333333 * (((t / y) - y) / z));
}
def code(x, y, z, t): return x - (-0.3333333333333333 * (((t / y) - y) / z))
function code(x, y, z, t) return Float64(x - Float64(-0.3333333333333333 * Float64(Float64(Float64(t / y) - y) / z))) end
function tmp = code(x, y, z, t) tmp = x - (-0.3333333333333333 * (((t / y) - y) / z)); end
code[x_, y_, z_, t_] := N[(x - N[(-0.3333333333333333 * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - -0.3333333333333333 \cdot \frac{\frac{t}{y} - y}{z}
\end{array}
Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
(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.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -0.00045)
(fma (/ y z) -0.3333333333333333 x)
(if (<= y 1.48e-12)
(fma (/ (/ t y) z) 0.3333333333333333 x)
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.00045) {
tmp = fma((y / z), -0.3333333333333333, x);
} else if (y <= 1.48e-12) {
tmp = fma(((t / y) / z), 0.3333333333333333, x);
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -0.00045) tmp = fma(Float64(y / z), -0.3333333333333333, x); elseif (y <= 1.48e-12) tmp = fma(Float64(Float64(t / y) / z), 0.3333333333333333, x); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.00045], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 1.48e-12], N[(N[(N[(t / y), $MachinePrecision] / z), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00045:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 1.48 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{t}{y}}{z}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -4.4999999999999999e-4Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -4.4999999999999999e-4 < y < 1.47999999999999995e-12Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around 0
lift-/.f6462.9
Applied rewrites62.9%
if 1.47999999999999995e-12 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -0.00045)
(fma (/ y z) -0.3333333333333333 x)
(if (<= y 1.48e-12)
(fma (/ t (* z y)) 0.3333333333333333 x)
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.00045) {
tmp = fma((y / z), -0.3333333333333333, x);
} else if (y <= 1.48e-12) {
tmp = fma((t / (z * y)), 0.3333333333333333, x);
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -0.00045) tmp = fma(Float64(y / z), -0.3333333333333333, x); elseif (y <= 1.48e-12) tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, x); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.00045], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 1.48e-12], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00045:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 1.48 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -4.4999999999999999e-4Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -4.4999999999999999e-4 < y < 1.47999999999999995e-12Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lift-*.f6463.8
Applied rewrites63.8%
if 1.47999999999999995e-12 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.95e-98)
(fma (/ y z) -0.3333333333333333 x)
(if (<= y 1.62e-114)
(/ (* t (/ 0.3333333333333333 z)) y)
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.95e-98) {
tmp = fma((y / z), -0.3333333333333333, x);
} else if (y <= 1.62e-114) {
tmp = (t * (0.3333333333333333 / z)) / y;
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.95e-98) tmp = fma(Float64(y / z), -0.3333333333333333, x); elseif (y <= 1.62e-114) tmp = Float64(Float64(t * Float64(0.3333333333333333 / z)) / y); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.95e-98], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 1.62e-114], N[(N[(t * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{-98}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 1.62 \cdot 10^{-114}:\\
\;\;\;\;\frac{t \cdot \frac{0.3333333333333333}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -2.94999999999999996e-98Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -2.94999999999999996e-98 < y < 1.62e-114Initial program 95.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6435.3
Applied rewrites35.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6434.5
Applied rewrites34.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6438.3
Applied rewrites38.3%
if 1.62e-114 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.95e-98)
(fma (/ y z) -0.3333333333333333 x)
(if (<= y 1.62e-114)
(* (/ t z) (/ 0.3333333333333333 y))
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.95e-98) {
tmp = fma((y / z), -0.3333333333333333, x);
} else if (y <= 1.62e-114) {
tmp = (t / z) * (0.3333333333333333 / y);
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.95e-98) tmp = fma(Float64(y / z), -0.3333333333333333, x); elseif (y <= 1.62e-114) tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y)); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.95e-98], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 1.62e-114], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{-98}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 1.62 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -2.94999999999999996e-98Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -2.94999999999999996e-98 < y < 1.62e-114Initial program 95.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6435.3
Applied rewrites35.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f6438.3
Applied rewrites38.3%
if 1.62e-114 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.95e-98)
(fma (/ y z) -0.3333333333333333 x)
(if (<= y 4.5e-114)
(* (/ t (* z y)) 0.3333333333333333)
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.95e-98) {
tmp = fma((y / z), -0.3333333333333333, x);
} else if (y <= 4.5e-114) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.95e-98) tmp = fma(Float64(y / z), -0.3333333333333333, x); elseif (y <= 4.5e-114) tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.95e-98], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], If[LessEqual[y, 4.5e-114], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{-98}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -2.94999999999999996e-98Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -2.94999999999999996e-98 < y < 4.49999999999999969e-114Initial program 95.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6435.3
Applied rewrites35.3%
if 4.49999999999999969e-114 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t) :precision binary64 (- x (* (/ y z) 0.3333333333333333)))
double code(double x, double y, double z, double t) {
return x - ((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 = x - ((y / z) * 0.3333333333333333d0)
end function
public static double code(double x, double y, double z, double t) {
return x - ((y / z) * 0.3333333333333333);
}
def code(x, y, z, t): return x - ((y / z) * 0.3333333333333333)
function code(x, y, z, t) return Float64(x - Float64(Float64(y / z) * 0.3333333333333333)) end
function tmp = code(x, y, z, t) tmp = x - ((y / z) * 0.3333333333333333); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{z} \cdot 0.3333333333333333
\end{array}
Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(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.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* -0.3333333333333333 y) z))) (if (<= y -8.5e+74) t_1 (if (<= y 4.4e+28) (* 1.0 x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.3333333333333333 * y) / z;
double tmp;
if (y <= -8.5e+74) {
tmp = t_1;
} else if (y <= 4.4e+28) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = ((-0.3333333333333333d0) * y) / z
if (y <= (-8.5d+74)) then
tmp = t_1
else if (y <= 4.4d+28) then
tmp = 1.0d0 * x
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 = (-0.3333333333333333 * y) / z;
double tmp;
if (y <= -8.5e+74) {
tmp = t_1;
} else if (y <= 4.4e+28) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.3333333333333333 * y) / z tmp = 0 if y <= -8.5e+74: tmp = t_1 elif y <= 4.4e+28: tmp = 1.0 * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-0.3333333333333333 * y) / z) tmp = 0.0 if (y <= -8.5e+74) tmp = t_1; elseif (y <= 4.4e+28) tmp = Float64(1.0 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-0.3333333333333333 * y) / z; tmp = 0.0; if (y <= -8.5e+74) tmp = t_1; elseif (y <= 4.4e+28) tmp = 1.0 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(-0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -8.5e+74], t$95$1, If[LessEqual[y, 4.4e+28], N[(1.0 * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.3333333333333333 \cdot y}{z}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+28}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.50000000000000028e74 or 4.39999999999999973e28 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f6435.1
Applied rewrites35.1%
if -8.50000000000000028e74 < y < 4.39999999999999973e28Initial program 95.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.7%
Taylor expanded in x around inf
Applied rewrites31.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ y z) -0.3333333333333333))) (if (<= y -8.5e+74) t_1 (if (<= y 4.4e+28) (* 1.0 x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) * -0.3333333333333333;
double tmp;
if (y <= -8.5e+74) {
tmp = t_1;
} else if (y <= 4.4e+28) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = (y / z) * (-0.3333333333333333d0)
if (y <= (-8.5d+74)) then
tmp = t_1
else if (y <= 4.4d+28) then
tmp = 1.0d0 * x
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 = (y / z) * -0.3333333333333333;
double tmp;
if (y <= -8.5e+74) {
tmp = t_1;
} else if (y <= 4.4e+28) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) * -0.3333333333333333 tmp = 0 if y <= -8.5e+74: tmp = t_1 elif y <= 4.4e+28: tmp = 1.0 * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) * -0.3333333333333333) tmp = 0.0 if (y <= -8.5e+74) tmp = t_1; elseif (y <= 4.4e+28) tmp = Float64(1.0 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) * -0.3333333333333333; tmp = 0.0; if (y <= -8.5e+74) tmp = t_1; elseif (y <= 4.4e+28) tmp = 1.0 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]}, If[LessEqual[y, -8.5e+74], t$95$1, If[LessEqual[y, 4.4e+28], N[(1.0 * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} \cdot -0.3333333333333333\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+28}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.50000000000000028e74 or 4.39999999999999973e28 < y Initial program 95.9%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.0
Applied rewrites35.0%
if -8.50000000000000028e74 < y < 4.39999999999999973e28Initial program 95.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.7%
Taylor expanded in x around inf
Applied rewrites31.1%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * x;
}
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 = 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 95.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.7%
Taylor expanded in x around inf
Applied rewrites31.1%
herbie shell --seed 2025130
(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))))