
(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 14 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 (* (sin y) z)))) (if (<= x -1.0) t_0 (if (<= x 5.5e-5) (- (cos y) (* z (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = x - (sin(y) * z);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.5e-5) {
tmp = cos(y) - (z * sin(y));
} 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 - (sin(y) * z)
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 5.5d-5) then
tmp = cos(y) - (z * sin(y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (Math.sin(y) * z);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 5.5e-5) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (math.sin(y) * z) tmp = 0 if x <= -1.0: tmp = t_0 elif x <= 5.5e-5: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(sin(y) * z)) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 5.5e-5) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (sin(y) * z); tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= 5.5e-5) tmp = cos(y) - (z * sin(y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 5.5e-5], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \sin y \cdot z\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 5.5000000000000002e-5 < x Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites98.1%
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6498.1
Applied rewrites98.1%
if -1 < x < 5.5000000000000002e-5Initial program 99.9%
Taylor expanded in x around 0
lift-cos.f6498.7
Applied rewrites98.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (cos y)) (* z (sin y)))) (t_1 (- x (* (sin y) z)))) (if (<= t_0 -5e+37) t_1 (if (<= t_0 2e+15) (+ (cos y) x) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double t_1 = x - (sin(y) * z);
double tmp;
if (t_0 <= -5e+37) {
tmp = t_1;
} else if (t_0 <= 2e+15) {
tmp = cos(y) + 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)
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 - (sin(y) * z)
if (t_0 <= (-5d+37)) then
tmp = t_1
else if (t_0 <= 2d+15) then
tmp = cos(y) + x
else
tmp = t_1
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 - (Math.sin(y) * z);
double tmp;
if (t_0 <= -5e+37) {
tmp = t_1;
} else if (t_0 <= 2e+15) {
tmp = Math.cos(y) + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.cos(y)) - (z * math.sin(y)) t_1 = x - (math.sin(y) * z) tmp = 0 if t_0 <= -5e+37: tmp = t_1 elif t_0 <= 2e+15: tmp = math.cos(y) + x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y))) t_1 = Float64(x - Float64(sin(y) * z)) tmp = 0.0 if (t_0 <= -5e+37) tmp = t_1; elseif (t_0 <= 2e+15) tmp = Float64(cos(y) + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + cos(y)) - (z * sin(y)); t_1 = x - (sin(y) * z); tmp = 0.0; if (t_0 <= -5e+37) tmp = t_1; elseif (t_0 <= 2e+15) tmp = cos(y) + x; else tmp = t_1; 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[(x - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+37], t$95$1, If[LessEqual[t$95$0, 2e+15], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
t_1 := x - \sin y \cdot z\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -4.99999999999999989e37 or 2e15 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
if -4.99999999999999989e37 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 2e15Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6493.0
Applied rewrites93.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (- z) (sin y)))) (if (<= z -7.6e+68) t_0 (if (<= z 3e+94) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -7.6e+68) {
tmp = t_0;
} else if (z <= 3e+94) {
tmp = 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 = -z * sin(y)
if (z <= (-7.6d+68)) then
tmp = t_0
else if (z <= 3d+94) then
tmp = 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 = -z * Math.sin(y);
double tmp;
if (z <= -7.6e+68) {
tmp = t_0;
} else if (z <= 3e+94) {
tmp = Math.cos(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z * math.sin(y) tmp = 0 if z <= -7.6e+68: tmp = t_0 elif z <= 3e+94: tmp = math.cos(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) * sin(y)) tmp = 0.0 if (z <= -7.6e+68) tmp = t_0; elseif (z <= 3e+94) tmp = Float64(cos(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -z * sin(y); tmp = 0.0; if (z <= -7.6e+68) tmp = t_0; elseif (z <= 3e+94) tmp = cos(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.6e+68], t$95$0, If[LessEqual[z, 3e+94], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) \cdot \sin y\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+68}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+94}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.6000000000000002e68 or 3.0000000000000001e94 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-sin.f6463.0
Applied rewrites63.0%
if -7.6000000000000002e68 < z < 3.0000000000000001e94Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6492.6
Applied rewrites92.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (cos y) x)))
(if (<= y -20000000000.0)
t_0
(if (<= y 57.0)
(- (fma (- (* (* (* z y) 0.16666666666666666) y) z) y x) -1.0)
t_0))))
double code(double x, double y, double z) {
double t_0 = cos(y) + x;
double tmp;
if (y <= -20000000000.0) {
tmp = t_0;
} else if (y <= 57.0) {
tmp = fma(((((z * y) * 0.16666666666666666) * y) - z), y, x) - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) + x) tmp = 0.0 if (y <= -20000000000.0) tmp = t_0; elseif (y <= 57.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(z * y) * 0.16666666666666666) * y) - z), y, x) - -1.0); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -20000000000.0], t$95$0, If[LessEqual[y, 57.0], N[(N[(N[(N[(N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + x), $MachinePrecision] - -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y + x\\
\mathbf{if}\;y \leq -20000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 57:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(z \cdot y\right) \cdot 0.16666666666666666\right) \cdot y - z, y, x\right) - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2e10 or 57 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6462.4
Applied rewrites62.4%
if -2e10 < y < 57Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
Applied rewrites98.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6498.5
Applied rewrites98.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x (cos y)) (* z (sin y)))))
(if (<= t_0 -50000000000.0)
(- x (* z y))
(if (<= t_0 0.999) (cos y) (- (fma (- y) z x) -1.0)))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double tmp;
if (t_0 <= -50000000000.0) {
tmp = x - (z * y);
} else if (t_0 <= 0.999) {
tmp = cos(y);
} else {
tmp = fma(-y, z, x) - -1.0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y))) tmp = 0.0 if (t_0 <= -50000000000.0) tmp = Float64(x - Float64(z * y)); elseif (t_0 <= 0.999) tmp = cos(y); else tmp = Float64(fma(Float64(-y), z, x) - -1.0); end return 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]}, If[LessEqual[t$95$0, -50000000000.0], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.999], N[Cos[y], $MachinePrecision], N[(N[((-y) * z + x), $MachinePrecision] - -1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
\mathbf{if}\;t\_0 \leq -50000000000:\\
\;\;\;\;x - z \cdot y\\
\mathbf{elif}\;t\_0 \leq 0.999:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, x\right) - -1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e10Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites65.5%
if -5e10 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.998999999999999999Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6494.3
Applied rewrites94.3%
Taylor expanded in x around 0
+-commutativeN/A
lift-cos.f6486.7
Applied rewrites86.7%
if 0.998999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
mul-1-negN/A
negate-sub-reverseN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6475.6
Applied rewrites75.6%
lift-*.f64N/A
lift--.f64N/A
negate-subN/A
*-commutativeN/A
mul-1-negN/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6475.6
Applied rewrites75.6%
(FPCore (x y z)
:precision binary64
(if (<= y -2.1e+43)
(- x -1.0)
(if (<= y 1.9e+63)
(-
(+ 1.0 x)
(*
z
(*
(fma
(fma 0.008333333333333333 (* y y) -0.16666666666666666)
(* y y)
1.0)
y)))
(- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+43) {
tmp = x - -1.0;
} else if (y <= 1.9e+63) {
tmp = (1.0 + x) - (z * (fma(fma(0.008333333333333333, (y * y), -0.16666666666666666), (y * y), 1.0) * y));
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.1e+43) tmp = Float64(x - -1.0); elseif (y <= 1.9e+63) tmp = Float64(Float64(1.0 + x) - Float64(z * Float64(fma(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666), Float64(y * y), 1.0) * y))); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2.1e+43], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 1.9e+63], N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+43}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+63}:\\
\;\;\;\;\left(1 + x\right) - z \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -2.10000000000000002e43 or 1.9000000000000001e63 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6440.2
Applied rewrites40.2%
if -2.10000000000000002e43 < y < 1.9000000000000001e63Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites65.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
negate-subN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.8
Applied rewrites57.8%
Taylor expanded in y around 0
lower-+.f6489.0
Applied rewrites89.0%
(FPCore (x y z)
:precision binary64
(if (<= y -2.7e+44)
(- x -1.0)
(if (<= y 1600000.0)
(- (fma (- (* (* (* z y) 0.16666666666666666) y) z) y x) -1.0)
(- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+44) {
tmp = x - -1.0;
} else if (y <= 1600000.0) {
tmp = fma(((((z * y) * 0.16666666666666666) * y) - z), y, x) - -1.0;
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+44) tmp = Float64(x - -1.0); elseif (y <= 1600000.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(z * y) * 0.16666666666666666) * y) - z), y, x) - -1.0); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+44], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 1600000.0], N[(N[(N[(N[(N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + x), $MachinePrecision] - -1.0), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+44}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 1600000:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(z \cdot y\right) \cdot 0.16666666666666666\right) \cdot y - z, y, x\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -2.7e44 or 1.6e6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6440.3
Applied rewrites40.3%
if -2.7e44 < y < 1.6e6Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
Applied rewrites94.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6494.8
Applied rewrites94.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.45e+19) (- x -1.0) (if (<= y 3.05e+82) (- (fma (- y) z x) -1.0) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.45e+19) {
tmp = x - -1.0;
} else if (y <= 3.05e+82) {
tmp = fma(-y, z, x) - -1.0;
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.45e+19) tmp = Float64(x - -1.0); elseif (y <= 3.05e+82) tmp = Float64(fma(Float64(-y), z, x) - -1.0); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.45e+19], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 3.05e+82], N[(N[((-y) * z + x), $MachinePrecision] - -1.0), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, x\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -1.45e19 or 3.0499999999999999e82 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6440.2
Applied rewrites40.2%
if -1.45e19 < y < 3.0499999999999999e82Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
mul-1-negN/A
negate-sub-reverseN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.7%
lift-*.f64N/A
lift--.f64N/A
negate-subN/A
*-commutativeN/A
mul-1-negN/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6490.7
Applied rewrites90.7%
(FPCore (x y z) :precision binary64 (if (<= y -1.45e+19) (- x -1.0) (if (<= y 3.05e+82) (- x (fma z y -1.0)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.45e+19) {
tmp = x - -1.0;
} else if (y <= 3.05e+82) {
tmp = x - fma(z, y, -1.0);
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.45e+19) tmp = Float64(x - -1.0); elseif (y <= 3.05e+82) tmp = Float64(x - fma(z, y, -1.0)); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.45e+19], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 3.05e+82], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{+82}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -1.45e19 or 3.0499999999999999e82 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6440.2
Applied rewrites40.2%
if -1.45e19 < y < 3.0499999999999999e82Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
mul-1-negN/A
negate-sub-reverseN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.7%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lower-fma.f6490.7
Applied rewrites90.7%
(FPCore (x y z) :precision binary64 (if (<= x -96000.0) x (if (<= x 1.9e-8) (- 1.0 (* z y)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -96000.0) {
tmp = x;
} else if (x <= 1.9e-8) {
tmp = 1.0 - (z * y);
} else {
tmp = x - -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 <= (-96000.0d0)) then
tmp = x
else if (x <= 1.9d-8) then
tmp = 1.0d0 - (z * y)
else
tmp = x - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -96000.0) {
tmp = x;
} else if (x <= 1.9e-8) {
tmp = 1.0 - (z * y);
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -96000.0: tmp = x elif x <= 1.9e-8: tmp = 1.0 - (z * y) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -96000.0) tmp = x; elseif (x <= 1.9e-8) tmp = Float64(1.0 - Float64(z * y)); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -96000.0) tmp = x; elseif (x <= 1.9e-8) tmp = 1.0 - (z * y); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -96000.0], x, If[LessEqual[x, 1.9e-8], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -96000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-8}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if x < -96000Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites82.6%
if -96000 < x < 1.90000000000000014e-8Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
mul-1-negN/A
negate-sub-reverseN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lift-*.f6451.3
Applied rewrites51.3%
if 1.90000000000000014e-8 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6479.2
Applied rewrites79.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.4e+205) (- x -1.0) (* (- y) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.4e+205) {
tmp = x - -1.0;
} else {
tmp = -y * z;
}
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 (z <= 1.4d+205) then
tmp = x - (-1.0d0)
else
tmp = -y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.4e+205) {
tmp = x - -1.0;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.4e+205: tmp = x - -1.0 else: tmp = -y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.4e+205) tmp = Float64(x - -1.0); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.4e+205) tmp = x - -1.0; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.4e+205], N[(x - -1.0), $MachinePrecision], N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{+205}:\\
\;\;\;\;x - -1\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if z < 1.39999999999999996e205Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6464.5
Applied rewrites64.5%
if 1.39999999999999996e205 < z Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f64N/A
mul-1-negN/A
negate-sub-reverseN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
Taylor expanded in y around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6433.7
Applied rewrites33.7%
(FPCore (x y z) :precision binary64 (- x -1.0))
double code(double x, double y, double z) {
return x - -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 = x - (-1.0d0)
end function
public static double code(double x, double y, double z) {
return x - -1.0;
}
def code(x, y, z): return x - -1.0
function code(x, y, z) return Float64(x - -1.0) end
function tmp = code(x, y, z) tmp = x - -1.0; end
code[x_, y_, z_] := N[(x - -1.0), $MachinePrecision]
\begin{array}{l}
\\
x - -1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
negate-sub-reverseN/A
lower--.f6460.9
Applied rewrites60.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return 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 = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites42.0%
herbie shell --seed 2025116
(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))))