
(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 (+ (sin y) x))
(t_1 (+ (+ x (sin y)) (* z (cos y))))
(t_2 (fma (cos y) z x)))
(if (<= t_1 -2000000000.0)
t_2
(if (<= t_1 -0.02)
t_0
(if (<= t_1 4e-44) (+ (+ y x) z) (if (<= t_1 5.0) t_0 t_2))))))
double code(double x, double y, double z) {
double t_0 = sin(y) + x;
double t_1 = (x + sin(y)) + (z * cos(y));
double t_2 = fma(cos(y), z, x);
double tmp;
if (t_1 <= -2000000000.0) {
tmp = t_2;
} else if (t_1 <= -0.02) {
tmp = t_0;
} else if (t_1 <= 4e-44) {
tmp = (y + x) + z;
} else if (t_1 <= 5.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) + x) t_1 = Float64(Float64(x + sin(y)) + Float64(z * cos(y))) t_2 = fma(cos(y), z, x) tmp = 0.0 if (t_1 <= -2000000000.0) tmp = t_2; elseif (t_1 <= -0.02) tmp = t_0; elseif (t_1 <= 4e-44) tmp = Float64(Float64(y + x) + z); elseif (t_1 <= 5.0) tmp = t_0; else tmp = t_2; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000000.0], t$95$2, If[LessEqual[t$95$1, -0.02], t$95$0, If[LessEqual[t$95$1, 4e-44], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[t$95$1, 5.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + x\\
t_1 := \left(x + \sin y\right) + z \cdot \cos y\\
t_2 := \mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{if}\;t\_1 \leq -2000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -0.02:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-44}:\\
\;\;\;\;\left(y + x\right) + z\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -2e9 or 5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) 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%
Taylor expanded in x around inf
Applied rewrites99.7%
if -2e9 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0200000000000000004 or 3.99999999999999981e-44 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 5Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites97.3%
if -0.0200000000000000004 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 3.99999999999999981e-44Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
(if (<= t_0 -1000000.0)
(+ z x)
(if (<= t_0 -0.02)
(sin y)
(if (<= t_0 2e-28) (+ (+ y x) z) (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 <= -1000000.0) {
tmp = z + x;
} else if (t_0 <= -0.02) {
tmp = sin(y);
} else if (t_0 <= 2e-28) {
tmp = (y + x) + z;
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = z + 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) :: t_0
real(8) :: tmp
t_0 = (x + sin(y)) + (z * cos(y))
if (t_0 <= (-1000000.0d0)) then
tmp = z + x
else if (t_0 <= (-0.02d0)) then
tmp = sin(y)
else if (t_0 <= 2d-28) then
tmp = (y + x) + z
else if (t_0 <= 1.0d0) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.sin(y)) + (z * Math.cos(y));
double tmp;
if (t_0 <= -1000000.0) {
tmp = z + x;
} else if (t_0 <= -0.02) {
tmp = Math.sin(y);
} else if (t_0 <= 2e-28) {
tmp = (y + x) + z;
} else if (t_0 <= 1.0) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.sin(y)) + (z * math.cos(y)) tmp = 0 if t_0 <= -1000000.0: tmp = z + x elif t_0 <= -0.02: tmp = math.sin(y) elif t_0 <= 2e-28: tmp = (y + x) + z elif t_0 <= 1.0: tmp = math.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 <= -1000000.0) tmp = Float64(z + x); elseif (t_0 <= -0.02) tmp = sin(y); elseif (t_0 <= 2e-28) tmp = Float64(Float64(y + x) + z); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + sin(y)) + (z * cos(y)); tmp = 0.0; if (t_0 <= -1000000.0) tmp = z + x; elseif (t_0 <= -0.02) tmp = sin(y); elseif (t_0 <= 2e-28) tmp = (y + x) + z; elseif (t_0 <= 1.0) tmp = sin(y); else tmp = z + x; end tmp_2 = 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, -1000000.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 2e-28], N[(N[(y + x), $MachinePrecision] + z), $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 -1000000:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-28}:\\
\;\;\;\;\left(y + x\right) + z\\
\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))) < -1e6 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.8%
if -1e6 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0200000000000000004 or 1.99999999999999994e-28 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites94.6%
Taylor expanded in z around 0
Applied rewrites92.6%
if -0.0200000000000000004 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1.99999999999999994e-28Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
(if (or (<= t_0 -0.02) (not (<= t_0 0.7)))
(+ z x)
(fma (fma (* -0.16666666666666666 y) y 1.0) 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 <= -0.02) || !(t_0 <= 0.7)) {
tmp = z + x;
} else {
tmp = fma(fma((-0.16666666666666666 * y), y, 1.0), y, (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 <= -0.02) || !(t_0 <= 0.7)) tmp = Float64(z + x); else tmp = fma(fma(Float64(-0.16666666666666666 * y), y, 1.0), y, 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[Or[LessEqual[t$95$0, -0.02], N[Not[LessEqual[t$95$0, 0.7]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
\mathbf{if}\;t\_0 \leq -0.02 \lor \neg \left(t\_0 \leq 0.7\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0200000000000000004 or 0.69999999999999996 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites70.0%
if -0.0200000000000000004 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.69999999999999996Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites81.0%
Taylor expanded in y around inf
Applied rewrites81.0%
Final simplification71.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -340000000.0)
t_0
(if (<= z 1.6e-30) (+ (sin y) x) (if (<= z 3.1e+187) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -340000000.0) {
tmp = t_0;
} else if (z <= 1.6e-30) {
tmp = sin(y) + x;
} else if (z <= 3.1e+187) {
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 <= (-340000000.0d0)) then
tmp = t_0
else if (z <= 1.6d-30) then
tmp = sin(y) + x
else if (z <= 3.1d+187) 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 <= -340000000.0) {
tmp = t_0;
} else if (z <= 1.6e-30) {
tmp = Math.sin(y) + x;
} else if (z <= 3.1e+187) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -340000000.0: tmp = t_0 elif z <= 1.6e-30: tmp = math.sin(y) + x elif z <= 3.1e+187: 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 <= -340000000.0) tmp = t_0; elseif (z <= 1.6e-30) tmp = Float64(sin(y) + x); elseif (z <= 3.1e+187) 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 <= -340000000.0) tmp = t_0; elseif (z <= 1.6e-30) tmp = sin(y) + x; elseif (z <= 3.1e+187) 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, -340000000.0], t$95$0, If[LessEqual[z, 1.6e-30], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.1e+187], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -340000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-30}:\\
\;\;\;\;\sin y + x\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+187}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.4e8 or 3.10000000000000012e187 < z Initial program 99.8%
Taylor expanded in z around inf
Applied rewrites87.8%
if -3.4e8 < z < 1.6e-30Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites90.3%
if 1.6e-30 < z < 3.10000000000000012e187Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites74.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.33) (not (<= y 2.7e-30))) (+ (sin y) 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 <= -0.33) || !(y <= 2.7e-30)) {
tmp = sin(y) + 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 <= -0.33) || !(y <= 2.7e-30)) tmp = Float64(sin(y) + 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, -0.33], N[Not[LessEqual[y, 2.7e-30]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] + 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 -0.33 \lor \neg \left(y \leq 2.7 \cdot 10^{-30}\right):\\
\;\;\;\;\sin y + 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 < -0.330000000000000016 or 2.69999999999999987e-30 < y Initial program 99.8%
Taylor expanded in z around 0
Applied rewrites61.9%
if -0.330000000000000016 < y < 2.69999999999999987e-30Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.8%
Final simplification82.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2300.0) (not (<= y 0.09))) (+ 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 <= -2300.0) || !(y <= 0.09)) {
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 <= -2300.0) || !(y <= 0.09)) 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, -2300.0], N[Not[LessEqual[y, 0.09]], $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 -2300 \lor \neg \left(y \leq 0.09\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 < -2300 or 0.089999999999999997 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites37.9%
if -2300 < y < 0.089999999999999997Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.7%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.1e+51) (not (<= y 4.8e+17))) (+ 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 <= -5.1e+51) || !(y <= 4.8e+17)) {
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 <= -5.1e+51) || !(y <= 4.8e+17)) 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, -5.1e+51], N[Not[LessEqual[y, 4.8e+17]], $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 -5.1 \cdot 10^{+51} \lor \neg \left(y \leq 4.8 \cdot 10^{+17}\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 < -5.1000000000000001e51 or 4.8e17 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites36.7%
if -5.1000000000000001e51 < y < 4.8e17Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites94.7%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -8e+54) (not (<= y 1.3e+86))) (+ z x) (+ (+ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+54) || !(y <= 1.3e+86)) {
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 <= (-8d+54)) .or. (.not. (y <= 1.3d+86))) 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 <= -8e+54) || !(y <= 1.3e+86)) {
tmp = z + x;
} else {
tmp = (y + x) + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8e+54) or not (y <= 1.3e+86): tmp = z + x else: tmp = (y + x) + z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8e+54) || !(y <= 1.3e+86)) 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 <= -8e+54) || ~((y <= 1.3e+86))) tmp = z + x; else tmp = (y + x) + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8e+54], N[Not[LessEqual[y, 1.3e+86]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+54} \lor \neg \left(y \leq 1.3 \cdot 10^{+86}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + z\\
\end{array}
\end{array}
if y < -8.0000000000000006e54 or 1.2999999999999999e86 < y Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites36.2%
if -8.0000000000000006e54 < y < 1.2999999999999999e86Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites90.7%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.8e+90) (not (<= x 3e+93))) x (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+90) || !(x <= 3e+93)) {
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 <= (-5.8d+90)) .or. (.not. (x <= 3d+93))) 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 <= -5.8e+90) || !(x <= 3e+93)) {
tmp = x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.8e+90) or not (x <= 3e+93): tmp = x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.8e+90) || !(x <= 3e+93)) tmp = x; else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.8e+90) || ~((x <= 3e+93))) tmp = x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.8e+90], N[Not[LessEqual[x, 3e+93]], $MachinePrecision]], x, N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+90} \lor \neg \left(x \leq 3 \cdot 10^{+93}\right):\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -5.8000000000000003e90 or 2.99999999999999978e93 < x Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites80.0%
if -5.8000000000000003e90 < x < 2.99999999999999978e93Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites84.5%
Taylor expanded in y around 0
Applied rewrites45.6%
Final simplification57.8%
(FPCore (x y z) :precision binary64 (if (<= z -3600000000.0) z (if (<= z 1.48e+103) x z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3600000000.0) {
tmp = z;
} else if (z <= 1.48e+103) {
tmp = x;
} else {
tmp = 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 <= (-3600000000.0d0)) then
tmp = z
else if (z <= 1.48d+103) then
tmp = x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3600000000.0) {
tmp = z;
} else if (z <= 1.48e+103) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3600000000.0: tmp = z elif z <= 1.48e+103: tmp = x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3600000000.0) tmp = z; elseif (z <= 1.48e+103) tmp = x; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3600000000.0) tmp = z; elseif (z <= 1.48e+103) tmp = x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3600000000.0], z, If[LessEqual[z, 1.48e+103], x, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3600000000:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 1.48 \cdot 10^{+103}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -3.6e9 or 1.48000000000000009e103 < z Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites83.5%
Taylor expanded in y around 0
Applied rewrites54.2%
if -3.6e9 < z < 1.48000000000000009e103Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites56.6%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites67.8%
(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 rewrites39.1%
herbie shell --seed 2025018
(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))))