
(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 (- (cos y) (- (* (sin y) z) x)))
double code(double x, double y, double z) {
return cos(y) - ((sin(y) * z) - 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 = cos(y) - ((sin(y) * z) - x)
end function
public static double code(double x, double y, double z) {
return Math.cos(y) - ((Math.sin(y) * z) - x);
}
def code(x, y, z): return math.cos(y) - ((math.sin(y) * z) - x)
function code(x, y, z) return Float64(cos(y) - Float64(Float64(sin(y) * z) - x)) end
function tmp = code(x, y, z) tmp = cos(y) - ((sin(y) * z) - x); end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y - \left(\sin y \cdot z - x\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lift-cos.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (* (sin y) z))))
(if (<= x -220000000000.0)
t_0
(if (<= x 0.8) (- (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 <= -220000000000.0) {
tmp = t_0;
} else if (x <= 0.8) {
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 <= (-220000000000.0d0)) then
tmp = t_0
else if (x <= 0.8d0) 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 <= -220000000000.0) {
tmp = t_0;
} else if (x <= 0.8) {
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 <= -220000000000.0: tmp = t_0 elif x <= 0.8: 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 <= -220000000000.0) tmp = t_0; elseif (x <= 0.8) 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 <= -220000000000.0) tmp = t_0; elseif (x <= 0.8) 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, -220000000000.0], t$95$0, If[LessEqual[x, 0.8], 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 -220000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.8:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.2e11 or 0.80000000000000004 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites99.1%
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
if -2.2e11 < x < 0.80000000000000004Initial program 99.9%
Taylor expanded in x around 0
lift-cos.f6497.0
Applied rewrites97.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (cos y)) (* z (sin y)))) (t_1 (- x (* (sin y) z)))) (if (<= t_0 -10.0) t_1 (if (<= t_0 2.0) (+ (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 <= -10.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
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 <= (-10.0d0)) then
tmp = t_1
else if (t_0 <= 2.0d0) 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 <= -10.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
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 <= -10.0: tmp = t_1 elif t_0 <= 2.0: 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 <= -10.0) tmp = t_1; elseif (t_0 <= 2.0) 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 <= -10.0) tmp = t_1; elseif (t_0 <= 2.0) 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, -10.0], t$95$1, If[LessEqual[t$95$0, 2.0], 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 -10:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -10 or 2 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
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 -10 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 2Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6497.9
Applied rewrites97.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (- z) (sin y)))) (if (<= z -7.2e+217) t_0 (if (<= z 3.3e+176) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -7.2e+217) {
tmp = t_0;
} else if (z <= 3.3e+176) {
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.2d+217)) then
tmp = t_0
else if (z <= 3.3d+176) 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.2e+217) {
tmp = t_0;
} else if (z <= 3.3e+176) {
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.2e+217: tmp = t_0 elif z <= 3.3e+176: 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.2e+217) tmp = t_0; elseif (z <= 3.3e+176) 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.2e+217) tmp = t_0; elseif (z <= 3.3e+176) 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.2e+217], t$95$0, If[LessEqual[z, 3.3e+176], 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.2 \cdot 10^{+217}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+176}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.2000000000000004e217 or 3.30000000000000025e176 < 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.f6471.9
Applied rewrites71.9%
if -7.2000000000000004e217 < z < 3.30000000000000025e176Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6482.8
Applied rewrites82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (cos y) x)))
(if (<= y -0.11)
t_0
(if (<= y 7.4e+19)
(fma (- (* (- (* 0.16666666666666666 (* z y)) 0.5) 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 <= -0.11) {
tmp = t_0;
} else if (y <= 7.4e+19) {
tmp = fma(((((0.16666666666666666 * (z * y)) - 0.5) * 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 <= -0.11) tmp = t_0; elseif (y <= 7.4e+19) tmp = fma(Float64(Float64(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5) * y) - z), y, Float64(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, -0.11], t$95$0, If[LessEqual[y, 7.4e+19], N[(N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y + x\\
\mathbf{if}\;y \leq -0.11:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.110000000000000001 or 7.4e19 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6461.9
Applied rewrites61.9%
if -0.110000000000000001 < y < 7.4e19Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x (cos y)) (* z (sin y)))))
(if (<= t_0 -10.0)
(- x (fma z y -1.0))
(if (<= t_0 0.9999999479163373) (cos y) (fma (- z) y (- 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 <= -10.0) {
tmp = x - fma(z, y, -1.0);
} else if (t_0 <= 0.9999999479163373) {
tmp = cos(y);
} else {
tmp = fma(-z, y, (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 <= -10.0) tmp = Float64(x - fma(z, y, -1.0)); elseif (t_0 <= 0.9999999479163373) tmp = cos(y); else tmp = fma(Float64(-z), y, Float64(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, -10.0], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.9999999479163373], N[Cos[y], $MachinePrecision], N[((-z) * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
\mathbf{if}\;t\_0 \leq -10:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.9999999479163373:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x - -1\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -10Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lower-fma.f6463.0
Applied rewrites63.0%
if -10 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99999994791633728Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6496.5
Applied rewrites96.5%
Taylor expanded in x around 0
lift-cos.f6493.2
Applied rewrites93.2%
if 0.99999994791633728 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites69.1%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6476.7
Applied rewrites76.7%
(FPCore (x y z)
:precision binary64
(if (<= y -3e+29)
(- x -1.0)
(if (<= y 1.2e+26)
(fma (- (* (- (* 0.16666666666666666 (* z y)) 0.5) y) z) y (- x -1.0))
(- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3e+29) {
tmp = x - -1.0;
} else if (y <= 1.2e+26) {
tmp = fma(((((0.16666666666666666 * (z * y)) - 0.5) * y) - z), y, (x - -1.0));
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3e+29) tmp = Float64(x - -1.0); elseif (y <= 1.2e+26) tmp = fma(Float64(Float64(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5) * y) - z), y, Float64(x - -1.0)); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3e+29], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 1.2e+26], N[(N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+29}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5\right) \cdot y - z, y, x - -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -2.9999999999999999e29 or 1.20000000000000002e26 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6440.2
Applied rewrites40.2%
if -2.9999999999999999e29 < y < 1.20000000000000002e26Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites94.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.42e+15) (- x -1.0) (fma (- z) y (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.42e+15) {
tmp = x - -1.0;
} else {
tmp = fma(-z, y, (x - -1.0));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.42e+15) tmp = Float64(x - -1.0); else tmp = fma(Float64(-z), y, Float64(x - -1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.42e+15], N[(x - -1.0), $MachinePrecision], N[((-z) * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+15}:\\
\;\;\;\;x - -1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x - -1\right)\\
\end{array}
\end{array}
if y < -1.42e15Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6439.6
Applied rewrites39.6%
if -1.42e15 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites69.5%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6475.1
Applied rewrites75.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.42e+15) (- x -1.0) (- x (fma z y -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.42e+15) {
tmp = x - -1.0;
} else {
tmp = x - fma(z, y, -1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.42e+15) tmp = Float64(x - -1.0); else tmp = Float64(x - fma(z, y, -1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.42e+15], N[(x - -1.0), $MachinePrecision], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+15}:\\
\;\;\;\;x - -1\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\end{array}
\end{array}
if y < -1.42e15Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6439.6
Applied rewrites39.6%
if -1.42e15 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6475.1
Applied rewrites75.1%
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
lower-fma.f6475.1
Applied rewrites75.1%
(FPCore (x y z) :precision binary64 (if (<= x -220000000000.0) x (if (<= x 3e-26) (- 1.0 (* z y)) (- x (* z y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -220000000000.0) {
tmp = x;
} else if (x <= 3e-26) {
tmp = 1.0 - (z * y);
} else {
tmp = x - (z * y);
}
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 <= (-220000000000.0d0)) then
tmp = x
else if (x <= 3d-26) then
tmp = 1.0d0 - (z * y)
else
tmp = x - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -220000000000.0) {
tmp = x;
} else if (x <= 3e-26) {
tmp = 1.0 - (z * y);
} else {
tmp = x - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -220000000000.0: tmp = x elif x <= 3e-26: tmp = 1.0 - (z * y) else: tmp = x - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -220000000000.0) tmp = x; elseif (x <= 3e-26) tmp = Float64(1.0 - Float64(z * y)); else tmp = Float64(x - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -220000000000.0) tmp = x; elseif (x <= 3e-26) tmp = 1.0 - (z * y); else tmp = x - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -220000000000.0], x, If[LessEqual[x, 3e-26], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -220000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-26}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot y\\
\end{array}
\end{array}
if x < -2.2e11Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites84.3%
if -2.2e11 < x < 3.00000000000000012e-26Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lift-*.f6451.1
Applied rewrites51.1%
if 3.00000000000000012e-26 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites94.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
(FPCore (x y z) :precision binary64 (if (<= x -220000000000.0) x (if (<= x 1.32e-14) (- 1.0 (* z y)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -220000000000.0) {
tmp = x;
} else if (x <= 1.32e-14) {
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 <= (-220000000000.0d0)) then
tmp = x
else if (x <= 1.32d-14) 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 <= -220000000000.0) {
tmp = x;
} else if (x <= 1.32e-14) {
tmp = 1.0 - (z * y);
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -220000000000.0: tmp = x elif x <= 1.32e-14: tmp = 1.0 - (z * y) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -220000000000.0) tmp = x; elseif (x <= 1.32e-14) 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 <= -220000000000.0) tmp = x; elseif (x <= 1.32e-14) tmp = 1.0 - (z * y); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -220000000000.0], x, If[LessEqual[x, 1.32e-14], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -220000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-14}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if x < -2.2e11Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites84.3%
if -2.2e11 < x < 1.32e-14Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lift-*.f6451.1
Applied rewrites51.1%
if 1.32e-14 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6480.8
Applied rewrites80.8%
(FPCore (x y z) :precision binary64 (if (<= z -3e+221) (* (- z) y) (- x -1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3e+221) {
tmp = -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 (z <= (-3d+221)) then
tmp = -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 (z <= -3e+221) {
tmp = -z * y;
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3e+221: tmp = -z * y else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3e+221) tmp = Float64(Float64(-z) * y); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3e+221) tmp = -z * y; else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3e+221], N[((-z) * y), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+221}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if z < -3.0000000000000001e221Initial 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.f6473.6
Applied rewrites73.6%
Taylor expanded in y around 0
Applied rewrites28.0%
if -3.0000000000000001e221 < z Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6464.8
Applied rewrites64.8%
(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
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6461.9
Applied rewrites61.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.4%
herbie shell --seed 2025120
(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))))