
(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 10 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 (* z (sin y)))
(t_1 (- (+ x (cos y)) t_0))
(t_2 (- (+ x 1.0) t_0)))
(if (<= t_1 -5200000.0)
t_2
(if (<= t_1 0.95) (* (+ (/ (cos y) x) 1.0) x) t_2))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -5200000.0) {
tmp = t_2;
} else if (t_1 <= 0.95) {
tmp = ((cos(y) / x) + 1.0) * x;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
t_2 = (x + 1.0d0) - t_0
if (t_1 <= (-5200000.0d0)) then
tmp = t_2
else if (t_1 <= 0.95d0) then
tmp = ((cos(y) / x) + 1.0d0) * x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + Math.cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -5200000.0) {
tmp = t_2;
} else if (t_1 <= 0.95) {
tmp = ((Math.cos(y) / x) + 1.0) * x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + math.cos(y)) - t_0 t_2 = (x + 1.0) - t_0 tmp = 0 if t_1 <= -5200000.0: tmp = t_2 elif t_1 <= 0.95: tmp = ((math.cos(y) / x) + 1.0) * x else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + cos(y)) - t_0) t_2 = Float64(Float64(x + 1.0) - t_0) tmp = 0.0 if (t_1 <= -5200000.0) tmp = t_2; elseif (t_1 <= 0.95) tmp = Float64(Float64(Float64(cos(y) / x) + 1.0) * x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + cos(y)) - t_0; t_2 = (x + 1.0) - t_0; tmp = 0.0; if (t_1 <= -5200000.0) tmp = t_2; elseif (t_1 <= 0.95) tmp = ((cos(y) / x) + 1.0) * x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -5200000.0], t$95$2, If[LessEqual[t$95$1, 0.95], N[(N[(N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + \cos y\right) - t\_0\\
t_2 := \left(x + 1\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -5200000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.95:\\
\;\;\;\;\left(\frac{\cos y}{x} + 1\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5.2e6 or 0.94999999999999996 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -5.2e6 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.94999999999999996Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-cos.f6472.8
Applied rewrites72.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y)))
(t_1 (- (+ x (cos y)) t_0))
(t_2 (- (+ x 1.0) t_0)))
(if (<= t_1 -5000000.0) t_2 (if (<= t_1 0.95) (* (/ (cos y) x) x) t_2))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -5000000.0) {
tmp = t_2;
} else if (t_1 <= 0.95) {
tmp = (cos(y) / x) * x;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
t_2 = (x + 1.0d0) - t_0
if (t_1 <= (-5000000.0d0)) then
tmp = t_2
else if (t_1 <= 0.95d0) then
tmp = (cos(y) / x) * x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + Math.cos(y)) - t_0;
double t_2 = (x + 1.0) - t_0;
double tmp;
if (t_1 <= -5000000.0) {
tmp = t_2;
} else if (t_1 <= 0.95) {
tmp = (Math.cos(y) / x) * x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + math.cos(y)) - t_0 t_2 = (x + 1.0) - t_0 tmp = 0 if t_1 <= -5000000.0: tmp = t_2 elif t_1 <= 0.95: tmp = (math.cos(y) / x) * x else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + cos(y)) - t_0) t_2 = Float64(Float64(x + 1.0) - t_0) tmp = 0.0 if (t_1 <= -5000000.0) tmp = t_2; elseif (t_1 <= 0.95) tmp = Float64(Float64(cos(y) / x) * x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + cos(y)) - t_0; t_2 = (x + 1.0) - t_0; tmp = 0.0; if (t_1 <= -5000000.0) tmp = t_2; elseif (t_1 <= 0.95) tmp = (cos(y) / x) * x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -5000000.0], t$95$2, If[LessEqual[t$95$1, 0.95], N[(N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision] * x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + \cos y\right) - t\_0\\
t_2 := \left(x + 1\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -5000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.95:\\
\;\;\;\;\frac{\cos y}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e6 or 0.94999999999999996 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.3%
if -5e6 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.94999999999999996Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-cos.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
lift-cos.f64N/A
lift-/.f6432.4
Applied rewrites32.4%
(FPCore (x y z)
:precision binary64
(if (<= x -6.4e-13)
(* (+ 1.0 (/ 1.0 x)) x)
(if (<= x -1.8e-262)
(* (- z) (sin y))
(if (<= x 4.8e-23) (- (cos y) (* z y)) (- x -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.4e-13) {
tmp = (1.0 + (1.0 / x)) * x;
} else if (x <= -1.8e-262) {
tmp = -z * sin(y);
} else if (x <= 4.8e-23) {
tmp = cos(y) - (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 <= (-6.4d-13)) then
tmp = (1.0d0 + (1.0d0 / x)) * x
else if (x <= (-1.8d-262)) then
tmp = -z * sin(y)
else if (x <= 4.8d-23) then
tmp = cos(y) - (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 <= -6.4e-13) {
tmp = (1.0 + (1.0 / x)) * x;
} else if (x <= -1.8e-262) {
tmp = -z * Math.sin(y);
} else if (x <= 4.8e-23) {
tmp = Math.cos(y) - (z * y);
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.4e-13: tmp = (1.0 + (1.0 / x)) * x elif x <= -1.8e-262: tmp = -z * math.sin(y) elif x <= 4.8e-23: tmp = math.cos(y) - (z * y) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.4e-13) tmp = Float64(Float64(1.0 + Float64(1.0 / x)) * x); elseif (x <= -1.8e-262) tmp = Float64(Float64(-z) * sin(y)); elseif (x <= 4.8e-23) tmp = Float64(cos(y) - 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 <= -6.4e-13) tmp = (1.0 + (1.0 / x)) * x; elseif (x <= -1.8e-262) tmp = -z * sin(y); elseif (x <= 4.8e-23) tmp = cos(y) - (z * y); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.4e-13], N[(N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -1.8e-262], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e-23], N[(N[Cos[y], $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-13}:\\
\;\;\;\;\left(1 + \frac{1}{x}\right) \cdot x\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-262}:\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-23}:\\
\;\;\;\;\cos y - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if x < -6.39999999999999999e-13Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in y around 0
lower-/.f6461.7
Applied rewrites61.7%
if -6.39999999999999999e-13 < x < -1.7999999999999999e-262Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-sin.f6428.4
Applied rewrites28.4%
if -1.7999999999999999e-262 < x < 4.79999999999999993e-23Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6468.8
Applied rewrites68.8%
Taylor expanded in x around 0
lift-cos.f6434.2
Applied rewrites34.2%
if 4.79999999999999993e-23 < 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--.f6461.7
Applied rewrites61.7%
(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) x) (- (- 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) / x) * x;
} 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 = Float64(fma(Float64(-z), y, x) - -1.0); elseif (t_0 <= 0.95) tmp = Float64(Float64(cos(y) / x) * x); 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[(N[((-z) * y + x), $MachinePrecision] - -1.0), $MachinePrecision], If[LessEqual[t$95$0, 0.95], N[(N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision] * x), $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\right) - -1\\
\mathbf{elif}\;t\_0 \leq 0.95:\\
\;\;\;\;\frac{\cos y}{x} \cdot x\\
\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
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6463.5
Applied rewrites63.5%
if -5e6 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.94999999999999996Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-cos.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
lift-cos.f64N/A
lift-/.f6432.4
Applied rewrites32.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
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.5
Applied rewrites63.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (- z) (sin y)))) (if (<= z -2.5e+70) t_0 (if (<= z 3.9e+168) (- x -1.0) t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -2.5e+70) {
tmp = t_0;
} else if (z <= 3.9e+168) {
tmp = x - -1.0;
} 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 <= (-2.5d+70)) then
tmp = t_0
else if (z <= 3.9d+168) then
tmp = x - (-1.0d0)
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 <= -2.5e+70) {
tmp = t_0;
} else if (z <= 3.9e+168) {
tmp = x - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z * math.sin(y) tmp = 0 if z <= -2.5e+70: tmp = t_0 elif z <= 3.9e+168: tmp = x - -1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) * sin(y)) tmp = 0.0 if (z <= -2.5e+70) tmp = t_0; elseif (z <= 3.9e+168) tmp = Float64(x - -1.0); 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 <= -2.5e+70) tmp = t_0; elseif (z <= 3.9e+168) tmp = x - -1.0; 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, -2.5e+70], t$95$0, If[LessEqual[z, 3.9e+168], N[(x - -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) \cdot \sin y\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+168}:\\
\;\;\;\;x - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.5000000000000001e70 or 3.89999999999999999e168 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-sin.f6428.4
Applied rewrites28.4%
if -2.5000000000000001e70 < z < 3.89999999999999999e168Initial 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.7
Applied rewrites61.7%
(FPCore (x y z) :precision binary64 (if (<= y -5e+105) (- x -1.0) (if (<= y 5.2e+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 <= 5.2e+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 <= 5.2e+109) tmp = Float64(fma(Float64(-z), y, 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, 5.2e+109], N[(N[((-z) * y + x), $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 5.2 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -5.00000000000000046e105 or 5.1999999999999997e109 < 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--.f6461.7
Applied rewrites61.7%
if -5.00000000000000046e105 < y < 5.1999999999999997e109Initial 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
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6463.5
Applied rewrites63.5%
(FPCore (x y z) :precision binary64 (if (<= y -5e+105) (- x -1.0) (if (<= y 5.2e+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 <= 5.2e+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 <= 5.2d+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 <= 5.2e+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 <= 5.2e+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 <= 5.2e+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 <= 5.2e+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, 5.2e+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 5.2 \cdot 10^{+109}:\\
\;\;\;\;\left(x - z \cdot y\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -5.00000000000000046e105 or 5.1999999999999997e109 < 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--.f6461.7
Applied rewrites61.7%
if -5.00000000000000046e105 < y < 5.1999999999999997e109Initial 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
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.5
Applied rewrites63.5%
(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.7
Applied rewrites61.7%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in x around 0
Applied rewrites21.8%
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))))