
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ (sin y) x)))
double code(double x, double y, double z) {
return fma(cos(y), z, (sin(y) + x));
}
function code(x, y, z) return fma(cos(y), z, Float64(sin(y) + x)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, \sin y + x\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
(if (<= t_0 -1.0)
(+ z x)
(if (<= t_0 -0.1)
(sin y)
(if (<= t_0 0.04)
(fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))
(if (<= t_0 1.0) (sin y) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = (x + sin(y)) + (z * cos(y));
double tmp;
if (t_0 <= -1.0) {
tmp = z + x;
} else if (t_0 <= -0.1) {
tmp = sin(y);
} else if (t_0 <= 0.04) {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y))) tmp = 0.0 if (t_0 <= -1.0) tmp = Float64(z + x); elseif (t_0 <= -0.1) tmp = sin(y); elseif (t_0 <= 0.04) tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 0.04], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
\mathbf{if}\;t\_0 \leq -1:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.1:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 0.04:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -1 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites77.3%
if -1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.10000000000000001 or 0.0400000000000000008 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites98.2%
if -0.10000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.0400000000000000008Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -1.25e+193)
t_0
(if (<= z -3.5e-10)
(+ z x)
(if (<= z 5.9e-64) (+ (sin y) x) (if (<= z 1.25e+89) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -1.25e+193) {
tmp = t_0;
} else if (z <= -3.5e-10) {
tmp = z + x;
} else if (z <= 5.9e-64) {
tmp = sin(y) + x;
} else if (z <= 1.25e+89) {
tmp = z + 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 = cos(y) * z
if (z <= (-1.25d+193)) then
tmp = t_0
else if (z <= (-3.5d-10)) then
tmp = z + x
else if (z <= 5.9d-64) then
tmp = sin(y) + x
else if (z <= 1.25d+89) then
tmp = z + 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.cos(y) * z;
double tmp;
if (z <= -1.25e+193) {
tmp = t_0;
} else if (z <= -3.5e-10) {
tmp = z + x;
} else if (z <= 5.9e-64) {
tmp = Math.sin(y) + x;
} else if (z <= 1.25e+89) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -1.25e+193: tmp = t_0 elif z <= -3.5e-10: tmp = z + x elif z <= 5.9e-64: tmp = math.sin(y) + x elif z <= 1.25e+89: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -1.25e+193) tmp = t_0; elseif (z <= -3.5e-10) tmp = Float64(z + x); elseif (z <= 5.9e-64) tmp = Float64(sin(y) + x); elseif (z <= 1.25e+89) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -1.25e+193) tmp = t_0; elseif (z <= -3.5e-10) tmp = z + x; elseif (z <= 5.9e-64) tmp = sin(y) + x; elseif (z <= 1.25e+89) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.25e+193], t$95$0, If[LessEqual[z, -3.5e-10], N[(z + x), $MachinePrecision], If[LessEqual[z, 5.9e-64], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.25e+89], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-10}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{-64}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+89}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.24999999999999993e193 or 1.24999999999999996e89 < z Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites83.3%
if -1.24999999999999993e193 < z < -3.4999999999999998e-10 or 5.89999999999999995e-64 < z < 1.24999999999999996e89Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites81.0%
if -3.4999999999999998e-10 < z < 5.89999999999999995e-64Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites98.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.36e+26) (not (<= z 9e-14))) (fma (cos y) z x) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.36e+26) || !(z <= 9e-14)) {
tmp = fma(cos(y), z, x);
} else {
tmp = (x + sin(y)) + z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -1.36e+26) || !(z <= 9e-14)) tmp = fma(cos(y), z, x); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.36e+26], N[Not[LessEqual[z, 9e-14]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{+26} \lor \neg \left(z \leq 9 \cdot 10^{-14}\right):\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.35999999999999993e26 or 8.9999999999999995e-14 < z Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites99.8%
if -1.35999999999999993e26 < z < 8.9999999999999995e-14Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25e+193) (not (<= z 1.25e+89))) (* (cos y) z) (+ (+ x (sin y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e+193) || !(z <= 1.25e+89)) {
tmp = cos(y) * z;
} else {
tmp = (x + sin(y)) + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.25d+193)) .or. (.not. (z <= 1.25d+89))) then
tmp = cos(y) * z
else
tmp = (x + sin(y)) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e+193) || !(z <= 1.25e+89)) {
tmp = Math.cos(y) * z;
} else {
tmp = (x + Math.sin(y)) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25e+193) or not (z <= 1.25e+89): tmp = math.cos(y) * z else: tmp = (x + math.sin(y)) + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25e+193) || !(z <= 1.25e+89)) tmp = Float64(cos(y) * z); else tmp = Float64(Float64(x + sin(y)) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.25e+193) || ~((z <= 1.25e+89))) tmp = cos(y) * z; else tmp = (x + sin(y)) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e+193], N[Not[LessEqual[z, 1.25e+89]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+193} \lor \neg \left(z \leq 1.25 \cdot 10^{+89}\right):\\
\;\;\;\;\cos y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(x + \sin y\right) + z\\
\end{array}
\end{array}
if z < -1.24999999999999993e193 or 1.24999999999999996e89 < z Initial program 99.7%
Taylor expanded in z around inf
Applied rewrites83.3%
if -1.24999999999999993e193 < z < 1.24999999999999996e89Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites94.0%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -200000.0) (not (<= y 4.8e-6))) (+ (sin y) x) (+ (+ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -200000.0) || !(y <= 4.8e-6)) {
tmp = sin(y) + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-200000.0d0)) .or. (.not. (y <= 4.8d-6))) then
tmp = sin(y) + x
else
tmp = (y + x) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -200000.0) || !(y <= 4.8e-6)) {
tmp = Math.sin(y) + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -200000.0) or not (y <= 4.8e-6): tmp = math.sin(y) + x else: tmp = (y + x) + z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -200000.0) || !(y <= 4.8e-6)) tmp = Float64(sin(y) + x); else tmp = Float64(Float64(y + x) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -200000.0) || ~((y <= 4.8e-6))) tmp = sin(y) + x; else tmp = (y + x) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -200000.0], N[Not[LessEqual[y, 4.8e-6]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -200000 \lor \neg \left(y \leq 4.8 \cdot 10^{-6}\right):\\
\;\;\;\;\sin y + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + z\\
\end{array}
\end{array}
if y < -2e5 or 4.7999999999999998e-6 < y Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites66.7%
if -2e5 < y < 4.7999999999999998e-6Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.5%
Final simplification83.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -17.5) (not (<= y 6.3e+16))) (+ z x) (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -17.5) || !(y <= 6.3e+16)) {
tmp = z + x;
} else {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -17.5) || !(y <= 6.3e+16)) tmp = Float64(z + x); else tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -17.5], N[Not[LessEqual[y, 6.3e+16]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -17.5 \lor \neg \left(y \leq 6.3 \cdot 10^{+16}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -17.5 or 6.3e16 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites40.0%
if -17.5 < y < 6.3e16Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites98.1%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -17.5) (not (<= y 6.3e+16))) (+ z x) (fma (fma (* z y) -0.5 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -17.5) || !(y <= 6.3e+16)) {
tmp = z + x;
} else {
tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -17.5) || !(y <= 6.3e+16)) tmp = Float64(z + x); else tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -17.5], N[Not[LessEqual[y, 6.3e+16]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -17.5 \lor \neg \left(y \leq 6.3 \cdot 10^{+16}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -17.5 or 6.3e16 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites40.0%
if -17.5 < y < 6.3e16Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites97.9%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -22.0) (not (<= y 9.8e+41))) (+ z x) (+ (+ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -22.0) || !(y <= 9.8e+41)) {
tmp = z + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-22.0d0)) .or. (.not. (y <= 9.8d+41))) then
tmp = z + x
else
tmp = (y + x) + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -22.0) || !(y <= 9.8e+41)) {
tmp = z + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -22.0) or not (y <= 9.8e+41): tmp = z + x else: tmp = (y + x) + z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -22.0) || !(y <= 9.8e+41)) tmp = Float64(z + x); else tmp = Float64(Float64(y + x) + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -22.0) || ~((y <= 9.8e+41))) tmp = z + x; else tmp = (y + x) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -22.0], N[Not[LessEqual[y, 9.8e+41]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -22 \lor \neg \left(y \leq 9.8 \cdot 10^{+41}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + z\\
\end{array}
\end{array}
if y < -22 or 9.7999999999999998e41 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites39.9%
if -22 < y < 9.7999999999999998e41Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites96.5%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4e-120) (not (<= x 5.6e-163))) (+ z x) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4e-120) || !(x <= 5.6e-163)) {
tmp = z + x;
} else {
tmp = 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 <= (-1.4d-120)) .or. (.not. (x <= 5.6d-163))) then
tmp = z + x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4e-120) || !(x <= 5.6e-163)) {
tmp = z + x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4e-120) or not (x <= 5.6e-163): tmp = z + x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4e-120) || !(x <= 5.6e-163)) tmp = Float64(z + x); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4e-120) || ~((x <= 5.6e-163))) tmp = z + x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4e-120], N[Not[LessEqual[x, 5.6e-163]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-120} \lor \neg \left(x \leq 5.6 \cdot 10^{-163}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -1.39999999999999997e-120 or 5.5999999999999999e-163 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites72.3%
if -1.39999999999999997e-120 < x < 5.5999999999999999e-163Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites98.5%
Taylor expanded in y around 0
Applied rewrites56.2%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.5e-17) (not (<= x 2.55e+14))) x (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e-17) || !(x <= 2.55e+14)) {
tmp = x;
} else {
tmp = 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 <= (-7.5d-17)) .or. (.not. (x <= 2.55d+14))) then
tmp = x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e-17) || !(x <= 2.55e+14)) {
tmp = x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.5e-17) or not (x <= 2.55e+14): tmp = x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.5e-17) || !(x <= 2.55e+14)) tmp = x; else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7.5e-17) || ~((x <= 2.55e+14))) tmp = x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.5e-17], N[Not[LessEqual[x, 2.55e+14]], $MachinePrecision]], x, N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-17} \lor \neg \left(x \leq 2.55 \cdot 10^{+14}\right):\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -7.49999999999999984e-17 or 2.55e14 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites74.4%
if -7.49999999999999984e-17 < x < 2.55e14Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites92.8%
Taylor expanded in y around 0
Applied rewrites45.6%
Final simplification60.8%
(FPCore (x y z) :precision binary64 (if (<= x -9.8e-9) x (if (<= x 2.55e+14) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.8e-9) {
tmp = x;
} else if (x <= 2.55e+14) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-9.8d-9)) then
tmp = x
else if (x <= 2.55d+14) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -9.8e-9) {
tmp = x;
} else if (x <= 2.55e+14) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.8e-9: tmp = x elif x <= 2.55e+14: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.8e-9) tmp = x; elseif (x <= 2.55e+14) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9.8e-9) tmp = x; elseif (x <= 2.55e+14) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.8e-9], x, If[LessEqual[x, 2.55e+14], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.8 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+14}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.80000000000000007e-9 or 2.55e14 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites74.9%
if -9.80000000000000007e-9 < x < 2.55e14Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites92.8%
Taylor expanded in y around 0
Applied rewrites35.2%
(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 rewrites43.7%
herbie shell --seed 2025022
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))