
(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 12 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 -15600.0) t_0 (if (<= z 6.9e-6) (+ (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 <= -15600.0) {
tmp = t_0;
} else if (z <= 6.9e-6) {
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 = (x - (-1.0d0)) - (z * sin(y))
if (z <= (-15600.0d0)) then
tmp = t_0
else if (z <= 6.9d-6) 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 = (x - -1.0) - (z * Math.sin(y));
double tmp;
if (z <= -15600.0) {
tmp = t_0;
} else if (z <= 6.9e-6) {
tmp = 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 <= -15600.0: tmp = t_0 elif z <= 6.9e-6: tmp = 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 <= -15600.0) tmp = t_0; elseif (z <= 6.9e-6) tmp = 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 <= -15600.0) tmp = t_0; elseif (z <= 6.9e-6) tmp = 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, -15600.0], t$95$0, If[LessEqual[z, 6.9e-6], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - -1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -15600:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.9 \cdot 10^{-6}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -15600 or 6.9e-6 < z Initial program 99.9%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6499.3
Applied rewrites99.3%
if -15600 < z < 6.9e-6Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6499.5
Applied rewrites99.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (* z (sin y))))) (if (<= z -5e+57) t_0 (if (<= z 1.3e+38) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (z * sin(y));
double tmp;
if (z <= -5e+57) {
tmp = t_0;
} else if (z <= 1.3e+38) {
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 = 1.0d0 - (z * sin(y))
if (z <= (-5d+57)) then
tmp = t_0
else if (z <= 1.3d+38) 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 = 1.0 - (z * Math.sin(y));
double tmp;
if (z <= -5e+57) {
tmp = t_0;
} else if (z <= 1.3e+38) {
tmp = Math.cos(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (z * math.sin(y)) tmp = 0 if z <= -5e+57: tmp = t_0 elif z <= 1.3e+38: tmp = math.cos(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(z * sin(y))) tmp = 0.0 if (z <= -5e+57) tmp = t_0; elseif (z <= 1.3e+38) tmp = Float64(cos(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (z * sin(y)); tmp = 0.0; if (z <= -5e+57) tmp = t_0; elseif (z <= 1.3e+38) tmp = cos(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+57], t$95$0, If[LessEqual[z, 1.3e+38], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -5 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+38}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.99999999999999972e57 or 1.3e38 < z Initial program 99.8%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites68.6%
if -4.99999999999999972e57 < z < 1.3e38Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6495.9
Applied rewrites95.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* (sin y) z)))) (if (<= z -3.6e+58) t_0 (if (<= z 3.8e+168) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = -(sin(y) * z);
double tmp;
if (z <= -3.6e+58) {
tmp = t_0;
} else if (z <= 3.8e+168) {
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 = -(sin(y) * z)
if (z <= (-3.6d+58)) then
tmp = t_0
else if (z <= 3.8d+168) 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 = -(Math.sin(y) * z);
double tmp;
if (z <= -3.6e+58) {
tmp = t_0;
} else if (z <= 3.8e+168) {
tmp = Math.cos(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -(math.sin(y) * z) tmp = 0 if z <= -3.6e+58: tmp = t_0 elif z <= 3.8e+168: tmp = math.cos(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-Float64(sin(y) * z)) tmp = 0.0 if (z <= -3.6e+58) tmp = t_0; elseif (z <= 3.8e+168) tmp = Float64(cos(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -(sin(y) * z); tmp = 0.0; if (z <= -3.6e+58) tmp = t_0; elseif (z <= 3.8e+168) tmp = cos(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision])}, If[LessEqual[z, -3.6e+58], t$95$0, If[LessEqual[z, 3.8e+168], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\sin y \cdot z\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+168}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.59999999999999996e58 or 3.8000000000000003e168 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6464.1
Applied rewrites64.1%
if -3.59999999999999996e58 < z < 3.8000000000000003e168Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6489.9
Applied rewrites89.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (cos y) x))) (if (<= y -24000.0) t_0 (if (<= y 1.7e-26) (fma (- 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 <= -24000.0) {
tmp = t_0;
} else if (y <= 1.7e-26) {
tmp = fma(-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 <= -24000.0) tmp = t_0; elseif (y <= 1.7e-26) tmp = fma(Float64(-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, -24000.0], t$95$0, If[LessEqual[y, 1.7e-26], N[((-z) * 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 -24000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x - -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -24000 or 1.70000000000000007e-26 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6462.4
Applied rewrites62.4%
if -24000 < y < 1.70000000000000007e-26Initial program 100.0%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6499.3
Applied rewrites99.3%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
associate--l+N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f6499.3
Applied rewrites99.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x (cos y)) (* z (sin y)))))
(if (<= t_0 -5000000.0)
(fma (- z) y (- x -1.0))
(if (<= t_0 0.95) (cos y) (- (- x (* z y)) -1.0)))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double tmp;
if (t_0 <= -5000000.0) {
tmp = fma(-z, y, (x - -1.0));
} else if (t_0 <= 0.95) {
tmp = cos(y);
} else {
tmp = (x - (z * y)) - -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 <= -5000000.0) tmp = fma(Float64(-z), y, Float64(x - -1.0)); elseif (t_0 <= 0.95) tmp = cos(y); else tmp = Float64(Float64(x - Float64(z * y)) - -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, -5000000.0], N[((-z) * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.95], N[Cos[y], $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $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 -5000000:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x - -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.95:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e6Initial program 99.9%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
associate--l+N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f6464.7
Applied rewrites64.7%
if -5e6 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.94999999999999996Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-cos.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
lift-cos.f6489.4
Applied rewrites89.4%
if 0.94999999999999996 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6474.8
Applied rewrites74.8%
lift-+.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
sub-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6474.8
Applied rewrites74.8%
(FPCore (x y z)
:precision binary64
(if (<= y -2.9e+35)
(- x -1.0)
(if (<= y 4.5e+73)
(- (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.9e+35) {
tmp = x - -1.0;
} else if (y <= 4.5e+73) {
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.9e+35) tmp = Float64(x - -1.0); elseif (y <= 4.5e+73) 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.9e+35], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 4.5e+73], 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.9 \cdot 10^{+35}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+73}:\\
\;\;\;\;\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.89999999999999995e35 or 4.49999999999999985e73 < y Initial program 99.8%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6440.5
Applied rewrites40.5%
if -2.89999999999999995e35 < y < 4.49999999999999985e73Initial program 100.0%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
Applied rewrites89.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6489.6
Applied rewrites89.6%
(FPCore (x y z) :precision binary64 (if (<= y -5e+105) (- x -1.0) (if (<= y 8e+109) (fma (- z) y (- x -1.0)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+105) {
tmp = x - -1.0;
} else if (y <= 8e+109) {
tmp = fma(-z, y, (x - -1.0));
} else {
tmp = x - -1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -5e+105) tmp = Float64(x - -1.0); elseif (y <= 8e+109) tmp = fma(Float64(-z), y, Float64(x - -1.0)); else tmp = Float64(x - -1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -5e+105], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 8e+109], N[((-z) * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+105}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x - -1\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -5.00000000000000046e105 or 7.99999999999999985e109 < y Initial program 99.8%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6440.7
Applied rewrites40.7%
if -5.00000000000000046e105 < y < 7.99999999999999985e109Initial program 100.0%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6483.1
Applied rewrites83.1%
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
associate--l+N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f6483.1
Applied rewrites83.1%
(FPCore (x y z) :precision binary64 (if (<= y -5e+105) (- x -1.0) (if (<= y 8e+109) (- (- x (* z y)) -1.0) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+105) {
tmp = x - -1.0;
} else if (y <= 8e+109) {
tmp = (x - (z * y)) - -1.0;
} 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 (y <= (-5d+105)) then
tmp = x - (-1.0d0)
else if (y <= 8d+109) then
tmp = (x - (z * y)) - (-1.0d0)
else
tmp = x - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e+105) {
tmp = x - -1.0;
} else if (y <= 8e+109) {
tmp = (x - (z * y)) - -1.0;
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+105: tmp = x - -1.0 elif y <= 8e+109: tmp = (x - (z * y)) - -1.0 else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+105) tmp = Float64(x - -1.0); elseif (y <= 8e+109) tmp = Float64(Float64(x - Float64(z * y)) - -1.0); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e+105) tmp = x - -1.0; elseif (y <= 8e+109) tmp = (x - (z * y)) - -1.0; else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+105], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 8e+109], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+105}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+109}:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -5.00000000000000046e105 or 7.99999999999999985e109 < y Initial program 99.8%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6440.7
Applied rewrites40.7%
if -5.00000000000000046e105 < y < 7.99999999999999985e109Initial program 100.0%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6483.1
Applied rewrites83.1%
lift-+.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
sub-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6483.1
Applied rewrites83.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.3e-12) (- x -1.0) (if (<= x 1.3e-27) (- 1.0 (* z y)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-12) {
tmp = x - -1.0;
} else if (x <= 1.3e-27) {
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 <= (-1.3d-12)) then
tmp = x - (-1.0d0)
else if (x <= 1.3d-27) 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 <= -1.3e-12) {
tmp = x - -1.0;
} else if (x <= 1.3e-27) {
tmp = 1.0 - (z * y);
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.3e-12: tmp = x - -1.0 elif x <= 1.3e-27: tmp = 1.0 - (z * y) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.3e-12) tmp = Float64(x - -1.0); elseif (x <= 1.3e-27) 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 <= -1.3e-12) tmp = x - -1.0; elseif (x <= 1.3e-27) tmp = 1.0 - (z * y); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.3e-12], N[(x - -1.0), $MachinePrecision], If[LessEqual[x, 1.3e-27], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-12}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-27}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if x < -1.29999999999999991e-12 or 1.30000000000000009e-27 < x Initial program 99.9%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6480.2
Applied rewrites80.2%
if -1.29999999999999991e-12 < x < 1.30000000000000009e-27Initial program 99.9%
Taylor expanded in y around 0
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f6453.0
Applied rewrites53.0%
Taylor expanded in x around 0
lower--.f64N/A
*-commutativeN/A
lift-*.f6452.9
Applied rewrites52.9%
(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
add-flipN/A
metadata-evalN/A
sub-negate-revN/A
lower--.f6461.7
Applied rewrites61.7%
(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 2025127
(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))))