
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2), $MachinePrecision]), $MachinePrecision]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2), $MachinePrecision]), $MachinePrecision]
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
(FPCore (x y z) :precision binary64 (134-z0z1z2z3z4 (/ 1/2 y) y y (+ z x) (- z x)))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{\frac{1}{2}}{y}\right), y, y, \left(z + x\right), \left(z - x\right)\right)
Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112)
(* (+ (fabs y) (/ (* (+ x z) (- x z)) (fabs y))) 1/2)
(- (* (fabs y) 1/2) (/ z (/ (+ (fabs y) (fabs y)) z))))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 6.8e+196) {
tmp = (fabs(y) + (((x + z) * (x - z)) / fabs(y))) * 0.5;
} else {
tmp = (fabs(y) * 0.5) - (z / ((fabs(y) + fabs(y)) / z));
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 6.8e+196) {
tmp = (Math.abs(y) + (((x + z) * (x - z)) / Math.abs(y))) * 0.5;
} else {
tmp = (Math.abs(y) * 0.5) - (z / ((Math.abs(y) + Math.abs(y)) / z));
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 6.8e+196: tmp = (math.fabs(y) + (((x + z) * (x - z)) / math.fabs(y))) * 0.5 else: tmp = (math.fabs(y) * 0.5) - (z / ((math.fabs(y) + math.fabs(y)) / z)) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 6.8e+196) tmp = Float64(Float64(abs(y) + Float64(Float64(Float64(x + z) * Float64(x - z)) / abs(y))) * 0.5); else tmp = Float64(Float64(abs(y) * 0.5) - Float64(z / Float64(Float64(abs(y) + abs(y)) / z))); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 6.8e+196) tmp = (abs(y) + (((x + z) * (x - z)) / abs(y))) * 0.5; else tmp = (abs(y) * 0.5) - (z / ((abs(y) + abs(y)) / z)); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112], N[(N[(N[Abs[y], $MachinePrecision] + N[(N[(N[(x + z), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] * 1/2), $MachinePrecision] - N[(z / N[(N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112:\\
\;\;\;\;\left(\left|y\right| + \frac{\left(x + z\right) \cdot \left(x - z\right)}{\left|y\right|}\right) \cdot \frac{1}{2}\\
\mathbf{else}:\\
\;\;\;\;\left|y\right| \cdot \frac{1}{2} - \frac{z}{\frac{\left|y\right| + \left|y\right|}{z}}\\
\end{array}
if y < 6.8e196Initial program 68.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites88.9%
if 6.8e196 < y Initial program 68.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
add-to-fraction-revN/A
lower-+.f64N/A
lower-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.8%
Taylor expanded in x around 0
Applied rewrites67.6%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6467.6%
Applied rewrites67.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6467.6%
Applied rewrites67.6%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112)
(* (+ (fabs y) (/ (* (+ x z) (- x z)) (fabs y))) 1/2)
(- (* (fabs y) 1/2) (* (/ z (+ (fabs y) (fabs y))) z)))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 6.8e+196) {
tmp = (fabs(y) + (((x + z) * (x - z)) / fabs(y))) * 0.5;
} else {
tmp = (fabs(y) * 0.5) - ((z / (fabs(y) + fabs(y))) * z);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 6.8e+196) {
tmp = (Math.abs(y) + (((x + z) * (x - z)) / Math.abs(y))) * 0.5;
} else {
tmp = (Math.abs(y) * 0.5) - ((z / (Math.abs(y) + Math.abs(y))) * z);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 6.8e+196: tmp = (math.fabs(y) + (((x + z) * (x - z)) / math.fabs(y))) * 0.5 else: tmp = (math.fabs(y) * 0.5) - ((z / (math.fabs(y) + math.fabs(y))) * z) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 6.8e+196) tmp = Float64(Float64(abs(y) + Float64(Float64(Float64(x + z) * Float64(x - z)) / abs(y))) * 0.5); else tmp = Float64(Float64(abs(y) * 0.5) - Float64(Float64(z / Float64(abs(y) + abs(y))) * z)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 6.8e+196) tmp = (abs(y) + (((x + z) * (x - z)) / abs(y))) * 0.5; else tmp = (abs(y) * 0.5) - ((z / (abs(y) + abs(y))) * z); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112], N[(N[(N[Abs[y], $MachinePrecision] + N[(N[(N[(x + z), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] * 1/2), $MachinePrecision] - N[(N[(z / N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 67999999999999999997356342651593264772972582088995194366329756249849399718025586198815286776698430670817592209299575576165557411144388298946043864628100133467138359752110239654230651181165405274112:\\
\;\;\;\;\left(\left|y\right| + \frac{\left(x + z\right) \cdot \left(x - z\right)}{\left|y\right|}\right) \cdot \frac{1}{2}\\
\mathbf{else}:\\
\;\;\;\;\left|y\right| \cdot \frac{1}{2} - \frac{z}{\left|y\right| + \left|y\right|} \cdot z\\
\end{array}
if y < 6.8e196Initial program 68.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites88.9%
if 6.8e196 < y Initial program 68.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
add-to-fraction-revN/A
lower-+.f64N/A
lower-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.8%
Taylor expanded in x around 0
Applied rewrites67.6%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
1850000000000000033402373643528915459041328072999225067970158895561157806923972608)
(* -1/2 (* (- z x) (/ (+ z x) (fabs y))))
(- (* (fabs y) 1/2) (* (/ z (+ (fabs y) (fabs y))) z)))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 1.85e+81) {
tmp = -0.5 * ((z - x) * ((z + x) / fabs(y)));
} else {
tmp = (fabs(y) * 0.5) - ((z / (fabs(y) + fabs(y))) * z);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 1.85e+81) {
tmp = -0.5 * ((z - x) * ((z + x) / Math.abs(y)));
} else {
tmp = (Math.abs(y) * 0.5) - ((z / (Math.abs(y) + Math.abs(y))) * z);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 1.85e+81: tmp = -0.5 * ((z - x) * ((z + x) / math.fabs(y))) else: tmp = (math.fabs(y) * 0.5) - ((z / (math.fabs(y) + math.fabs(y))) * z) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 1.85e+81) tmp = Float64(-0.5 * Float64(Float64(z - x) * Float64(Float64(z + x) / abs(y)))); else tmp = Float64(Float64(abs(y) * 0.5) - Float64(Float64(z / Float64(abs(y) + abs(y))) * z)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 1.85e+81) tmp = -0.5 * ((z - x) * ((z + x) / abs(y))); else tmp = (abs(y) * 0.5) - ((z / (abs(y) + abs(y))) * z); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 1850000000000000033402373643528915459041328072999225067970158895561157806923972608], N[(-1/2 * N[(N[(z - x), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] * 1/2), $MachinePrecision] - N[(N[(z / N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 1850000000000000033402373643528915459041328072999225067970158895561157806923972608:\\
\;\;\;\;\frac{-1}{2} \cdot \left(\left(z - x\right) \cdot \frac{z + x}{\left|y\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|y\right| \cdot \frac{1}{2} - \frac{z}{\left|y\right| + \left|y\right|} \cdot z\\
\end{array}
if y < 1.85e81Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.1%
Applied rewrites66.1%
if 1.85e81 < y Initial program 68.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
add-to-fraction-revN/A
lower-+.f64N/A
lower-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites85.8%
Taylor expanded in x around 0
Applied rewrites67.6%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
11999999999999999830481025428570286999902722740524588088787880837518228612887567400960)
(* -1/2 (* (- z x) (/ (+ z x) (fabs y))))
(* 1/2 (fabs y)))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 1.2e+85) {
tmp = -0.5 * ((z - x) * ((z + x) / fabs(y)));
} else {
tmp = 0.5 * fabs(y);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 1.2e+85) {
tmp = -0.5 * ((z - x) * ((z + x) / Math.abs(y)));
} else {
tmp = 0.5 * Math.abs(y);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 1.2e+85: tmp = -0.5 * ((z - x) * ((z + x) / math.fabs(y))) else: tmp = 0.5 * math.fabs(y) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 1.2e+85) tmp = Float64(-0.5 * Float64(Float64(z - x) * Float64(Float64(z + x) / abs(y)))); else tmp = Float64(0.5 * abs(y)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 1.2e+85) tmp = -0.5 * ((z - x) * ((z + x) / abs(y))); else tmp = 0.5 * abs(y); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960], N[(-1/2 * N[(N[(z - x), $MachinePrecision] * N[(N[(z + x), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1/2 * N[Abs[y], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960:\\
\;\;\;\;\frac{-1}{2} \cdot \left(\left(z - x\right) \cdot \frac{z + x}{\left|y\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left|y\right|\\
\end{array}
if y < 1.2e85Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.1%
Applied rewrites66.1%
if 1.2e85 < y Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
11999999999999999830481025428570286999902722740524588088787880837518228612887567400960)
(/ (* (- x z) (+ z x)) (+ (fabs y) (fabs y)))
(* 1/2 (fabs y)))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 1.2e+85) {
tmp = ((x - z) * (z + x)) / (fabs(y) + fabs(y));
} else {
tmp = 0.5 * fabs(y);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 1.2e+85) {
tmp = ((x - z) * (z + x)) / (Math.abs(y) + Math.abs(y));
} else {
tmp = 0.5 * Math.abs(y);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 1.2e+85: tmp = ((x - z) * (z + x)) / (math.fabs(y) + math.fabs(y)) else: tmp = 0.5 * math.fabs(y) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 1.2e+85) tmp = Float64(Float64(Float64(x - z) * Float64(z + x)) / Float64(abs(y) + abs(y))); else tmp = Float64(0.5 * abs(y)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 1.2e+85) tmp = ((x - z) * (z + x)) / (abs(y) + abs(y)); else tmp = 0.5 * abs(y); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960], N[(N[(N[(x - z), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[y], $MachinePrecision] + N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1/2 * N[Abs[y], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960:\\
\;\;\;\;\frac{\left(x - z\right) \cdot \left(z + x\right)}{\left|y\right| + \left|y\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left|y\right|\\
\end{array}
if y < 1.2e85Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval68.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6473.5%
Applied rewrites73.5%
Taylor expanded in y around 0
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2N/A
lift-+.f64N/A
mult-flip-revN/A
lower-/.f6460.7%
Applied rewrites60.7%
if 1.2e85 < y Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs z) (fabs x))))
(*
(copysign 1 y)
(if (<=
(fabs y)
1162941958872971/726838724295606890549323807888004534353641360687318060281490199180639288113397923326191050713763565560762521606266177933534601628614656)
(* (* (/ t_0 (fabs y)) (fabs z)) -1/2)
(if (<=
(fabs y)
11999999999999999830481025428570286999902722740524588088787880837518228612887567400960)
(* -1/2 (* t_0 (/ (fabs x) (fabs y))))
(* 1/2 (fabs y)))))))double code(double x, double y, double z) {
double t_0 = fabs(z) - fabs(x);
double tmp;
if (fabs(y) <= 1.6e-120) {
tmp = ((t_0 / fabs(y)) * fabs(z)) * -0.5;
} else if (fabs(y) <= 1.2e+85) {
tmp = -0.5 * (t_0 * (fabs(x) / fabs(y)));
} else {
tmp = 0.5 * fabs(y);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(z) - Math.abs(x);
double tmp;
if (Math.abs(y) <= 1.6e-120) {
tmp = ((t_0 / Math.abs(y)) * Math.abs(z)) * -0.5;
} else if (Math.abs(y) <= 1.2e+85) {
tmp = -0.5 * (t_0 * (Math.abs(x) / Math.abs(y)));
} else {
tmp = 0.5 * Math.abs(y);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): t_0 = math.fabs(z) - math.fabs(x) tmp = 0 if math.fabs(y) <= 1.6e-120: tmp = ((t_0 / math.fabs(y)) * math.fabs(z)) * -0.5 elif math.fabs(y) <= 1.2e+85: tmp = -0.5 * (t_0 * (math.fabs(x) / math.fabs(y))) else: tmp = 0.5 * math.fabs(y) return math.copysign(1.0, y) * tmp
function code(x, y, z) t_0 = Float64(abs(z) - abs(x)) tmp = 0.0 if (abs(y) <= 1.6e-120) tmp = Float64(Float64(Float64(t_0 / abs(y)) * abs(z)) * -0.5); elseif (abs(y) <= 1.2e+85) tmp = Float64(-0.5 * Float64(t_0 * Float64(abs(x) / abs(y)))); else tmp = Float64(0.5 * abs(y)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) t_0 = abs(z) - abs(x); tmp = 0.0; if (abs(y) <= 1.6e-120) tmp = ((t_0 / abs(y)) * abs(z)) * -0.5; elseif (abs(y) <= 1.2e+85) tmp = -0.5 * (t_0 * (abs(x) / abs(y))); else tmp = 0.5 * abs(y); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[z], $MachinePrecision] - N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 1162941958872971/726838724295606890549323807888004534353641360687318060281490199180639288113397923326191050713763565560762521606266177933534601628614656], N[(N[(N[(t$95$0 / N[Abs[y], $MachinePrecision]), $MachinePrecision] * N[Abs[z], $MachinePrecision]), $MachinePrecision] * -1/2), $MachinePrecision], If[LessEqual[N[Abs[y], $MachinePrecision], 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960], N[(-1/2 * N[(t$95$0 * N[(N[Abs[x], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1/2 * N[Abs[y], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|z\right| - \left|x\right|\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq \frac{1162941958872971}{726838724295606890549323807888004534353641360687318060281490199180639288113397923326191050713763565560762521606266177933534601628614656}:\\
\;\;\;\;\left(\frac{t\_0}{\left|y\right|} \cdot \left|z\right|\right) \cdot \frac{-1}{2}\\
\mathbf{elif}\;\left|y\right| \leq 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960:\\
\;\;\;\;\frac{-1}{2} \cdot \left(t\_0 \cdot \frac{\left|x\right|}{\left|y\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left|y\right|\\
\end{array}
\end{array}
if y < 1.6e-120Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
Taylor expanded in x around 0
Applied rewrites35.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.8%
Applied rewrites39.8%
if 1.6e-120 < y < 1.2e85Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.1%
Applied rewrites66.1%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if 1.2e85 < y Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (fabs z) (fabs x))))
(*
(copysign 1 y)
(if (<=
(fabs y)
1804760880651433/97554642197374757230674913431036447054643691958280348464348654988292866838117675628759565720734124098744591597543956965482749239977758915821568)
(* -1/2 (/ (* (fabs z) t_0) (fabs y)))
(if (<=
(fabs y)
11999999999999999830481025428570286999902722740524588088787880837518228612887567400960)
(* -1/2 (* t_0 (/ (fabs x) (fabs y))))
(* 1/2 (fabs y)))))))double code(double x, double y, double z) {
double t_0 = fabs(z) - fabs(x);
double tmp;
if (fabs(y) <= 1.85e-128) {
tmp = -0.5 * ((fabs(z) * t_0) / fabs(y));
} else if (fabs(y) <= 1.2e+85) {
tmp = -0.5 * (t_0 * (fabs(x) / fabs(y)));
} else {
tmp = 0.5 * fabs(y);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(z) - Math.abs(x);
double tmp;
if (Math.abs(y) <= 1.85e-128) {
tmp = -0.5 * ((Math.abs(z) * t_0) / Math.abs(y));
} else if (Math.abs(y) <= 1.2e+85) {
tmp = -0.5 * (t_0 * (Math.abs(x) / Math.abs(y)));
} else {
tmp = 0.5 * Math.abs(y);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): t_0 = math.fabs(z) - math.fabs(x) tmp = 0 if math.fabs(y) <= 1.85e-128: tmp = -0.5 * ((math.fabs(z) * t_0) / math.fabs(y)) elif math.fabs(y) <= 1.2e+85: tmp = -0.5 * (t_0 * (math.fabs(x) / math.fabs(y))) else: tmp = 0.5 * math.fabs(y) return math.copysign(1.0, y) * tmp
function code(x, y, z) t_0 = Float64(abs(z) - abs(x)) tmp = 0.0 if (abs(y) <= 1.85e-128) tmp = Float64(-0.5 * Float64(Float64(abs(z) * t_0) / abs(y))); elseif (abs(y) <= 1.2e+85) tmp = Float64(-0.5 * Float64(t_0 * Float64(abs(x) / abs(y)))); else tmp = Float64(0.5 * abs(y)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) t_0 = abs(z) - abs(x); tmp = 0.0; if (abs(y) <= 1.85e-128) tmp = -0.5 * ((abs(z) * t_0) / abs(y)); elseif (abs(y) <= 1.2e+85) tmp = -0.5 * (t_0 * (abs(x) / abs(y))); else tmp = 0.5 * abs(y); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[z], $MachinePrecision] - N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 1804760880651433/97554642197374757230674913431036447054643691958280348464348654988292866838117675628759565720734124098744591597543956965482749239977758915821568], N[(-1/2 * N[(N[(N[Abs[z], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[y], $MachinePrecision], 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960], N[(-1/2 * N[(t$95$0 * N[(N[Abs[x], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1/2 * N[Abs[y], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|z\right| - \left|x\right|\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq \frac{1804760880651433}{97554642197374757230674913431036447054643691958280348464348654988292866838117675628759565720734124098744591597543956965482749239977758915821568}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{\left|z\right| \cdot t\_0}{\left|y\right|}\\
\mathbf{elif}\;\left|y\right| \leq 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960:\\
\;\;\;\;\frac{-1}{2} \cdot \left(t\_0 \cdot \frac{\left|x\right|}{\left|y\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left|y\right|\\
\end{array}
\end{array}
if y < 1.85e-128Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
Taylor expanded in x around 0
Applied rewrites35.1%
if 1.85e-128 < y < 1.2e85Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.1%
Applied rewrites66.1%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if 1.2e85 < y Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
(FPCore (x y z)
:precision binary64
(*
(copysign 1 y)
(if (<=
(fabs y)
11999999999999999830481025428570286999902722740524588088787880837518228612887567400960)
(* -1/2 (* (- (fabs z) (fabs x)) (/ (fabs x) (fabs y))))
(* 1/2 (fabs y)))))double code(double x, double y, double z) {
double tmp;
if (fabs(y) <= 1.2e+85) {
tmp = -0.5 * ((fabs(z) - fabs(x)) * (fabs(x) / fabs(y)));
} else {
tmp = 0.5 * fabs(y);
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(y) <= 1.2e+85) {
tmp = -0.5 * ((Math.abs(z) - Math.abs(x)) * (Math.abs(x) / Math.abs(y)));
} else {
tmp = 0.5 * Math.abs(y);
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(y) <= 1.2e+85: tmp = -0.5 * ((math.fabs(z) - math.fabs(x)) * (math.fabs(x) / math.fabs(y))) else: tmp = 0.5 * math.fabs(y) return math.copysign(1.0, y) * tmp
function code(x, y, z) tmp = 0.0 if (abs(y) <= 1.2e+85) tmp = Float64(-0.5 * Float64(Float64(abs(z) - abs(x)) * Float64(abs(x) / abs(y)))); else tmp = Float64(0.5 * abs(y)); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(y) <= 1.2e+85) tmp = -0.5 * ((abs(z) - abs(x)) * (abs(x) / abs(y))); else tmp = 0.5 * abs(y); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[y], $MachinePrecision], 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960], N[(-1/2 * N[(N[(N[Abs[z], $MachinePrecision] - N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1/2 * N[Abs[y], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|y\right| \leq 11999999999999999830481025428570286999902722740524588088787880837518228612887567400960:\\
\;\;\;\;\frac{-1}{2} \cdot \left(\left(\left|z\right| - \left|x\right|\right) \cdot \frac{\left|x\right|}{\left|y\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left|y\right|\\
\end{array}
if y < 1.2e85Initial program 68.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
add-flipN/A
lift-*.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
lower-134-z0z1z2z3z4N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-evalN/A
lower-+.f64N/A
lower--.f6499.8%
Applied rewrites99.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f6460.7%
Applied rewrites60.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.1%
Applied rewrites66.1%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if 1.2e85 < y Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
(FPCore (x y z) :precision binary64 (* 1/2 y))
double code(double x, double y, double z) {
return 0.5 * 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 = 0.5d0 * y
end function
public static double code(double x, double y, double z) {
return 0.5 * y;
}
def code(x, y, z): return 0.5 * y
function code(x, y, z) return Float64(0.5 * y) end
function tmp = code(x, y, z) tmp = 0.5 * y; end
code[x_, y_, z_] := N[(1/2 * y), $MachinePrecision]
\frac{1}{2} \cdot y
Initial program 68.5%
Taylor expanded in y around inf
lower-*.f6435.5%
Applied rewrites35.5%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2)))