
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x 1.0) (* z (sin y))))) (if (<= z -0.81) t_0 (if (<= z 5e-17) (* x (+ 1.0 (/ (cos y) x))) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * sin(y));
double tmp;
if (z <= -0.81) {
tmp = t_0;
} else if (z <= 5e-17) {
tmp = x * (1.0 + (cos(y) / x));
} else {
tmp = t_0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) - (z * sin(y))
if (z <= (-0.81d0)) then
tmp = t_0
else if (z <= 5d-17) then
tmp = x * (1.0d0 + (cos(y) / x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * Math.sin(y));
double tmp;
if (z <= -0.81) {
tmp = t_0;
} else if (z <= 5e-17) {
tmp = x * (1.0 + (Math.cos(y) / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + 1.0) - (z * math.sin(y)) tmp = 0 if z <= -0.81: tmp = t_0 elif z <= 5e-17: tmp = x * (1.0 + (math.cos(y) / x)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 1.0) - Float64(z * sin(y))) tmp = 0.0 if (z <= -0.81) tmp = t_0; elseif (z <= 5e-17) tmp = Float64(x * Float64(1.0 + Float64(cos(y) / x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 1.0) - (z * sin(y)); tmp = 0.0; if (z <= -0.81) tmp = t_0; elseif (z <= 5e-17) tmp = x * (1.0 + (cos(y) / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.81], t$95$0, If[LessEqual[z, 5e-17], N[(x * N[(1.0 + N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + 1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -0.81:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \left(1 + \frac{\cos y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.81000000000000005 or 4.9999999999999999e-17 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -0.81000000000000005 < z < 4.9999999999999999e-17Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites91.7%
Taylor expanded in y around 0
Applied rewrites62.3%
Taylor expanded in z around 0
Applied rewrites73.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y)))
(t_1 (- (+ x (cos y)) t_0))
(t_2 (- (+ x 1.0) t_0)))
(if (<= t_1 -100.0) t_2 (if (<= t_1 0.98) (- (cos y) (* 1.0 z)) t_2))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -100.0) {
tmp = t_2;
} else if (t_1 <= 0.98) {
tmp = cos(y) - (1.0 * z);
} else {
tmp = t_2;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
t_2 = (x + 1.0d0) - t_0
if (t_1 <= (-100.0d0)) then
tmp = t_2
else if (t_1 <= 0.98d0) then
tmp = cos(y) - (1.0d0 * z)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + Math.cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -100.0) {
tmp = t_2;
} else if (t_1 <= 0.98) {
tmp = Math.cos(y) - (1.0 * z);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + math.cos(y)) - t_0 t_2 = (x + 1.0) - t_0 tmp = 0 if t_1 <= -100.0: tmp = t_2 elif t_1 <= 0.98: tmp = math.cos(y) - (1.0 * z) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + cos(y)) - t_0) t_2 = Float64(Float64(x + 1.0) - t_0) tmp = 0.0 if (t_1 <= -100.0) tmp = t_2; elseif (t_1 <= 0.98) tmp = Float64(cos(y) - Float64(1.0 * z)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + cos(y)) - t_0; t_2 = (x + 1.0) - t_0; tmp = 0.0; if (t_1 <= -100.0) tmp = t_2; elseif (t_1 <= 0.98) tmp = cos(y) - (1.0 * z); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -100.0], t$95$2, If[LessEqual[t$95$1, 0.98], N[(N[Cos[y], $MachinePrecision] - N[(1.0 * z), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + \cos y\right) - t\_0\\
t_2 := \left(x + 1\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -100:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.98:\\
\;\;\;\;\cos y - 1 \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100 or 0.97999999999999998 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.97999999999999998Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites69.7%
Taylor expanded in x around 0
Applied rewrites35.2%
Applied rewrites27.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y)))
(t_1 (- (+ x (cos y)) t_0))
(t_2 (- (+ x 0.0) t_0)))
(if (<= t_1 -100.0)
t_2
(if (<= t_1 0.98)
(- (cos y) (* 1.0 z))
(if (<= t_1 5.0) (+ 1.0 x) t_2)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + cos(y)) - t_0;
double t_2 = (x + 0.0) - t_0;
double tmp;
if (t_1 <= -100.0) {
tmp = t_2;
} else if (t_1 <= 0.98) {
tmp = cos(y) - (1.0 * z);
} else if (t_1 <= 5.0) {
tmp = 1.0 + x;
} else {
tmp = t_2;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
t_2 = (x + 0.0d0) - t_0
if (t_1 <= (-100.0d0)) then
tmp = t_2
else if (t_1 <= 0.98d0) then
tmp = cos(y) - (1.0d0 * z)
else if (t_1 <= 5.0d0) then
tmp = 1.0d0 + x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + Math.cos(y)) - t_0;
double t_2 = (x + 0.0) - t_0;
double tmp;
if (t_1 <= -100.0) {
tmp = t_2;
} else if (t_1 <= 0.98) {
tmp = Math.cos(y) - (1.0 * z);
} else if (t_1 <= 5.0) {
tmp = 1.0 + x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + math.cos(y)) - t_0 t_2 = (x + 0.0) - t_0 tmp = 0 if t_1 <= -100.0: tmp = t_2 elif t_1 <= 0.98: tmp = math.cos(y) - (1.0 * z) elif t_1 <= 5.0: tmp = 1.0 + x else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + cos(y)) - t_0) t_2 = Float64(Float64(x + 0.0) - t_0) tmp = 0.0 if (t_1 <= -100.0) tmp = t_2; elseif (t_1 <= 0.98) tmp = Float64(cos(y) - Float64(1.0 * z)); elseif (t_1 <= 5.0) tmp = Float64(1.0 + x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + cos(y)) - t_0; t_2 = (x + 0.0) - t_0; tmp = 0.0; if (t_1 <= -100.0) tmp = t_2; elseif (t_1 <= 0.98) tmp = cos(y) - (1.0 * z); elseif (t_1 <= 5.0) tmp = 1.0 + x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + 0.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -100.0], t$95$2, If[LessEqual[t$95$1, 0.98], N[(N[Cos[y], $MachinePrecision] - N[(1.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5.0], N[(1.0 + x), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + \cos y\right) - t\_0\\
t_2 := \left(x + 0\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -100:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.98:\\
\;\;\;\;\cos y - 1 \cdot z\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100 or 5 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
Applied rewrites68.3%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.97999999999999998Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites69.7%
Taylor expanded in x around 0
Applied rewrites35.2%
Applied rewrites27.8%
if 0.97999999999999998 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 5Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x (cos y)) (* z (sin y)))) (t_1 (- (+ x 1.0) (* z y))))
(if (<= t_0 -100.0)
t_1
(if (<= t_0 0.98)
(- (cos y) (* 1.0 z))
(if (<= t_0 5e+149) t_1 (+ 1.0 x))))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double t_1 = (x + 1.0) - (z * y);
double tmp;
if (t_0 <= -100.0) {
tmp = t_1;
} else if (t_0 <= 0.98) {
tmp = cos(y) - (1.0 * z);
} else if (t_0 <= 5e+149) {
tmp = t_1;
} else {
tmp = 1.0 + x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x + cos(y)) - (z * sin(y))
t_1 = (x + 1.0d0) - (z * y)
if (t_0 <= (-100.0d0)) then
tmp = t_1
else if (t_0 <= 0.98d0) then
tmp = cos(y) - (1.0d0 * z)
else if (t_0 <= 5d+149) then
tmp = t_1
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.cos(y)) - (z * Math.sin(y));
double t_1 = (x + 1.0) - (z * y);
double tmp;
if (t_0 <= -100.0) {
tmp = t_1;
} else if (t_0 <= 0.98) {
tmp = Math.cos(y) - (1.0 * z);
} else if (t_0 <= 5e+149) {
tmp = t_1;
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.cos(y)) - (z * math.sin(y)) t_1 = (x + 1.0) - (z * y) tmp = 0 if t_0 <= -100.0: tmp = t_1 elif t_0 <= 0.98: tmp = math.cos(y) - (1.0 * z) elif t_0 <= 5e+149: tmp = t_1 else: tmp = 1.0 + x return tmp
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y))) t_1 = Float64(Float64(x + 1.0) - Float64(z * y)) tmp = 0.0 if (t_0 <= -100.0) tmp = t_1; elseif (t_0 <= 0.98) tmp = Float64(cos(y) - Float64(1.0 * z)); elseif (t_0 <= 5e+149) tmp = t_1; else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + cos(y)) - (z * sin(y)); t_1 = (x + 1.0) - (z * y); tmp = 0.0; if (t_0 <= -100.0) tmp = t_1; elseif (t_0 <= 0.98) tmp = cos(y) - (1.0 * z); elseif (t_0 <= 5e+149) tmp = t_1; else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -100.0], t$95$1, If[LessEqual[t$95$0, 0.98], N[(N[Cos[y], $MachinePrecision] - N[(1.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+149], t$95$1, N[(1.0 + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
t_1 := \left(x + 1\right) - z \cdot y\\
\mathbf{if}\;t\_0 \leq -100:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.98:\\
\;\;\;\;\cos y - 1 \cdot z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+149}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100 or 0.97999999999999998 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 4.9999999999999999e149Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
Taylor expanded in y around 0
Applied rewrites64.2%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.97999999999999998Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites69.7%
Taylor expanded in x around 0
Applied rewrites35.2%
Applied rewrites27.8%
if 4.9999999999999999e149 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
(FPCore (x y z) :precision binary64 (if (<= x -0.00112) (+ 1.0 x) (if (<= x 7.6e-13) (- (cos y) (* y z)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00112) {
tmp = 1.0 + x;
} else if (x <= 7.6e-13) {
tmp = cos(y) - (y * z);
} else {
tmp = 1.0 + x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-0.00112d0)) then
tmp = 1.0d0 + x
else if (x <= 7.6d-13) then
tmp = cos(y) - (y * z)
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.00112) {
tmp = 1.0 + x;
} else if (x <= 7.6e-13) {
tmp = Math.cos(y) - (y * z);
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00112: tmp = 1.0 + x elif x <= 7.6e-13: tmp = math.cos(y) - (y * z) else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00112) tmp = Float64(1.0 + x); elseif (x <= 7.6e-13) tmp = Float64(cos(y) - Float64(y * z)); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00112) tmp = 1.0 + x; elseif (x <= 7.6e-13) tmp = cos(y) - (y * z); else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00112], N[(1.0 + x), $MachinePrecision], If[LessEqual[x, 7.6e-13], N[(N[Cos[y], $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00112:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-13}:\\
\;\;\;\;\cos y - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if x < -0.0011199999999999999 or 7.5999999999999999e-13 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
if -0.0011199999999999999 < x < 7.5999999999999999e-13Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites69.7%
Taylor expanded in x around 0
Applied rewrites35.2%
(FPCore (x y z)
:precision binary64
(if (<= y -7.4e+19)
(* (- z) (sin y))
(if (<= y 3.6)
(+ 1.0 (+ x (* y (- (* -0.5 y) z))))
(+ 1.0 (fma (/ (fma 1.0 -0.5 z) x) x x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.4e+19) {
tmp = -z * sin(y);
} else if (y <= 3.6) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = 1.0 + fma((fma(1.0, -0.5, z) / x), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -7.4e+19) tmp = Float64(Float64(-z) * sin(y)); elseif (y <= 3.6) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(-0.5 * y) - z)))); else tmp = Float64(1.0 + fma(Float64(fma(1.0, -0.5, z) / x), x, x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -7.4e+19], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6], N[(1.0 + N[(x + N[(y * N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(1.0 * -0.5 + z), $MachinePrecision] / x), $MachinePrecision] * x + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+19}:\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\mathbf{elif}\;y \leq 3.6:\\
\;\;\;\;1 + \left(x + y \cdot \left(-0.5 \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(\frac{\mathsf{fma}\left(1, -0.5, z\right)}{x}, x, x\right)\\
\end{array}
\end{array}
if y < -7.4e19Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites28.0%
Applied rewrites28.0%
if -7.4e19 < y < 3.60000000000000009Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
if 3.60000000000000009 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
Taylor expanded in x around inf
Applied rewrites53.7%
Applied rewrites42.4%
(FPCore (x y z)
:precision binary64
(if (<= y -1.65e+19)
(+ 1.0 (* x (+ 1.0 (/ (* 1.0 (- (* -0.5 1.0) z)) x))))
(if (<= y 3.6)
(+ 1.0 (+ x (* y (- (* -0.5 y) z))))
(+ 1.0 (fma (/ (fma 1.0 -0.5 z) x) x x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+19) {
tmp = 1.0 + (x * (1.0 + ((1.0 * ((-0.5 * 1.0) - z)) / x)));
} else if (y <= 3.6) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = 1.0 + fma((fma(1.0, -0.5, z) / x), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.65e+19) tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(Float64(1.0 * Float64(Float64(-0.5 * 1.0) - z)) / x)))); elseif (y <= 3.6) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(-0.5 * y) - z)))); else tmp = Float64(1.0 + fma(Float64(fma(1.0, -0.5, z) / x), x, x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.65e+19], N[(1.0 + N[(x * N[(1.0 + N[(N[(1.0 * N[(N[(-0.5 * 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6], N[(1.0 + N[(x + N[(y * N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(1.0 * -0.5 + z), $MachinePrecision] / x), $MachinePrecision] * x + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+19}:\\
\;\;\;\;1 + x \cdot \left(1 + \frac{1 \cdot \left(-0.5 \cdot 1 - z\right)}{x}\right)\\
\mathbf{elif}\;y \leq 3.6:\\
\;\;\;\;1 + \left(x + y \cdot \left(-0.5 \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(\frac{\mathsf{fma}\left(1, -0.5, z\right)}{x}, x, x\right)\\
\end{array}
\end{array}
if y < -1.65e19Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
Taylor expanded in x around inf
Applied rewrites53.7%
Applied rewrites42.3%
if -1.65e19 < y < 3.60000000000000009Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
if 3.60000000000000009 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
Taylor expanded in x around inf
Applied rewrites53.7%
Applied rewrites42.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (fma (/ (fma 1.0 -0.5 z) x) x x))))
(if (<= y -9.2e+14)
t_0
(if (<= y 3.6) (+ 1.0 (+ x (* y (- (* -0.5 y) z)))) t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 + fma((fma(1.0, -0.5, z) / x), x, x);
double tmp;
if (y <= -9.2e+14) {
tmp = t_0;
} else if (y <= 3.6) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(1.0 + fma(Float64(fma(1.0, -0.5, z) / x), x, x)) tmp = 0.0 if (y <= -9.2e+14) tmp = t_0; elseif (y <= 3.6) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(-0.5 * y) - z)))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(N[(1.0 * -0.5 + z), $MachinePrecision] / x), $MachinePrecision] * x + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+14], t$95$0, If[LessEqual[y, 3.6], N[(1.0 + N[(x + N[(y * N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \mathsf{fma}\left(\frac{\mathsf{fma}\left(1, -0.5, z\right)}{x}, x, x\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.6:\\
\;\;\;\;1 + \left(x + y \cdot \left(-0.5 \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -9.2e14 or 3.60000000000000009 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
Taylor expanded in x around inf
Applied rewrites53.7%
Applied rewrites42.4%
if -9.2e14 < y < 3.60000000000000009Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.65e+19) (+ 1.0 x) (if (<= y 1.15e-16) (+ 1.0 (+ x (* y (- (* -0.5 y) z)))) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+19) {
tmp = 1.0 + x;
} else if (y <= 1.15e-16) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = 1.0 + x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.65d+19)) then
tmp = 1.0d0 + x
else if (y <= 1.15d-16) then
tmp = 1.0d0 + (x + (y * (((-0.5d0) * y) - z)))
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+19) {
tmp = 1.0 + x;
} else if (y <= 1.15e-16) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.65e+19: tmp = 1.0 + x elif y <= 1.15e-16: tmp = 1.0 + (x + (y * ((-0.5 * y) - z))) else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.65e+19) tmp = Float64(1.0 + x); elseif (y <= 1.15e-16) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(-0.5 * y) - z)))); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.65e+19) tmp = 1.0 + x; elseif (y <= 1.15e-16) tmp = 1.0 + (x + (y * ((-0.5 * y) - z))); else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.65e+19], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1.15e-16], N[(1.0 + N[(x + N[(y * N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+19}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-16}:\\
\;\;\;\;1 + \left(x + y \cdot \left(-0.5 \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -1.65e19 or 1.15e-16 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
if -1.65e19 < y < 1.15e-16Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.95e+19) (+ 1.0 x) (if (<= y 8.5e+58) (- (+ x 1.0) (* z y)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+19) {
tmp = 1.0 + x;
} else if (y <= 8.5e+58) {
tmp = (x + 1.0) - (z * y);
} else {
tmp = 1.0 + x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.95d+19)) then
tmp = 1.0d0 + x
else if (y <= 8.5d+58) then
tmp = (x + 1.0d0) - (z * y)
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.95e+19) {
tmp = 1.0 + x;
} else if (y <= 8.5e+58) {
tmp = (x + 1.0) - (z * y);
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.95e+19: tmp = 1.0 + x elif y <= 8.5e+58: tmp = (x + 1.0) - (z * y) else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.95e+19) tmp = Float64(1.0 + x); elseif (y <= 8.5e+58) tmp = Float64(Float64(x + 1.0) - Float64(z * y)); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.95e+19) tmp = 1.0 + x; elseif (y <= 8.5e+58) tmp = (x + 1.0) - (z * y); else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.95e+19], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 8.5e+58], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+19}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+58}:\\
\;\;\;\;\left(x + 1\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -1.95e19 or 8.50000000000000015e58 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
if -1.95e19 < y < 8.50000000000000015e58Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
Taylor expanded in y around 0
Applied rewrites64.2%
(FPCore (x y z) :precision binary64 (+ 1.0 x))
double code(double x, double y, double z) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + x
end function
public static double code(double x, double y, double z) {
return 1.0 + x;
}
def code(x, y, z): return 1.0 + x
function code(x, y, z) return Float64(1.0 + x) end
function tmp = code(x, y, z) tmp = 1.0 + x; end
code[x_, y_, z_] := N[(1.0 + x), $MachinePrecision]
\begin{array}{l}
\\
1 + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
(FPCore (x y z) :precision binary64 (if (<= (- (+ x (cos y)) (* z (sin y))) -0.04) -0.5 1.0))
double code(double x, double y, double z) {
double tmp;
if (((x + cos(y)) - (z * sin(y))) <= -0.04) {
tmp = -0.5;
} else {
tmp = 1.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((x + cos(y)) - (z * sin(y))) <= (-0.04d0)) then
tmp = -0.5d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x + Math.cos(y)) - (z * Math.sin(y))) <= -0.04) {
tmp = -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x + math.cos(y)) - (z * math.sin(y))) <= -0.04: tmp = -0.5 else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (Float64(Float64(x + cos(y)) - Float64(z * sin(y))) <= -0.04) tmp = -0.5; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x + cos(y)) - (z * sin(y))) <= -0.04) tmp = -0.5; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.04], -0.5, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x + \cos y\right) - z \cdot \sin y \leq -0.04:\\
\;\;\;\;-0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -0.0400000000000000008Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites55.8%
Taylor expanded in y around inf
Applied rewrites6.4%
Applied rewrites4.6%
Taylor expanded in z around 0
Applied rewrites3.8%
if -0.0400000000000000008 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
Taylor expanded in x around 0
Applied rewrites22.1%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
Taylor expanded in x around 0
Applied rewrites22.1%
(FPCore (x y z) :precision binary64 0.0)
double code(double x, double y, double z) {
return 0.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.0d0
end function
public static double code(double x, double y, double z) {
return 0.0;
}
def code(x, y, z): return 0.0
function code(x, y, z) return 0.0 end
function tmp = code(x, y, z) tmp = 0.0; end
code[x_, y_, z_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites62.3%
Taylor expanded in x around 0
Applied rewrites22.1%
Applied rewrites2.5%
herbie shell --seed 2025159
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))