
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) (PI)))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) (PI)))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
:precision binary64
(if (<= x-scale_m 1.95e+201)
(*
(/ (* b a) y-scale)
(/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
(/
(* (pow (* a b) 2.0) (/ (/ -4.0 y-scale) x-scale_m))
(* y-scale x-scale_m))))x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 1.95e+201) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = (pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m);
}
return tmp;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (x_45scale_m <= 1.95d+201) then
tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
else
tmp = (((a * b) ** 2.0d0) * (((-4.0d0) / y_45scale) / x_45scale_m)) / (y_45scale * x_45scale_m)
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 1.95e+201) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = (Math.pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): tmp = 0 if x_45_scale_m <= 1.95e+201: tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m) else: tmp = (math.pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m) return tmp
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0 if (x_45_scale_m <= 1.95e+201) tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m)); else tmp = Float64(Float64((Float64(a * b) ^ 2.0) * Float64(Float64(-4.0 / y_45_scale) / x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m)); end return tmp end
x-scale_m = abs(x_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0; if (x_45_scale_m <= 1.95e+201) tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m); else tmp = (((a * b) ^ 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 1.95e+201], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(-4.0 / y$45$scale), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\
\;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(a \cdot b\right)}^{2} \cdot \frac{\frac{-4}{y-scale}}{x-scale\_m}}{y-scale \cdot x-scale\_m}\\
\end{array}
\end{array}
if x-scale < 1.95e201Initial program 25.2%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6455.4
Applied rewrites55.4%
Applied rewrites86.4%
Applied rewrites89.3%
Applied rewrites94.0%
if 1.95e201 < x-scale Initial program 14.1%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6437.2
Applied rewrites37.2%
Applied rewrites65.2%
Applied rewrites77.5%
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
:precision binary64
(if (<= x-scale_m 1.95e+201)
(*
(/ (* b a) y-scale)
(/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
(/
(/ (* (pow (* a b) 2.0) -4.0) (* y-scale x-scale_m))
(* y-scale x-scale_m))))x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 1.95e+201) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = ((pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m);
}
return tmp;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (x_45scale_m <= 1.95d+201) then
tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
else
tmp = ((((a * b) ** 2.0d0) * (-4.0d0)) / (y_45scale * x_45scale_m)) / (y_45scale * x_45scale_m)
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 1.95e+201) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = ((Math.pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): tmp = 0 if x_45_scale_m <= 1.95e+201: tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m) else: tmp = ((math.pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m) return tmp
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0 if (x_45_scale_m <= 1.95e+201) tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m)); else tmp = Float64(Float64(Float64((Float64(a * b) ^ 2.0) * -4.0) / Float64(y_45_scale * x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m)); end return tmp end
x-scale_m = abs(x_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0; if (x_45_scale_m <= 1.95e+201) tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m); else tmp = ((((a * b) ^ 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 1.95e+201], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision] * -4.0), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\
\;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{\left(a \cdot b\right)}^{2} \cdot -4}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\\
\end{array}
\end{array}
if x-scale < 1.95e201Initial program 25.2%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6455.4
Applied rewrites55.4%
Applied rewrites86.4%
Applied rewrites89.3%
Applied rewrites94.0%
if 1.95e201 < x-scale Initial program 14.1%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6437.2
Applied rewrites37.2%
Applied rewrites65.2%
Applied rewrites77.4%
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
:precision binary64
(if (<= x-scale_m 7.5e+241)
(*
(/ (* b a) y-scale)
(/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
(/
(* (* (* a b) (/ (* a b) x-scale_m)) -4.0)
(* (* y-scale x-scale_m) y-scale))))x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 7.5e+241) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale);
}
return tmp;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (x_45scale_m <= 7.5d+241) then
tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
else
tmp = (((a * b) * ((a * b) / x_45scale_m)) * (-4.0d0)) / ((y_45scale * x_45scale_m) * y_45scale)
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (x_45_scale_m <= 7.5e+241) {
tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
} else {
tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): tmp = 0 if x_45_scale_m <= 7.5e+241: tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m) else: tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale) return tmp
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0 if (x_45_scale_m <= 7.5e+241) tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m)); else tmp = Float64(Float64(Float64(Float64(a * b) * Float64(Float64(a * b) / x_45_scale_m)) * -4.0) / Float64(Float64(y_45_scale * x_45_scale_m) * y_45_scale)); end return tmp end
x-scale_m = abs(x_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0; if (x_45_scale_m <= 7.5e+241) tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m); else tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 7.5e+241], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a * b), $MachinePrecision] * N[(N[(a * b), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale$95$m), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 7.5 \cdot 10^{+241}:\\
\;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale\_m}\right) \cdot -4}{\left(y-scale \cdot x-scale\_m\right) \cdot y-scale}\\
\end{array}
\end{array}
if x-scale < 7.5000000000000001e241Initial program 24.9%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6454.7
Applied rewrites54.7%
Applied rewrites85.7%
Applied rewrites88.4%
Applied rewrites93.1%
if 7.5000000000000001e241 < x-scale Initial program 14.1%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6441.2
Applied rewrites41.2%
Applied rewrites67.0%
Applied rewrites81.5%
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
:precision binary64
(if (or (<= b 4.6e-126) (not (<= b 2.2e+126)))
(*
(/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m))
b)
(*
(/ (* -4.0 (* a a)) (* (* y-scale x-scale_m) (* y-scale x-scale_m)))
(* b b))))x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if ((b <= 4.6e-126) || !(b <= 2.2e+126)) {
tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
} else {
tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b);
}
return tmp;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
real(8) :: tmp
if ((b <= 4.6d-126) .or. (.not. (b <= 2.2d+126))) then
tmp = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
else
tmp = (((-4.0d0) * (a * a)) / ((y_45scale * x_45scale_m) * (y_45scale * x_45scale_m))) * (b * b)
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if ((b <= 4.6e-126) || !(b <= 2.2e+126)) {
tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
} else {
tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): tmp = 0 if (b <= 4.6e-126) or not (b <= 2.2e+126): tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b else: tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b) return tmp
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0 if ((b <= 4.6e-126) || !(b <= 2.2e+126)) tmp = Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b); else tmp = Float64(Float64(Float64(-4.0 * Float64(a * a)) / Float64(Float64(y_45_scale * x_45_scale_m) * Float64(y_45_scale * x_45_scale_m))) * Float64(b * b)); end return tmp end
x-scale_m = abs(x_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0; if ((b <= 4.6e-126) || ~((b <= 2.2e+126))) tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b; else tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[Or[LessEqual[b, 4.6e-126], N[Not[LessEqual[b, 2.2e+126]], $MachinePrecision]], N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale$95$m), $MachinePrecision] * N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.6 \cdot 10^{-126} \lor \neg \left(b \leq 2.2 \cdot 10^{+126}\right):\\
\;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\_m\right) \cdot \left(y-scale \cdot x-scale\_m\right)} \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if b < 4.60000000000000021e-126 or 2.19999999999999999e126 < b Initial program 20.8%
Taylor expanded in b around 0
Applied rewrites45.3%
Taylor expanded in angle around 0
Applied rewrites59.6%
Applied rewrites75.7%
Taylor expanded in angle around 0
Applied rewrites66.4%
if 4.60000000000000021e-126 < b < 2.19999999999999999e126Initial program 35.4%
Taylor expanded in b around 0
Applied rewrites64.4%
Taylor expanded in angle around 0
Applied rewrites82.4%
Final simplification70.2%
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
:precision binary64
(if (<= b 4.6e-173)
(*
(/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m))
b)
(*
(* (/ (* -4.0 a) (* y-scale x-scale_m)) (/ a (* y-scale x-scale_m)))
(* b b))))x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (b <= 4.6e-173) {
tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
} else {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b);
}
return tmp;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (b <= 4.6d-173) then
tmp = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
else
tmp = ((((-4.0d0) * a) / (y_45scale * x_45scale_m)) * (a / (y_45scale * x_45scale_m))) * (b * b)
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
double tmp;
if (b <= 4.6e-173) {
tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
} else {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): tmp = 0 if b <= 4.6e-173: tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b else: tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b) return tmp
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0 if (b <= 4.6e-173) tmp = Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b); else tmp = Float64(Float64(Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale_m)) * Float64(a / Float64(y_45_scale * x_45_scale_m))) * Float64(b * b)); end return tmp end
x-scale_m = abs(x_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = 0.0; if (b <= 4.6e-173) tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b; else tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[b, 4.6e-173], N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.6 \cdot 10^{-173}:\\
\;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-4 \cdot a}{y-scale \cdot x-scale\_m} \cdot \frac{a}{y-scale \cdot x-scale\_m}\right) \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if b < 4.59999999999999976e-173Initial program 24.0%
Taylor expanded in b around 0
Applied rewrites45.1%
Taylor expanded in angle around 0
Applied rewrites61.1%
Applied rewrites75.9%
Taylor expanded in angle around 0
Applied rewrites66.3%
if 4.59999999999999976e-173 < b Initial program 24.6%
Taylor expanded in b around 0
Applied rewrites57.3%
Taylor expanded in angle around 0
Applied rewrites71.2%
Applied rewrites84.1%
x-scale_m = (fabs.f64 x-scale) (FPCore (a b angle x-scale_m y-scale) :precision binary64 (/ (* (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) (* b a)) (* y-scale x-scale_m)))
x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m);
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
code = ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) * (b * a)) / (y_45scale * x_45scale_m)
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m);
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m)
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) return Float64(Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) * Float64(b * a)) / Float64(y_45_scale * x_45_scale_m)) end
x-scale_m = abs(x_45_scale); function tmp = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m); end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\frac{\left(\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}\right) \cdot \left(b \cdot a\right)}{y-scale \cdot x-scale\_m}
\end{array}
Initial program 24.2%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6453.9
Applied rewrites53.9%
Applied rewrites84.6%
Applied rewrites87.7%
Applied rewrites91.2%
x-scale_m = (fabs.f64 x-scale) (FPCore (a b angle x-scale_m y-scale) :precision binary64 (* (* b a) (/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) (* y-scale x-scale_m))))
x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m));
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
code = (b * a) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / (y_45scale * x_45scale_m))
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m));
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m))
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) return Float64(Float64(b * a) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m))) end
x-scale_m = abs(x_45_scale); function tmp = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m)); end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(b * a), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\left(b \cdot a\right) \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{y-scale \cdot x-scale\_m}
\end{array}
Initial program 24.2%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6453.9
Applied rewrites53.9%
Applied rewrites84.6%
Applied rewrites87.7%
Applied rewrites91.0%
x-scale_m = (fabs.f64 x-scale) (FPCore (a b angle x-scale_m y-scale) :precision binary64 (* (* (* (* -4.0 a) (/ (/ a (* y-scale x-scale_m)) (* y-scale x-scale_m))) b) b))
x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
code = ((((-4.0d0) * a) * ((a / (y_45scale * x_45scale_m)) / (y_45scale * x_45scale_m))) * b) * b
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) return Float64(Float64(Float64(Float64(-4.0 * a) * Float64(Float64(a / Float64(y_45_scale * x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m))) * b) * b) end
x-scale_m = abs(x_45_scale); function tmp = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(-4.0 * a), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\left(\left(\left(-4 \cdot a\right) \cdot \frac{\frac{a}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\right) \cdot b\right) \cdot b
\end{array}
Initial program 24.2%
Taylor expanded in b around 0
Applied rewrites49.8%
Taylor expanded in angle around 0
Applied rewrites65.0%
Applied rewrites79.2%
Applied rewrites84.6%
x-scale_m = (fabs.f64 x-scale) (FPCore (a b angle x-scale_m y-scale) :precision binary64 (* (/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m)) b))
x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
}
x-scale_m = private
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(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale
code = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
}
x-scale_m = math.fabs(x_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale): return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b
x-scale_m = abs(x_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale) return Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b) end
x-scale_m = abs(x_45_scale); function tmp = code(a, b, angle, x_45_scale_m, y_45_scale) tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b
\end{array}
Initial program 24.2%
Taylor expanded in b around 0
Applied rewrites49.8%
Taylor expanded in angle around 0
Applied rewrites65.0%
Applied rewrites79.2%
Taylor expanded in angle around 0
Applied rewrites66.7%
herbie shell --seed 2025010
(FPCore (a b angle x-scale y-scale)
:name "Simplification of discriminant from scale-rotated-ellipse"
:precision binary64
(- (* (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale) (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale)) (* (* 4.0 (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)) x-scale) x-scale)) (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (sin (* (/ angle 180.0) (PI)))) 2.0)) y-scale) y-scale))))