
(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}
\\
x \cdot \cos y + z \cdot \sin y
\end{array}
Herbie found 7 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}
\\
x \cdot \cos y + z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma (cos y) x (* (sin y) z)))
double code(double x, double y, double z) {
return fma(cos(y), x, (sin(y) * z));
}
function code(x, y, z) return fma(cos(y), x, Float64(sin(y) * z)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * x + N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, x, \sin y \cdot z\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lower-fma.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (cos y) x))) (if (<= x -4.8e+70) t_0 (if (<= x 4.4e-10) (fma (sin y) z (* 1.0 x)) t_0))))
double code(double x, double y, double z) {
double t_0 = cos(y) * x;
double tmp;
if (x <= -4.8e+70) {
tmp = t_0;
} else if (x <= 4.4e-10) {
tmp = fma(sin(y), z, (1.0 * x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) * x) tmp = 0.0 if (x <= -4.8e+70) tmp = t_0; elseif (x <= 4.4e-10) tmp = fma(sin(y), z, Float64(1.0 * x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4.8e+70], t$95$0, If[LessEqual[x, 4.4e-10], N[(N[Sin[y], $MachinePrecision] * z + N[(1.0 * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot x\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, z, 1 \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.79999999999999974e70 or 4.3999999999999998e-10 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lift-cos.f6492.0
Applied rewrites92.0%
Taylor expanded in x around inf
lift-cos.f6461.1
Applied rewrites61.1%
if -4.79999999999999974e70 < x < 4.3999999999999998e-10Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites76.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f6476.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (cos y) x))) (if (<= x -2.2e-104) t_0 (if (<= x 7.8e-98) (* (sin y) z) t_0))))
double code(double x, double y, double z) {
double t_0 = cos(y) * x;
double tmp;
if (x <= -2.2e-104) {
tmp = t_0;
} else if (x <= 7.8e-98) {
tmp = sin(y) * z;
} 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) * x
if (x <= (-2.2d-104)) then
tmp = t_0
else if (x <= 7.8d-98) then
tmp = sin(y) * z
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) * x;
double tmp;
if (x <= -2.2e-104) {
tmp = t_0;
} else if (x <= 7.8e-98) {
tmp = Math.sin(y) * z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * x tmp = 0 if x <= -2.2e-104: tmp = t_0 elif x <= 7.8e-98: tmp = math.sin(y) * z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * x) tmp = 0.0 if (x <= -2.2e-104) tmp = t_0; elseif (x <= 7.8e-98) tmp = Float64(sin(y) * z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * x; tmp = 0.0; if (x <= -2.2e-104) tmp = t_0; elseif (x <= 7.8e-98) tmp = sin(y) * z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.2e-104], t$95$0, If[LessEqual[x, 7.8e-98], N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot x\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-98}:\\
\;\;\;\;\sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.20000000000000012e-104 or 7.79999999999999943e-98 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lift-cos.f6492.0
Applied rewrites92.0%
Taylor expanded in x around inf
lift-cos.f6461.1
Applied rewrites61.1%
if -2.20000000000000012e-104 < x < 7.79999999999999943e-98Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6440.4
Applied rewrites40.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)))
(if (<= y -13800000000000.0)
t_0
(if (<= y 0.115)
(fma (fma (fma -0.16666666666666666 (* z y) (* -0.5 x)) y z) y x)
t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double tmp;
if (y <= -13800000000000.0) {
tmp = t_0;
} else if (y <= 0.115) {
tmp = fma(fma(fma(-0.16666666666666666, (z * y), (-0.5 * x)), y, z), y, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) * z) tmp = 0.0 if (y <= -13800000000000.0) tmp = t_0; elseif (y <= 0.115) tmp = fma(fma(fma(-0.16666666666666666, Float64(z * y), Float64(-0.5 * x)), y, z), y, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -13800000000000.0], t$95$0, If[LessEqual[y, 0.115], N[(N[(N[(-0.16666666666666666 * N[(z * y), $MachinePrecision] + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision] * y + z), $MachinePrecision] * y + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
\mathbf{if}\;y \leq -13800000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.115:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, z \cdot y, -0.5 \cdot x\right), y, z\right), y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.38e13 or 0.115000000000000005 < y Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6440.4
Applied rewrites40.4%
if -1.38e13 < y < 0.115000000000000005Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
(FPCore (x y z) :precision binary64 (fma z y x))
double code(double x, double y, double z) {
return fma(z, y, x);
}
function code(x, y, z) return fma(z, y, x) end
code[x_, y_, z_] := N[(z * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, y, x\right)
\end{array}
Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.1
Applied rewrites52.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (- x)))) (if (<= x -1.3e-214) t_0 (if (<= x 1.45e-187) (* z y) t_0))))
double code(double x, double y, double z) {
double t_0 = -(-x);
double tmp;
if (x <= -1.3e-214) {
tmp = t_0;
} else if (x <= 1.45e-187) {
tmp = z * y;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = -(-x)
if (x <= (-1.3d-214)) then
tmp = t_0
else if (x <= 1.45d-187) then
tmp = z * y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -(-x);
double tmp;
if (x <= -1.3e-214) {
tmp = t_0;
} else if (x <= 1.45e-187) {
tmp = z * y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -(-x) tmp = 0 if x <= -1.3e-214: tmp = t_0 elif x <= 1.45e-187: tmp = z * y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-Float64(-x)) tmp = 0.0 if (x <= -1.3e-214) tmp = t_0; elseif (x <= 1.45e-187) tmp = Float64(z * y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -(-x); tmp = 0.0; if (x <= -1.3e-214) tmp = t_0; elseif (x <= 1.45e-187) tmp = z * y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = (-(-x))}, If[LessEqual[x, -1.3e-214], t$95$0, If[LessEqual[x, 1.45e-187], N[(z * y), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\left(-x\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-214}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-187}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.3e-214 or 1.44999999999999994e-187 < x Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.1
Applied rewrites52.1%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6450.4
Applied rewrites50.4%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6439.3
Applied rewrites39.3%
if -1.3e-214 < x < 1.44999999999999994e-187Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.1
Applied rewrites52.1%
Taylor expanded in x around 0
*-commutativeN/A
lift-*.f6416.5
Applied rewrites16.5%
(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 Float64(-Float64(-x)) end
function tmp = code(x, y, z) tmp = -(-x); end
code[x_, y_, z_] := (-(-x))
\begin{array}{l}
\\
-\left(-x\right)
\end{array}
Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.1
Applied rewrites52.1%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6450.4
Applied rewrites50.4%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6439.3
Applied rewrites39.3%
herbie shell --seed 2025130
(FPCore (x y z)
:name "Diagrams.ThreeD.Transform:aboutY from diagrams-lib-1.3.0.3"
:precision binary64
(+ (* x (cos y)) (* z (sin y))))