
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1)) (sqrt x)) (- (sqrt (+ y 1)) (sqrt y))) (- (sqrt (+ z 1)) (sqrt z))) (- (sqrt (+ t 1)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1)) (sqrt x)) (- (sqrt (+ y 1)) (sqrt y))) (- (sqrt (+ z 1)) (sqrt z))) (- (sqrt (+ t 1)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin y (fmax x z)))
(t_2 (fmax (fmin x z) t))
(t_3 (fmin (fmin x z) t))
(t_4 (sqrt t_3))
(t_5 (fmax y (fmax x z)))
(t_6 (fmax t_1 t_2))
(t_7 (fmin t_5 t_6))
(t_8 (fmax t_5 t_6))
(t_9 (sqrt t_8))
(t_10 (- t_8 -1))
(t_11 (fmin t_1 t_2))
(t_12 (sqrt (+ 1 t_11)))
(t_13 (sqrt t_11))
(t_14 (+ t_13 t_12))
(t_15 (* (+ t_4 (sqrt (+ 1 t_3))) t_14)))
(if (<= t_7 220000000)
(-
(- (sqrt (- t_3 -1)) t_4)
(-
(- t_13 (sqrt (- t_11 -1)))
(-
(- (sqrt (- t_7 -1)) (sqrt t_7))
(/ (- t_8 t_10) (+ (sqrt t_10) t_9)))))
(+
(+
(* 1/2 (/ 1 (* t_7 (sqrt (/ 1 t_7)))))
(+ (/ 1 t_14) (+ (/ t_13 t_15) (/ t_12 t_15))))
(- (sqrt (+ t_8 1)) t_9)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(y, fmax(x, z));
double t_2 = fmax(fmin(x, z), t);
double t_3 = fmin(fmin(x, z), t);
double t_4 = sqrt(t_3);
double t_5 = fmax(y, fmax(x, z));
double t_6 = fmax(t_1, t_2);
double t_7 = fmin(t_5, t_6);
double t_8 = fmax(t_5, t_6);
double t_9 = sqrt(t_8);
double t_10 = t_8 - -1.0;
double t_11 = fmin(t_1, t_2);
double t_12 = sqrt((1.0 + t_11));
double t_13 = sqrt(t_11);
double t_14 = t_13 + t_12;
double t_15 = (t_4 + sqrt((1.0 + t_3))) * t_14;
double tmp;
if (t_7 <= 220000000.0) {
tmp = (sqrt((t_3 - -1.0)) - t_4) - ((t_13 - sqrt((t_11 - -1.0))) - ((sqrt((t_7 - -1.0)) - sqrt(t_7)) - ((t_8 - t_10) / (sqrt(t_10) + t_9))));
} else {
tmp = ((0.5 * (1.0 / (t_7 * sqrt((1.0 / t_7))))) + ((1.0 / t_14) + ((t_13 / t_15) + (t_12 / t_15)))) + (sqrt((t_8 + 1.0)) - t_9);
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_14
real(8) :: t_15
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(y, fmax(x, z))
t_2 = fmax(fmin(x, z), t)
t_3 = fmin(fmin(x, z), t)
t_4 = sqrt(t_3)
t_5 = fmax(y, fmax(x, z))
t_6 = fmax(t_1, t_2)
t_7 = fmin(t_5, t_6)
t_8 = fmax(t_5, t_6)
t_9 = sqrt(t_8)
t_10 = t_8 - (-1.0d0)
t_11 = fmin(t_1, t_2)
t_12 = sqrt((1.0d0 + t_11))
t_13 = sqrt(t_11)
t_14 = t_13 + t_12
t_15 = (t_4 + sqrt((1.0d0 + t_3))) * t_14
if (t_7 <= 220000000.0d0) then
tmp = (sqrt((t_3 - (-1.0d0))) - t_4) - ((t_13 - sqrt((t_11 - (-1.0d0)))) - ((sqrt((t_7 - (-1.0d0))) - sqrt(t_7)) - ((t_8 - t_10) / (sqrt(t_10) + t_9))))
else
tmp = ((0.5d0 * (1.0d0 / (t_7 * sqrt((1.0d0 / t_7))))) + ((1.0d0 / t_14) + ((t_13 / t_15) + (t_12 / t_15)))) + (sqrt((t_8 + 1.0d0)) - t_9)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(y, fmax(x, z));
double t_2 = fmax(fmin(x, z), t);
double t_3 = fmin(fmin(x, z), t);
double t_4 = Math.sqrt(t_3);
double t_5 = fmax(y, fmax(x, z));
double t_6 = fmax(t_1, t_2);
double t_7 = fmin(t_5, t_6);
double t_8 = fmax(t_5, t_6);
double t_9 = Math.sqrt(t_8);
double t_10 = t_8 - -1.0;
double t_11 = fmin(t_1, t_2);
double t_12 = Math.sqrt((1.0 + t_11));
double t_13 = Math.sqrt(t_11);
double t_14 = t_13 + t_12;
double t_15 = (t_4 + Math.sqrt((1.0 + t_3))) * t_14;
double tmp;
if (t_7 <= 220000000.0) {
tmp = (Math.sqrt((t_3 - -1.0)) - t_4) - ((t_13 - Math.sqrt((t_11 - -1.0))) - ((Math.sqrt((t_7 - -1.0)) - Math.sqrt(t_7)) - ((t_8 - t_10) / (Math.sqrt(t_10) + t_9))));
} else {
tmp = ((0.5 * (1.0 / (t_7 * Math.sqrt((1.0 / t_7))))) + ((1.0 / t_14) + ((t_13 / t_15) + (t_12 / t_15)))) + (Math.sqrt((t_8 + 1.0)) - t_9);
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(y, fmax(x, z)) t_2 = fmax(fmin(x, z), t) t_3 = fmin(fmin(x, z), t) t_4 = math.sqrt(t_3) t_5 = fmax(y, fmax(x, z)) t_6 = fmax(t_1, t_2) t_7 = fmin(t_5, t_6) t_8 = fmax(t_5, t_6) t_9 = math.sqrt(t_8) t_10 = t_8 - -1.0 t_11 = fmin(t_1, t_2) t_12 = math.sqrt((1.0 + t_11)) t_13 = math.sqrt(t_11) t_14 = t_13 + t_12 t_15 = (t_4 + math.sqrt((1.0 + t_3))) * t_14 tmp = 0 if t_7 <= 220000000.0: tmp = (math.sqrt((t_3 - -1.0)) - t_4) - ((t_13 - math.sqrt((t_11 - -1.0))) - ((math.sqrt((t_7 - -1.0)) - math.sqrt(t_7)) - ((t_8 - t_10) / (math.sqrt(t_10) + t_9)))) else: tmp = ((0.5 * (1.0 / (t_7 * math.sqrt((1.0 / t_7))))) + ((1.0 / t_14) + ((t_13 / t_15) + (t_12 / t_15)))) + (math.sqrt((t_8 + 1.0)) - t_9) return tmp
function code(x, y, z, t) t_1 = fmin(y, fmax(x, z)) t_2 = fmax(fmin(x, z), t) t_3 = fmin(fmin(x, z), t) t_4 = sqrt(t_3) t_5 = fmax(y, fmax(x, z)) t_6 = fmax(t_1, t_2) t_7 = fmin(t_5, t_6) t_8 = fmax(t_5, t_6) t_9 = sqrt(t_8) t_10 = Float64(t_8 - -1.0) t_11 = fmin(t_1, t_2) t_12 = sqrt(Float64(1.0 + t_11)) t_13 = sqrt(t_11) t_14 = Float64(t_13 + t_12) t_15 = Float64(Float64(t_4 + sqrt(Float64(1.0 + t_3))) * t_14) tmp = 0.0 if (t_7 <= 220000000.0) tmp = Float64(Float64(sqrt(Float64(t_3 - -1.0)) - t_4) - Float64(Float64(t_13 - sqrt(Float64(t_11 - -1.0))) - Float64(Float64(sqrt(Float64(t_7 - -1.0)) - sqrt(t_7)) - Float64(Float64(t_8 - t_10) / Float64(sqrt(t_10) + t_9))))); else tmp = Float64(Float64(Float64(0.5 * Float64(1.0 / Float64(t_7 * sqrt(Float64(1.0 / t_7))))) + Float64(Float64(1.0 / t_14) + Float64(Float64(t_13 / t_15) + Float64(t_12 / t_15)))) + Float64(sqrt(Float64(t_8 + 1.0)) - t_9)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(y, max(x, z)); t_2 = max(min(x, z), t); t_3 = min(min(x, z), t); t_4 = sqrt(t_3); t_5 = max(y, max(x, z)); t_6 = max(t_1, t_2); t_7 = min(t_5, t_6); t_8 = max(t_5, t_6); t_9 = sqrt(t_8); t_10 = t_8 - -1.0; t_11 = min(t_1, t_2); t_12 = sqrt((1.0 + t_11)); t_13 = sqrt(t_11); t_14 = t_13 + t_12; t_15 = (t_4 + sqrt((1.0 + t_3))) * t_14; tmp = 0.0; if (t_7 <= 220000000.0) tmp = (sqrt((t_3 - -1.0)) - t_4) - ((t_13 - sqrt((t_11 - -1.0))) - ((sqrt((t_7 - -1.0)) - sqrt(t_7)) - ((t_8 - t_10) / (sqrt(t_10) + t_9)))); else tmp = ((0.5 * (1.0 / (t_7 * sqrt((1.0 / t_7))))) + ((1.0 / t_14) + ((t_13 / t_15) + (t_12 / t_15)))) + (sqrt((t_8 + 1.0)) - t_9); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[y, N[Max[x, z], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[x, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Min[x, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Max[y, N[Max[x, z], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[Max[t$95$1, t$95$2], $MachinePrecision]}, Block[{t$95$7 = N[Min[t$95$5, t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$5, t$95$6], $MachinePrecision]}, Block[{t$95$9 = N[Sqrt[t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[(t$95$8 - -1), $MachinePrecision]}, Block[{t$95$11 = N[Min[t$95$1, t$95$2], $MachinePrecision]}, Block[{t$95$12 = N[Sqrt[N[(1 + t$95$11), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[t$95$11], $MachinePrecision]}, Block[{t$95$14 = N[(t$95$13 + t$95$12), $MachinePrecision]}, Block[{t$95$15 = N[(N[(t$95$4 + N[Sqrt[N[(1 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$14), $MachinePrecision]}, If[LessEqual[t$95$7, 220000000], N[(N[(N[Sqrt[N[(t$95$3 - -1), $MachinePrecision]], $MachinePrecision] - t$95$4), $MachinePrecision] - N[(N[(t$95$13 - N[Sqrt[N[(t$95$11 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[N[(t$95$7 - -1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$7], $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$8 - t$95$10), $MachinePrecision] / N[(N[Sqrt[t$95$10], $MachinePrecision] + t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1/2 * N[(1 / N[(t$95$7 * N[Sqrt[N[(1 / t$95$7), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1 / t$95$14), $MachinePrecision] + N[(N[(t$95$13 / t$95$15), $MachinePrecision] + N[(t$95$12 / t$95$15), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$8 + 1), $MachinePrecision]], $MachinePrecision] - t$95$9), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(y, \mathsf{max}\left(x, z\right)\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(x, z\right), t\right)\\
t_3 := \mathsf{min}\left(\mathsf{min}\left(x, z\right), t\right)\\
t_4 := \sqrt{t\_3}\\
t_5 := \mathsf{max}\left(y, \mathsf{max}\left(x, z\right)\right)\\
t_6 := \mathsf{max}\left(t\_1, t\_2\right)\\
t_7 := \mathsf{min}\left(t\_5, t\_6\right)\\
t_8 := \mathsf{max}\left(t\_5, t\_6\right)\\
t_9 := \sqrt{t\_8}\\
t_10 := t\_8 - -1\\
t_11 := \mathsf{min}\left(t\_1, t\_2\right)\\
t_12 := \sqrt{1 + t\_11}\\
t_13 := \sqrt{t\_11}\\
t_14 := t\_13 + t\_12\\
t_15 := \left(t\_4 + \sqrt{1 + t\_3}\right) \cdot t\_14\\
\mathbf{if}\;t\_7 \leq 220000000:\\
\;\;\;\;\left(\sqrt{t\_3 - -1} - t\_4\right) - \left(\left(t\_13 - \sqrt{t\_11 - -1}\right) - \left(\left(\sqrt{t\_7 - -1} - \sqrt{t\_7}\right) - \frac{t\_8 - t\_10}{\sqrt{t\_10} + t\_9}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{2} \cdot \frac{1}{t\_7 \cdot \sqrt{\frac{1}{t\_7}}} + \left(\frac{1}{t\_14} + \left(\frac{t\_13}{t\_15} + \frac{t\_12}{t\_15}\right)\right)\right) + \left(\sqrt{t\_8 + 1} - t\_9\right)\\
\end{array}
if z < 2.2e8Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.9%
Applied rewrites72.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
Applied rewrites91.9%
if 2.2e8 < z Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in z around inf
lower-+.f64N/A
Applied rewrites51.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmax (fmax x y) t_1))
(t_3 (sqrt t_2))
(t_4 (- (sqrt (+ t_2 1)) t_3))
(t_5 (fmin (fmax x y) t_1))
(t_6 (fmin (fmin x y) z))
(t_7 (fmin t_6 t))
(t_8 (sqrt t_7))
(t_9 (- t_7 -1))
(t_10 (fmax t_6 t))
(t_11 (fmax t_5 t_10))
(t_12 (sqrt t_11))
(t_13 (- (sqrt (+ t_11 1)) t_12))
(t_14 (fmin t_5 t_10))
(t_15 (sqrt t_14)))
(if (<=
(+
(+
(+ (- (sqrt (+ t_7 1)) t_8) (- (sqrt (+ t_14 1)) t_15))
t_4)
t_13)
0)
(+
(+
(+
(/ 1/2 (* t_7 (sqrt (/ 1 t_7))))
(/ 1/2 (* t_14 (sqrt (/ 1 t_14)))))
t_4)
t_13)
(-
(-
(/ (- t_9 t_7) (+ (sqrt t_9) t_8))
(/ -1 (+ (sqrt (- t_14 -1)) t_15)))
(- (- t_3 (sqrt (- t_2 -1))) (- (sqrt (- t_11 -1)) t_12))))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = sqrt(t_2);
double t_4 = sqrt((t_2 + 1.0)) - t_3;
double t_5 = fmin(fmax(x, y), t_1);
double t_6 = fmin(fmin(x, y), z);
double t_7 = fmin(t_6, t);
double t_8 = sqrt(t_7);
double t_9 = t_7 - -1.0;
double t_10 = fmax(t_6, t);
double t_11 = fmax(t_5, t_10);
double t_12 = sqrt(t_11);
double t_13 = sqrt((t_11 + 1.0)) - t_12;
double t_14 = fmin(t_5, t_10);
double t_15 = sqrt(t_14);
double tmp;
if (((((sqrt((t_7 + 1.0)) - t_8) + (sqrt((t_14 + 1.0)) - t_15)) + t_4) + t_13) <= 0.0) {
tmp = (((0.5 / (t_7 * sqrt((1.0 / t_7)))) + (0.5 / (t_14 * sqrt((1.0 / t_14))))) + t_4) + t_13;
} else {
tmp = (((t_9 - t_7) / (sqrt(t_9) + t_8)) - (-1.0 / (sqrt((t_14 - -1.0)) + t_15))) - ((t_3 - sqrt((t_2 - -1.0))) - (sqrt((t_11 - -1.0)) - t_12));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_14
real(8) :: t_15
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmax(fmax(x, y), t_1)
t_3 = sqrt(t_2)
t_4 = sqrt((t_2 + 1.0d0)) - t_3
t_5 = fmin(fmax(x, y), t_1)
t_6 = fmin(fmin(x, y), z)
t_7 = fmin(t_6, t)
t_8 = sqrt(t_7)
t_9 = t_7 - (-1.0d0)
t_10 = fmax(t_6, t)
t_11 = fmax(t_5, t_10)
t_12 = sqrt(t_11)
t_13 = sqrt((t_11 + 1.0d0)) - t_12
t_14 = fmin(t_5, t_10)
t_15 = sqrt(t_14)
if (((((sqrt((t_7 + 1.0d0)) - t_8) + (sqrt((t_14 + 1.0d0)) - t_15)) + t_4) + t_13) <= 0.0d0) then
tmp = (((0.5d0 / (t_7 * sqrt((1.0d0 / t_7)))) + (0.5d0 / (t_14 * sqrt((1.0d0 / t_14))))) + t_4) + t_13
else
tmp = (((t_9 - t_7) / (sqrt(t_9) + t_8)) - ((-1.0d0) / (sqrt((t_14 - (-1.0d0))) + t_15))) - ((t_3 - sqrt((t_2 - (-1.0d0)))) - (sqrt((t_11 - (-1.0d0))) - t_12))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = Math.sqrt(t_2);
double t_4 = Math.sqrt((t_2 + 1.0)) - t_3;
double t_5 = fmin(fmax(x, y), t_1);
double t_6 = fmin(fmin(x, y), z);
double t_7 = fmin(t_6, t);
double t_8 = Math.sqrt(t_7);
double t_9 = t_7 - -1.0;
double t_10 = fmax(t_6, t);
double t_11 = fmax(t_5, t_10);
double t_12 = Math.sqrt(t_11);
double t_13 = Math.sqrt((t_11 + 1.0)) - t_12;
double t_14 = fmin(t_5, t_10);
double t_15 = Math.sqrt(t_14);
double tmp;
if (((((Math.sqrt((t_7 + 1.0)) - t_8) + (Math.sqrt((t_14 + 1.0)) - t_15)) + t_4) + t_13) <= 0.0) {
tmp = (((0.5 / (t_7 * Math.sqrt((1.0 / t_7)))) + (0.5 / (t_14 * Math.sqrt((1.0 / t_14))))) + t_4) + t_13;
} else {
tmp = (((t_9 - t_7) / (Math.sqrt(t_9) + t_8)) - (-1.0 / (Math.sqrt((t_14 - -1.0)) + t_15))) - ((t_3 - Math.sqrt((t_2 - -1.0))) - (Math.sqrt((t_11 - -1.0)) - t_12));
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = math.sqrt(t_2) t_4 = math.sqrt((t_2 + 1.0)) - t_3 t_5 = fmin(fmax(x, y), t_1) t_6 = fmin(fmin(x, y), z) t_7 = fmin(t_6, t) t_8 = math.sqrt(t_7) t_9 = t_7 - -1.0 t_10 = fmax(t_6, t) t_11 = fmax(t_5, t_10) t_12 = math.sqrt(t_11) t_13 = math.sqrt((t_11 + 1.0)) - t_12 t_14 = fmin(t_5, t_10) t_15 = math.sqrt(t_14) tmp = 0 if ((((math.sqrt((t_7 + 1.0)) - t_8) + (math.sqrt((t_14 + 1.0)) - t_15)) + t_4) + t_13) <= 0.0: tmp = (((0.5 / (t_7 * math.sqrt((1.0 / t_7)))) + (0.5 / (t_14 * math.sqrt((1.0 / t_14))))) + t_4) + t_13 else: tmp = (((t_9 - t_7) / (math.sqrt(t_9) + t_8)) - (-1.0 / (math.sqrt((t_14 - -1.0)) + t_15))) - ((t_3 - math.sqrt((t_2 - -1.0))) - (math.sqrt((t_11 - -1.0)) - t_12)) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = sqrt(t_2) t_4 = Float64(sqrt(Float64(t_2 + 1.0)) - t_3) t_5 = fmin(fmax(x, y), t_1) t_6 = fmin(fmin(x, y), z) t_7 = fmin(t_6, t) t_8 = sqrt(t_7) t_9 = Float64(t_7 - -1.0) t_10 = fmax(t_6, t) t_11 = fmax(t_5, t_10) t_12 = sqrt(t_11) t_13 = Float64(sqrt(Float64(t_11 + 1.0)) - t_12) t_14 = fmin(t_5, t_10) t_15 = sqrt(t_14) tmp = 0.0 if (Float64(Float64(Float64(Float64(sqrt(Float64(t_7 + 1.0)) - t_8) + Float64(sqrt(Float64(t_14 + 1.0)) - t_15)) + t_4) + t_13) <= 0.0) tmp = Float64(Float64(Float64(Float64(0.5 / Float64(t_7 * sqrt(Float64(1.0 / t_7)))) + Float64(0.5 / Float64(t_14 * sqrt(Float64(1.0 / t_14))))) + t_4) + t_13); else tmp = Float64(Float64(Float64(Float64(t_9 - t_7) / Float64(sqrt(t_9) + t_8)) - Float64(-1.0 / Float64(sqrt(Float64(t_14 - -1.0)) + t_15))) - Float64(Float64(t_3 - sqrt(Float64(t_2 - -1.0))) - Float64(sqrt(Float64(t_11 - -1.0)) - t_12))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = max(max(x, y), t_1); t_3 = sqrt(t_2); t_4 = sqrt((t_2 + 1.0)) - t_3; t_5 = min(max(x, y), t_1); t_6 = min(min(x, y), z); t_7 = min(t_6, t); t_8 = sqrt(t_7); t_9 = t_7 - -1.0; t_10 = max(t_6, t); t_11 = max(t_5, t_10); t_12 = sqrt(t_11); t_13 = sqrt((t_11 + 1.0)) - t_12; t_14 = min(t_5, t_10); t_15 = sqrt(t_14); tmp = 0.0; if (((((sqrt((t_7 + 1.0)) - t_8) + (sqrt((t_14 + 1.0)) - t_15)) + t_4) + t_13) <= 0.0) tmp = (((0.5 / (t_7 * sqrt((1.0 / t_7)))) + (0.5 / (t_14 * sqrt((1.0 / t_14))))) + t_4) + t_13; else tmp = (((t_9 - t_7) / (sqrt(t_9) + t_8)) - (-1.0 / (sqrt((t_14 - -1.0)) + t_15))) - ((t_3 - sqrt((t_2 - -1.0))) - (sqrt((t_11 - -1.0)) - t_12)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$2 + 1), $MachinePrecision]], $MachinePrecision] - t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$6 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$7 = N[Min[t$95$6, t], $MachinePrecision]}, Block[{t$95$8 = N[Sqrt[t$95$7], $MachinePrecision]}, Block[{t$95$9 = N[(t$95$7 - -1), $MachinePrecision]}, Block[{t$95$10 = N[Max[t$95$6, t], $MachinePrecision]}, Block[{t$95$11 = N[Max[t$95$5, t$95$10], $MachinePrecision]}, Block[{t$95$12 = N[Sqrt[t$95$11], $MachinePrecision]}, Block[{t$95$13 = N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - t$95$12), $MachinePrecision]}, Block[{t$95$14 = N[Min[t$95$5, t$95$10], $MachinePrecision]}, Block[{t$95$15 = N[Sqrt[t$95$14], $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[Sqrt[N[(t$95$7 + 1), $MachinePrecision]], $MachinePrecision] - t$95$8), $MachinePrecision] + N[(N[Sqrt[N[(t$95$14 + 1), $MachinePrecision]], $MachinePrecision] - t$95$15), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + t$95$13), $MachinePrecision], 0], N[(N[(N[(N[(1/2 / N[(t$95$7 * N[Sqrt[N[(1 / t$95$7), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1/2 / N[(t$95$14 * N[Sqrt[N[(1 / t$95$14), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + t$95$13), $MachinePrecision], N[(N[(N[(N[(t$95$9 - t$95$7), $MachinePrecision] / N[(N[Sqrt[t$95$9], $MachinePrecision] + t$95$8), $MachinePrecision]), $MachinePrecision] - N[(-1 / N[(N[Sqrt[N[(t$95$14 - -1), $MachinePrecision]], $MachinePrecision] + t$95$15), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$3 - N[Sqrt[N[(t$95$2 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[N[(t$95$11 - -1), $MachinePrecision]], $MachinePrecision] - t$95$12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \sqrt{t\_2}\\
t_4 := \sqrt{t\_2 + 1} - t\_3\\
t_5 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_6 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_7 := \mathsf{min}\left(t\_6, t\right)\\
t_8 := \sqrt{t\_7}\\
t_9 := t\_7 - -1\\
t_10 := \mathsf{max}\left(t\_6, t\right)\\
t_11 := \mathsf{max}\left(t\_5, t\_10\right)\\
t_12 := \sqrt{t\_11}\\
t_13 := \sqrt{t\_11 + 1} - t\_12\\
t_14 := \mathsf{min}\left(t\_5, t\_10\right)\\
t_15 := \sqrt{t\_14}\\
\mathbf{if}\;\left(\left(\left(\sqrt{t\_7 + 1} - t\_8\right) + \left(\sqrt{t\_14 + 1} - t\_15\right)\right) + t\_4\right) + t\_13 \leq 0:\\
\;\;\;\;\left(\left(\frac{\frac{1}{2}}{t\_7 \cdot \sqrt{\frac{1}{t\_7}}} + \frac{\frac{1}{2}}{t\_14 \cdot \sqrt{\frac{1}{t\_14}}}\right) + t\_4\right) + t\_13\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t\_9 - t\_7}{\sqrt{t\_9} + t\_8} - \frac{-1}{\sqrt{t\_14 - -1} + t\_15}\right) - \left(\left(t\_3 - \sqrt{t\_2 - -1}\right) - \left(\sqrt{t\_11 - -1} - t\_12\right)\right)\\
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 0.0Initial program 91.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6447.9%
Applied rewrites47.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6426.5%
Applied rewrites26.5%
if 0.0 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Applied rewrites93.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmin (fmin x y) z))
(t_3 (fmin t_2 t))
(t_4 (sqrt t_3))
(t_5 (fmax t_2 t))
(t_6 (fmax (fmax x y) t_5))
(t_7 (- (sqrt (+ t_6 1)) (sqrt t_6)))
(t_8 (fmin (fmax x y) t_5))
(t_9 (sqrt t_8))
(t_10 (- (sqrt (+ t_1 1)) (sqrt t_1))))
(if (<= t_8 32500000)
(+ (+ (- (+ 1 (sqrt (+ 1 t_8))) (+ t_4 t_9)) t_10) t_7)
(if (<= t_8 210000000000000015434770284544)
(+ (+ (+ (- (sqrt (+ t_3 1)) t_4) (/ 1/2 t_9)) t_10) t_7)
(+ (+ (/ 1 (+ t_4 (sqrt (+ 1 t_3)))) t_10) t_7)))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmin(t_2, t);
double t_4 = sqrt(t_3);
double t_5 = fmax(t_2, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = sqrt((t_6 + 1.0)) - sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = sqrt(t_8);
double t_10 = sqrt((t_1 + 1.0)) - sqrt(t_1);
double tmp;
if (t_8 <= 32500000.0) {
tmp = (((1.0 + sqrt((1.0 + t_8))) - (t_4 + t_9)) + t_10) + t_7;
} else if (t_8 <= 2.1e+29) {
tmp = (((sqrt((t_3 + 1.0)) - t_4) + (0.5 / t_9)) + t_10) + t_7;
} else {
tmp = ((1.0 / (t_4 + sqrt((1.0 + t_3)))) + t_10) + t_7;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmin(fmin(x, y), z)
t_3 = fmin(t_2, t)
t_4 = sqrt(t_3)
t_5 = fmax(t_2, t)
t_6 = fmax(fmax(x, y), t_5)
t_7 = sqrt((t_6 + 1.0d0)) - sqrt(t_6)
t_8 = fmin(fmax(x, y), t_5)
t_9 = sqrt(t_8)
t_10 = sqrt((t_1 + 1.0d0)) - sqrt(t_1)
if (t_8 <= 32500000.0d0) then
tmp = (((1.0d0 + sqrt((1.0d0 + t_8))) - (t_4 + t_9)) + t_10) + t_7
else if (t_8 <= 2.1d+29) then
tmp = (((sqrt((t_3 + 1.0d0)) - t_4) + (0.5d0 / t_9)) + t_10) + t_7
else
tmp = ((1.0d0 / (t_4 + sqrt((1.0d0 + t_3)))) + t_10) + t_7
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmin(t_2, t);
double t_4 = Math.sqrt(t_3);
double t_5 = fmax(t_2, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = Math.sqrt((t_6 + 1.0)) - Math.sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = Math.sqrt(t_8);
double t_10 = Math.sqrt((t_1 + 1.0)) - Math.sqrt(t_1);
double tmp;
if (t_8 <= 32500000.0) {
tmp = (((1.0 + Math.sqrt((1.0 + t_8))) - (t_4 + t_9)) + t_10) + t_7;
} else if (t_8 <= 2.1e+29) {
tmp = (((Math.sqrt((t_3 + 1.0)) - t_4) + (0.5 / t_9)) + t_10) + t_7;
} else {
tmp = ((1.0 / (t_4 + Math.sqrt((1.0 + t_3)))) + t_10) + t_7;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmin(fmin(x, y), z) t_3 = fmin(t_2, t) t_4 = math.sqrt(t_3) t_5 = fmax(t_2, t) t_6 = fmax(fmax(x, y), t_5) t_7 = math.sqrt((t_6 + 1.0)) - math.sqrt(t_6) t_8 = fmin(fmax(x, y), t_5) t_9 = math.sqrt(t_8) t_10 = math.sqrt((t_1 + 1.0)) - math.sqrt(t_1) tmp = 0 if t_8 <= 32500000.0: tmp = (((1.0 + math.sqrt((1.0 + t_8))) - (t_4 + t_9)) + t_10) + t_7 elif t_8 <= 2.1e+29: tmp = (((math.sqrt((t_3 + 1.0)) - t_4) + (0.5 / t_9)) + t_10) + t_7 else: tmp = ((1.0 / (t_4 + math.sqrt((1.0 + t_3)))) + t_10) + t_7 return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmin(fmin(x, y), z) t_3 = fmin(t_2, t) t_4 = sqrt(t_3) t_5 = fmax(t_2, t) t_6 = fmax(fmax(x, y), t_5) t_7 = Float64(sqrt(Float64(t_6 + 1.0)) - sqrt(t_6)) t_8 = fmin(fmax(x, y), t_5) t_9 = sqrt(t_8) t_10 = Float64(sqrt(Float64(t_1 + 1.0)) - sqrt(t_1)) tmp = 0.0 if (t_8 <= 32500000.0) tmp = Float64(Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + t_8))) - Float64(t_4 + t_9)) + t_10) + t_7); elseif (t_8 <= 2.1e+29) tmp = Float64(Float64(Float64(Float64(sqrt(Float64(t_3 + 1.0)) - t_4) + Float64(0.5 / t_9)) + t_10) + t_7); else tmp = Float64(Float64(Float64(1.0 / Float64(t_4 + sqrt(Float64(1.0 + t_3)))) + t_10) + t_7); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = min(min(x, y), z); t_3 = min(t_2, t); t_4 = sqrt(t_3); t_5 = max(t_2, t); t_6 = max(max(x, y), t_5); t_7 = sqrt((t_6 + 1.0)) - sqrt(t_6); t_8 = min(max(x, y), t_5); t_9 = sqrt(t_8); t_10 = sqrt((t_1 + 1.0)) - sqrt(t_1); tmp = 0.0; if (t_8 <= 32500000.0) tmp = (((1.0 + sqrt((1.0 + t_8))) - (t_4 + t_9)) + t_10) + t_7; elseif (t_8 <= 2.1e+29) tmp = (((sqrt((t_3 + 1.0)) - t_4) + (0.5 / t_9)) + t_10) + t_7; else tmp = ((1.0 / (t_4 + sqrt((1.0 + t_3)))) + t_10) + t_7; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$3 = N[Min[t$95$2, t], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Max[t$95$2, t], $MachinePrecision]}, Block[{t$95$6 = N[Max[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[Min[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$9 = N[Sqrt[t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[(N[Sqrt[N[(t$95$1 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$8, 32500000], N[(N[(N[(N[(1 + N[Sqrt[N[(1 + t$95$8), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$4 + t$95$9), $MachinePrecision]), $MachinePrecision] + t$95$10), $MachinePrecision] + t$95$7), $MachinePrecision], If[LessEqual[t$95$8, 210000000000000015434770284544], N[(N[(N[(N[(N[Sqrt[N[(t$95$3 + 1), $MachinePrecision]], $MachinePrecision] - t$95$4), $MachinePrecision] + N[(1/2 / t$95$9), $MachinePrecision]), $MachinePrecision] + t$95$10), $MachinePrecision] + t$95$7), $MachinePrecision], N[(N[(N[(1 / N[(t$95$4 + N[Sqrt[N[(1 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$10), $MachinePrecision] + t$95$7), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_3 := \mathsf{min}\left(t\_2, t\right)\\
t_4 := \sqrt{t\_3}\\
t_5 := \mathsf{max}\left(t\_2, t\right)\\
t_6 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_7 := \sqrt{t\_6 + 1} - \sqrt{t\_6}\\
t_8 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_9 := \sqrt{t\_8}\\
t_10 := \sqrt{t\_1 + 1} - \sqrt{t\_1}\\
\mathbf{if}\;t\_8 \leq 32500000:\\
\;\;\;\;\left(\left(\left(1 + \sqrt{1 + t\_8}\right) - \left(t\_4 + t\_9\right)\right) + t\_10\right) + t\_7\\
\mathbf{elif}\;t\_8 \leq 210000000000000015434770284544:\\
\;\;\;\;\left(\left(\left(\sqrt{t\_3 + 1} - t\_4\right) + \frac{\frac{1}{2}}{t\_9}\right) + t\_10\right) + t\_7\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_4 + \sqrt{1 + t\_3}} + t\_10\right) + t\_7\\
\end{array}
if y < 3.25e7Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
if 3.25e7 < y < 2.1000000000000002e29Initial program 91.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6447.9%
Applied rewrites47.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower-sqrt.f6447.9%
Applied rewrites47.9%
if 2.1000000000000002e29 < y Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmax (fmax x y) t_1))
(t_3 (fmin (fmin x y) z))
(t_4 (fmin t_3 t))
(t_5 (fmax t_3 t))
(t_6 (fmin (fmax x y) t_1))
(t_7 (fmax t_6 t_5))
(t_8 (fmin t_2 t_7))
(t_9 (sqrt t_8))
(t_10 (fmin t_6 t_5))
(t_11 (fmax t_2 t_7))
(t_12 (- t_11 -1))
(t_13 (sqrt t_11)))
(if (<= t_4 100000000)
(-
(- (sqrt (- t_4 -1)) (sqrt t_4))
(-
(- (sqrt t_10) (sqrt (- t_10 -1)))
(-
(- (sqrt (- t_8 -1)) t_9)
(/ (- t_11 t_12) (+ (sqrt t_12) t_13)))))
(+
(+
(+
(/ 1/2 (* t_4 (sqrt (/ 1 t_4))))
(/ 1/2 (* t_10 (sqrt (/ 1 t_10)))))
(- (sqrt (+ t_8 1)) t_9))
(- (sqrt (+ t_11 1)) t_13)))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmin(fmax(x, y), t_1);
double t_7 = fmax(t_6, t_5);
double t_8 = fmin(t_2, t_7);
double t_9 = sqrt(t_8);
double t_10 = fmin(t_6, t_5);
double t_11 = fmax(t_2, t_7);
double t_12 = t_11 - -1.0;
double t_13 = sqrt(t_11);
double tmp;
if (t_4 <= 100000000.0) {
tmp = (sqrt((t_4 - -1.0)) - sqrt(t_4)) - ((sqrt(t_10) - sqrt((t_10 - -1.0))) - ((sqrt((t_8 - -1.0)) - t_9) - ((t_11 - t_12) / (sqrt(t_12) + t_13))));
} else {
tmp = (((0.5 / (t_4 * sqrt((1.0 / t_4)))) + (0.5 / (t_10 * sqrt((1.0 / t_10))))) + (sqrt((t_8 + 1.0)) - t_9)) + (sqrt((t_11 + 1.0)) - t_13);
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmax(fmax(x, y), t_1)
t_3 = fmin(fmin(x, y), z)
t_4 = fmin(t_3, t)
t_5 = fmax(t_3, t)
t_6 = fmin(fmax(x, y), t_1)
t_7 = fmax(t_6, t_5)
t_8 = fmin(t_2, t_7)
t_9 = sqrt(t_8)
t_10 = fmin(t_6, t_5)
t_11 = fmax(t_2, t_7)
t_12 = t_11 - (-1.0d0)
t_13 = sqrt(t_11)
if (t_4 <= 100000000.0d0) then
tmp = (sqrt((t_4 - (-1.0d0))) - sqrt(t_4)) - ((sqrt(t_10) - sqrt((t_10 - (-1.0d0)))) - ((sqrt((t_8 - (-1.0d0))) - t_9) - ((t_11 - t_12) / (sqrt(t_12) + t_13))))
else
tmp = (((0.5d0 / (t_4 * sqrt((1.0d0 / t_4)))) + (0.5d0 / (t_10 * sqrt((1.0d0 / t_10))))) + (sqrt((t_8 + 1.0d0)) - t_9)) + (sqrt((t_11 + 1.0d0)) - t_13)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmin(fmax(x, y), t_1);
double t_7 = fmax(t_6, t_5);
double t_8 = fmin(t_2, t_7);
double t_9 = Math.sqrt(t_8);
double t_10 = fmin(t_6, t_5);
double t_11 = fmax(t_2, t_7);
double t_12 = t_11 - -1.0;
double t_13 = Math.sqrt(t_11);
double tmp;
if (t_4 <= 100000000.0) {
tmp = (Math.sqrt((t_4 - -1.0)) - Math.sqrt(t_4)) - ((Math.sqrt(t_10) - Math.sqrt((t_10 - -1.0))) - ((Math.sqrt((t_8 - -1.0)) - t_9) - ((t_11 - t_12) / (Math.sqrt(t_12) + t_13))));
} else {
tmp = (((0.5 / (t_4 * Math.sqrt((1.0 / t_4)))) + (0.5 / (t_10 * Math.sqrt((1.0 / t_10))))) + (Math.sqrt((t_8 + 1.0)) - t_9)) + (Math.sqrt((t_11 + 1.0)) - t_13);
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmin(fmax(x, y), t_1) t_7 = fmax(t_6, t_5) t_8 = fmin(t_2, t_7) t_9 = math.sqrt(t_8) t_10 = fmin(t_6, t_5) t_11 = fmax(t_2, t_7) t_12 = t_11 - -1.0 t_13 = math.sqrt(t_11) tmp = 0 if t_4 <= 100000000.0: tmp = (math.sqrt((t_4 - -1.0)) - math.sqrt(t_4)) - ((math.sqrt(t_10) - math.sqrt((t_10 - -1.0))) - ((math.sqrt((t_8 - -1.0)) - t_9) - ((t_11 - t_12) / (math.sqrt(t_12) + t_13)))) else: tmp = (((0.5 / (t_4 * math.sqrt((1.0 / t_4)))) + (0.5 / (t_10 * math.sqrt((1.0 / t_10))))) + (math.sqrt((t_8 + 1.0)) - t_9)) + (math.sqrt((t_11 + 1.0)) - t_13) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmin(fmax(x, y), t_1) t_7 = fmax(t_6, t_5) t_8 = fmin(t_2, t_7) t_9 = sqrt(t_8) t_10 = fmin(t_6, t_5) t_11 = fmax(t_2, t_7) t_12 = Float64(t_11 - -1.0) t_13 = sqrt(t_11) tmp = 0.0 if (t_4 <= 100000000.0) tmp = Float64(Float64(sqrt(Float64(t_4 - -1.0)) - sqrt(t_4)) - Float64(Float64(sqrt(t_10) - sqrt(Float64(t_10 - -1.0))) - Float64(Float64(sqrt(Float64(t_8 - -1.0)) - t_9) - Float64(Float64(t_11 - t_12) / Float64(sqrt(t_12) + t_13))))); else tmp = Float64(Float64(Float64(Float64(0.5 / Float64(t_4 * sqrt(Float64(1.0 / t_4)))) + Float64(0.5 / Float64(t_10 * sqrt(Float64(1.0 / t_10))))) + Float64(sqrt(Float64(t_8 + 1.0)) - t_9)) + Float64(sqrt(Float64(t_11 + 1.0)) - t_13)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = max(max(x, y), t_1); t_3 = min(min(x, y), z); t_4 = min(t_3, t); t_5 = max(t_3, t); t_6 = min(max(x, y), t_1); t_7 = max(t_6, t_5); t_8 = min(t_2, t_7); t_9 = sqrt(t_8); t_10 = min(t_6, t_5); t_11 = max(t_2, t_7); t_12 = t_11 - -1.0; t_13 = sqrt(t_11); tmp = 0.0; if (t_4 <= 100000000.0) tmp = (sqrt((t_4 - -1.0)) - sqrt(t_4)) - ((sqrt(t_10) - sqrt((t_10 - -1.0))) - ((sqrt((t_8 - -1.0)) - t_9) - ((t_11 - t_12) / (sqrt(t_12) + t_13)))); else tmp = (((0.5 / (t_4 * sqrt((1.0 / t_4)))) + (0.5 / (t_10 * sqrt((1.0 / t_10))))) + (sqrt((t_8 + 1.0)) - t_9)) + (sqrt((t_11 + 1.0)) - t_13); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$4 = N[Min[t$95$3, t], $MachinePrecision]}, Block[{t$95$5 = N[Max[t$95$3, t], $MachinePrecision]}, Block[{t$95$6 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$7 = N[Max[t$95$6, t$95$5], $MachinePrecision]}, Block[{t$95$8 = N[Min[t$95$2, t$95$7], $MachinePrecision]}, Block[{t$95$9 = N[Sqrt[t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[Min[t$95$6, t$95$5], $MachinePrecision]}, Block[{t$95$11 = N[Max[t$95$2, t$95$7], $MachinePrecision]}, Block[{t$95$12 = N[(t$95$11 - -1), $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[t$95$11], $MachinePrecision]}, If[LessEqual[t$95$4, 100000000], N[(N[(N[Sqrt[N[(t$95$4 - -1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[t$95$10], $MachinePrecision] - N[Sqrt[N[(t$95$10 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[N[(t$95$8 - -1), $MachinePrecision]], $MachinePrecision] - t$95$9), $MachinePrecision] - N[(N[(t$95$11 - t$95$12), $MachinePrecision] / N[(N[Sqrt[t$95$12], $MachinePrecision] + t$95$13), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1/2 / N[(t$95$4 * N[Sqrt[N[(1 / t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1/2 / N[(t$95$10 * N[Sqrt[N[(1 / t$95$10), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$8 + 1), $MachinePrecision]], $MachinePrecision] - t$95$9), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - t$95$13), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_4 := \mathsf{min}\left(t\_3, t\right)\\
t_5 := \mathsf{max}\left(t\_3, t\right)\\
t_6 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_7 := \mathsf{max}\left(t\_6, t\_5\right)\\
t_8 := \mathsf{min}\left(t\_2, t\_7\right)\\
t_9 := \sqrt{t\_8}\\
t_10 := \mathsf{min}\left(t\_6, t\_5\right)\\
t_11 := \mathsf{max}\left(t\_2, t\_7\right)\\
t_12 := t\_11 - -1\\
t_13 := \sqrt{t\_11}\\
\mathbf{if}\;t\_4 \leq 100000000:\\
\;\;\;\;\left(\sqrt{t\_4 - -1} - \sqrt{t\_4}\right) - \left(\left(\sqrt{t\_10} - \sqrt{t\_10 - -1}\right) - \left(\left(\sqrt{t\_8 - -1} - t\_9\right) - \frac{t\_11 - t\_12}{\sqrt{t\_12} + t\_13}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{\frac{1}{2}}{t\_4 \cdot \sqrt{\frac{1}{t\_4}}} + \frac{\frac{1}{2}}{t\_10 \cdot \sqrt{\frac{1}{t\_10}}}\right) + \left(\sqrt{t\_8 + 1} - t\_9\right)\right) + \left(\sqrt{t\_11 + 1} - t\_13\right)\\
\end{array}
if x < 1e8Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.9%
Applied rewrites72.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
Applied rewrites91.9%
if 1e8 < x Initial program 91.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6447.9%
Applied rewrites47.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6426.5%
Applied rewrites26.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (sqrt t_1))
(t_3 (fmin (fmin x y) z))
(t_4 (fmin t_3 t))
(t_5 (fmax t_3 t))
(t_6 (fmax (fmax x y) t_5))
(t_7 (sqrt t_6))
(t_8 (- t_6 -1))
(t_9 (fmin (fmax x y) t_5))
(t_10 (sqrt t_9))
(t_11 (sqrt t_4)))
(if (<=
(- (sqrt (+ t_9 1)) t_10)
3022314549036573/151115727451828646838272)
(+
(+ (/ 1 (+ t_11 (sqrt (+ 1 t_4)))) (- (sqrt (+ t_1 1)) t_2))
(- (sqrt (+ t_6 1)) t_7))
(-
(- (sqrt (- t_4 -1)) t_11)
(-
(- t_10 (sqrt (- t_9 -1)))
(-
(- (sqrt (- t_1 -1)) t_2)
(/ (- t_6 t_8) (+ (sqrt t_8) t_7))))))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = sqrt(t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = sqrt(t_6);
double t_8 = t_6 - -1.0;
double t_9 = fmin(fmax(x, y), t_5);
double t_10 = sqrt(t_9);
double t_11 = sqrt(t_4);
double tmp;
if ((sqrt((t_9 + 1.0)) - t_10) <= 2e-8) {
tmp = ((1.0 / (t_11 + sqrt((1.0 + t_4)))) + (sqrt((t_1 + 1.0)) - t_2)) + (sqrt((t_6 + 1.0)) - t_7);
} else {
tmp = (sqrt((t_4 - -1.0)) - t_11) - ((t_10 - sqrt((t_9 - -1.0))) - ((sqrt((t_1 - -1.0)) - t_2) - ((t_6 - t_8) / (sqrt(t_8) + t_7))));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = sqrt(t_1)
t_3 = fmin(fmin(x, y), z)
t_4 = fmin(t_3, t)
t_5 = fmax(t_3, t)
t_6 = fmax(fmax(x, y), t_5)
t_7 = sqrt(t_6)
t_8 = t_6 - (-1.0d0)
t_9 = fmin(fmax(x, y), t_5)
t_10 = sqrt(t_9)
t_11 = sqrt(t_4)
if ((sqrt((t_9 + 1.0d0)) - t_10) <= 2d-8) then
tmp = ((1.0d0 / (t_11 + sqrt((1.0d0 + t_4)))) + (sqrt((t_1 + 1.0d0)) - t_2)) + (sqrt((t_6 + 1.0d0)) - t_7)
else
tmp = (sqrt((t_4 - (-1.0d0))) - t_11) - ((t_10 - sqrt((t_9 - (-1.0d0)))) - ((sqrt((t_1 - (-1.0d0))) - t_2) - ((t_6 - t_8) / (sqrt(t_8) + t_7))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = Math.sqrt(t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = Math.sqrt(t_6);
double t_8 = t_6 - -1.0;
double t_9 = fmin(fmax(x, y), t_5);
double t_10 = Math.sqrt(t_9);
double t_11 = Math.sqrt(t_4);
double tmp;
if ((Math.sqrt((t_9 + 1.0)) - t_10) <= 2e-8) {
tmp = ((1.0 / (t_11 + Math.sqrt((1.0 + t_4)))) + (Math.sqrt((t_1 + 1.0)) - t_2)) + (Math.sqrt((t_6 + 1.0)) - t_7);
} else {
tmp = (Math.sqrt((t_4 - -1.0)) - t_11) - ((t_10 - Math.sqrt((t_9 - -1.0))) - ((Math.sqrt((t_1 - -1.0)) - t_2) - ((t_6 - t_8) / (Math.sqrt(t_8) + t_7))));
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = math.sqrt(t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmax(fmax(x, y), t_5) t_7 = math.sqrt(t_6) t_8 = t_6 - -1.0 t_9 = fmin(fmax(x, y), t_5) t_10 = math.sqrt(t_9) t_11 = math.sqrt(t_4) tmp = 0 if (math.sqrt((t_9 + 1.0)) - t_10) <= 2e-8: tmp = ((1.0 / (t_11 + math.sqrt((1.0 + t_4)))) + (math.sqrt((t_1 + 1.0)) - t_2)) + (math.sqrt((t_6 + 1.0)) - t_7) else: tmp = (math.sqrt((t_4 - -1.0)) - t_11) - ((t_10 - math.sqrt((t_9 - -1.0))) - ((math.sqrt((t_1 - -1.0)) - t_2) - ((t_6 - t_8) / (math.sqrt(t_8) + t_7)))) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = sqrt(t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmax(fmax(x, y), t_5) t_7 = sqrt(t_6) t_8 = Float64(t_6 - -1.0) t_9 = fmin(fmax(x, y), t_5) t_10 = sqrt(t_9) t_11 = sqrt(t_4) tmp = 0.0 if (Float64(sqrt(Float64(t_9 + 1.0)) - t_10) <= 2e-8) tmp = Float64(Float64(Float64(1.0 / Float64(t_11 + sqrt(Float64(1.0 + t_4)))) + Float64(sqrt(Float64(t_1 + 1.0)) - t_2)) + Float64(sqrt(Float64(t_6 + 1.0)) - t_7)); else tmp = Float64(Float64(sqrt(Float64(t_4 - -1.0)) - t_11) - Float64(Float64(t_10 - sqrt(Float64(t_9 - -1.0))) - Float64(Float64(sqrt(Float64(t_1 - -1.0)) - t_2) - Float64(Float64(t_6 - t_8) / Float64(sqrt(t_8) + t_7))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = sqrt(t_1); t_3 = min(min(x, y), z); t_4 = min(t_3, t); t_5 = max(t_3, t); t_6 = max(max(x, y), t_5); t_7 = sqrt(t_6); t_8 = t_6 - -1.0; t_9 = min(max(x, y), t_5); t_10 = sqrt(t_9); t_11 = sqrt(t_4); tmp = 0.0; if ((sqrt((t_9 + 1.0)) - t_10) <= 2e-8) tmp = ((1.0 / (t_11 + sqrt((1.0 + t_4)))) + (sqrt((t_1 + 1.0)) - t_2)) + (sqrt((t_6 + 1.0)) - t_7); else tmp = (sqrt((t_4 - -1.0)) - t_11) - ((t_10 - sqrt((t_9 - -1.0))) - ((sqrt((t_1 - -1.0)) - t_2) - ((t_6 - t_8) / (sqrt(t_8) + t_7)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$4 = N[Min[t$95$3, t], $MachinePrecision]}, Block[{t$95$5 = N[Max[t$95$3, t], $MachinePrecision]}, Block[{t$95$6 = N[Max[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[(t$95$6 - -1), $MachinePrecision]}, Block[{t$95$9 = N[Min[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$10 = N[Sqrt[t$95$9], $MachinePrecision]}, Block[{t$95$11 = N[Sqrt[t$95$4], $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(t$95$9 + 1), $MachinePrecision]], $MachinePrecision] - t$95$10), $MachinePrecision], 3022314549036573/151115727451828646838272], N[(N[(N[(1 / N[(t$95$11 + N[Sqrt[N[(1 + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$1 + 1), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - t$95$7), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(t$95$4 - -1), $MachinePrecision]], $MachinePrecision] - t$95$11), $MachinePrecision] - N[(N[(t$95$10 - N[Sqrt[N[(t$95$9 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[N[(t$95$1 - -1), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision] - N[(N[(t$95$6 - t$95$8), $MachinePrecision] / N[(N[Sqrt[t$95$8], $MachinePrecision] + t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \sqrt{t\_1}\\
t_3 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_4 := \mathsf{min}\left(t\_3, t\right)\\
t_5 := \mathsf{max}\left(t\_3, t\right)\\
t_6 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_7 := \sqrt{t\_6}\\
t_8 := t\_6 - -1\\
t_9 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_10 := \sqrt{t\_9}\\
t_11 := \sqrt{t\_4}\\
\mathbf{if}\;\sqrt{t\_9 + 1} - t\_10 \leq \frac{3022314549036573}{151115727451828646838272}:\\
\;\;\;\;\left(\frac{1}{t\_11 + \sqrt{1 + t\_4}} + \left(\sqrt{t\_1 + 1} - t\_2\right)\right) + \left(\sqrt{t\_6 + 1} - t\_7\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{t\_4 - -1} - t\_11\right) - \left(\left(t\_10 - \sqrt{t\_9 - -1}\right) - \left(\left(\sqrt{t\_1 - -1} - t\_2\right) - \frac{t\_6 - t\_8}{\sqrt{t\_8} + t\_7}\right)\right)\\
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2e-8Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
if 2e-8 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.9%
Applied rewrites72.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
add-flipN/A
associate-+l-N/A
Applied rewrites91.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmax (fmin x y) z))
(t_3 (fmax (fmax x y) t_2))
(t_4 (fmin (fmax x y) t_2))
(t_5 (- (sqrt (+ t_3 1)) (sqrt t_3)))
(t_6 (fmin t_1 t))
(t_7 (sqrt t_6))
(t_8 (fmax t_1 t))
(t_9 (fmin t_4 t_8))
(t_10 (+ t_7 (sqrt t_9)))
(t_11 (fmax t_4 t_8))
(t_12 (- (sqrt (+ t_11 1)) (sqrt t_11)))
(t_13 (sqrt (+ 1 t_6))))
(if (<= t_9 287769207549869/147573952589676412928)
(+ (+ (- (+ 2 (* 1/2 t_9)) t_10) t_5) t_12)
(if (<= t_9 560000000000000)
(+ (- (+ t_13 (sqrt (+ 1 t_9))) t_10) t_12)
(+ (+ (/ 1 (+ t_7 t_13)) t_5) t_12)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmin(x, y), z);
double t_3 = fmax(fmax(x, y), t_2);
double t_4 = fmin(fmax(x, y), t_2);
double t_5 = sqrt((t_3 + 1.0)) - sqrt(t_3);
double t_6 = fmin(t_1, t);
double t_7 = sqrt(t_6);
double t_8 = fmax(t_1, t);
double t_9 = fmin(t_4, t_8);
double t_10 = t_7 + sqrt(t_9);
double t_11 = fmax(t_4, t_8);
double t_12 = sqrt((t_11 + 1.0)) - sqrt(t_11);
double t_13 = sqrt((1.0 + t_6));
double tmp;
if (t_9 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12;
} else if (t_9 <= 5.6e+14) {
tmp = ((t_13 + sqrt((1.0 + t_9))) - t_10) + t_12;
} else {
tmp = ((1.0 / (t_7 + t_13)) + t_5) + t_12;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(fmin(x, y), z)
t_2 = fmax(fmin(x, y), z)
t_3 = fmax(fmax(x, y), t_2)
t_4 = fmin(fmax(x, y), t_2)
t_5 = sqrt((t_3 + 1.0d0)) - sqrt(t_3)
t_6 = fmin(t_1, t)
t_7 = sqrt(t_6)
t_8 = fmax(t_1, t)
t_9 = fmin(t_4, t_8)
t_10 = t_7 + sqrt(t_9)
t_11 = fmax(t_4, t_8)
t_12 = sqrt((t_11 + 1.0d0)) - sqrt(t_11)
t_13 = sqrt((1.0d0 + t_6))
if (t_9 <= 1.95d-6) then
tmp = (((2.0d0 + (0.5d0 * t_9)) - t_10) + t_5) + t_12
else if (t_9 <= 5.6d+14) then
tmp = ((t_13 + sqrt((1.0d0 + t_9))) - t_10) + t_12
else
tmp = ((1.0d0 / (t_7 + t_13)) + t_5) + t_12
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmin(x, y), z);
double t_3 = fmax(fmax(x, y), t_2);
double t_4 = fmin(fmax(x, y), t_2);
double t_5 = Math.sqrt((t_3 + 1.0)) - Math.sqrt(t_3);
double t_6 = fmin(t_1, t);
double t_7 = Math.sqrt(t_6);
double t_8 = fmax(t_1, t);
double t_9 = fmin(t_4, t_8);
double t_10 = t_7 + Math.sqrt(t_9);
double t_11 = fmax(t_4, t_8);
double t_12 = Math.sqrt((t_11 + 1.0)) - Math.sqrt(t_11);
double t_13 = Math.sqrt((1.0 + t_6));
double tmp;
if (t_9 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12;
} else if (t_9 <= 5.6e+14) {
tmp = ((t_13 + Math.sqrt((1.0 + t_9))) - t_10) + t_12;
} else {
tmp = ((1.0 / (t_7 + t_13)) + t_5) + t_12;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmin(x, y), z) t_3 = fmax(fmax(x, y), t_2) t_4 = fmin(fmax(x, y), t_2) t_5 = math.sqrt((t_3 + 1.0)) - math.sqrt(t_3) t_6 = fmin(t_1, t) t_7 = math.sqrt(t_6) t_8 = fmax(t_1, t) t_9 = fmin(t_4, t_8) t_10 = t_7 + math.sqrt(t_9) t_11 = fmax(t_4, t_8) t_12 = math.sqrt((t_11 + 1.0)) - math.sqrt(t_11) t_13 = math.sqrt((1.0 + t_6)) tmp = 0 if t_9 <= 1.95e-6: tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12 elif t_9 <= 5.6e+14: tmp = ((t_13 + math.sqrt((1.0 + t_9))) - t_10) + t_12 else: tmp = ((1.0 / (t_7 + t_13)) + t_5) + t_12 return tmp
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmin(x, y), z) t_3 = fmax(fmax(x, y), t_2) t_4 = fmin(fmax(x, y), t_2) t_5 = Float64(sqrt(Float64(t_3 + 1.0)) - sqrt(t_3)) t_6 = fmin(t_1, t) t_7 = sqrt(t_6) t_8 = fmax(t_1, t) t_9 = fmin(t_4, t_8) t_10 = Float64(t_7 + sqrt(t_9)) t_11 = fmax(t_4, t_8) t_12 = Float64(sqrt(Float64(t_11 + 1.0)) - sqrt(t_11)) t_13 = sqrt(Float64(1.0 + t_6)) tmp = 0.0 if (t_9 <= 1.95e-6) tmp = Float64(Float64(Float64(Float64(2.0 + Float64(0.5 * t_9)) - t_10) + t_5) + t_12); elseif (t_9 <= 5.6e+14) tmp = Float64(Float64(Float64(t_13 + sqrt(Float64(1.0 + t_9))) - t_10) + t_12); else tmp = Float64(Float64(Float64(1.0 / Float64(t_7 + t_13)) + t_5) + t_12); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = max(min(x, y), z); t_3 = max(max(x, y), t_2); t_4 = min(max(x, y), t_2); t_5 = sqrt((t_3 + 1.0)) - sqrt(t_3); t_6 = min(t_1, t); t_7 = sqrt(t_6); t_8 = max(t_1, t); t_9 = min(t_4, t_8); t_10 = t_7 + sqrt(t_9); t_11 = max(t_4, t_8); t_12 = sqrt((t_11 + 1.0)) - sqrt(t_11); t_13 = sqrt((1.0 + t_6)); tmp = 0.0; if (t_9 <= 1.95e-6) tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12; elseif (t_9 <= 5.6e+14) tmp = ((t_13 + sqrt((1.0 + t_9))) - t_10) + t_12; else tmp = ((1.0 / (t_7 + t_13)) + t_5) + t_12; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Max[x, y], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(t$95$3 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Min[t$95$1, t], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$9 = N[Min[t$95$4, t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[(t$95$7 + N[Sqrt[t$95$9], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Max[t$95$4, t$95$8], $MachinePrecision]}, Block[{t$95$12 = N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$11], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[N[(1 + t$95$6), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$9, 287769207549869/147573952589676412928], N[(N[(N[(N[(2 + N[(1/2 * t$95$9), $MachinePrecision]), $MachinePrecision] - t$95$10), $MachinePrecision] + t$95$5), $MachinePrecision] + t$95$12), $MachinePrecision], If[LessEqual[t$95$9, 560000000000000], N[(N[(N[(t$95$13 + N[Sqrt[N[(1 + t$95$9), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$10), $MachinePrecision] + t$95$12), $MachinePrecision], N[(N[(N[(1 / N[(t$95$7 + t$95$13), $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + t$95$12), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_2\right)\\
t_4 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_2\right)\\
t_5 := \sqrt{t\_3 + 1} - \sqrt{t\_3}\\
t_6 := \mathsf{min}\left(t\_1, t\right)\\
t_7 := \sqrt{t\_6}\\
t_8 := \mathsf{max}\left(t\_1, t\right)\\
t_9 := \mathsf{min}\left(t\_4, t\_8\right)\\
t_10 := t\_7 + \sqrt{t\_9}\\
t_11 := \mathsf{max}\left(t\_4, t\_8\right)\\
t_12 := \sqrt{t\_11 + 1} - \sqrt{t\_11}\\
t_13 := \sqrt{1 + t\_6}\\
\mathbf{if}\;t\_9 \leq \frac{287769207549869}{147573952589676412928}:\\
\;\;\;\;\left(\left(\left(2 + \frac{1}{2} \cdot t\_9\right) - t\_10\right) + t\_5\right) + t\_12\\
\mathbf{elif}\;t\_9 \leq 560000000000000:\\
\;\;\;\;\left(\left(t\_13 + \sqrt{1 + t\_9}\right) - t\_10\right) + t\_12\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_7 + t\_13} + t\_5\right) + t\_12\\
\end{array}
if y < 1.95e-6Initial program 91.6%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6435.2%
Applied rewrites35.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6426.1%
Applied rewrites26.1%
if 1.95e-6 < y < 5.6e14Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6429.2%
Applied rewrites29.2%
if 5.6e14 < y Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmax t_1 t))
(t_3 (fmax (fmin x y) z))
(t_4 (fmax (fmax x y) t_3))
(t_5 (fmin (fmax x y) t_3))
(t_6 (fmin t_5 t_2))
(t_7 (fmax t_5 t_2))
(t_8 (- (sqrt (+ t_7 1)) (sqrt t_7)))
(t_9 (fmin t_1 t))
(t_10 (sqrt t_9))
(t_11 (+ t_10 (sqrt t_6)))
(t_12 (- (sqrt (+ t_4 1)) (sqrt t_4)))
(t_13 (sqrt (+ 1 t_9))))
(if (<= t_6 287769207549869/147573952589676412928)
(+ (+ (- (+ 2 (* 1/2 t_6)) t_11) t_12) t_8)
(if (<= t_6 560000000000000)
(-
(+
t_13
(+ (sqrt (+ 1 t_6)) (* 1/2 (/ 1 (* t_7 (sqrt (/ 1 t_7)))))))
t_11)
(+ (+ (/ 1 (+ t_10 t_13)) t_12) t_8)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(t_1, t);
double t_3 = fmax(fmin(x, y), z);
double t_4 = fmax(fmax(x, y), t_3);
double t_5 = fmin(fmax(x, y), t_3);
double t_6 = fmin(t_5, t_2);
double t_7 = fmax(t_5, t_2);
double t_8 = sqrt((t_7 + 1.0)) - sqrt(t_7);
double t_9 = fmin(t_1, t);
double t_10 = sqrt(t_9);
double t_11 = t_10 + sqrt(t_6);
double t_12 = sqrt((t_4 + 1.0)) - sqrt(t_4);
double t_13 = sqrt((1.0 + t_9));
double tmp;
if (t_6 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_6)) - t_11) + t_12) + t_8;
} else if (t_6 <= 5.6e+14) {
tmp = (t_13 + (sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_7 * sqrt((1.0 / t_7))))))) - t_11;
} else {
tmp = ((1.0 / (t_10 + t_13)) + t_12) + t_8;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(fmin(x, y), z)
t_2 = fmax(t_1, t)
t_3 = fmax(fmin(x, y), z)
t_4 = fmax(fmax(x, y), t_3)
t_5 = fmin(fmax(x, y), t_3)
t_6 = fmin(t_5, t_2)
t_7 = fmax(t_5, t_2)
t_8 = sqrt((t_7 + 1.0d0)) - sqrt(t_7)
t_9 = fmin(t_1, t)
t_10 = sqrt(t_9)
t_11 = t_10 + sqrt(t_6)
t_12 = sqrt((t_4 + 1.0d0)) - sqrt(t_4)
t_13 = sqrt((1.0d0 + t_9))
if (t_6 <= 1.95d-6) then
tmp = (((2.0d0 + (0.5d0 * t_6)) - t_11) + t_12) + t_8
else if (t_6 <= 5.6d+14) then
tmp = (t_13 + (sqrt((1.0d0 + t_6)) + (0.5d0 * (1.0d0 / (t_7 * sqrt((1.0d0 / t_7))))))) - t_11
else
tmp = ((1.0d0 / (t_10 + t_13)) + t_12) + t_8
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(t_1, t);
double t_3 = fmax(fmin(x, y), z);
double t_4 = fmax(fmax(x, y), t_3);
double t_5 = fmin(fmax(x, y), t_3);
double t_6 = fmin(t_5, t_2);
double t_7 = fmax(t_5, t_2);
double t_8 = Math.sqrt((t_7 + 1.0)) - Math.sqrt(t_7);
double t_9 = fmin(t_1, t);
double t_10 = Math.sqrt(t_9);
double t_11 = t_10 + Math.sqrt(t_6);
double t_12 = Math.sqrt((t_4 + 1.0)) - Math.sqrt(t_4);
double t_13 = Math.sqrt((1.0 + t_9));
double tmp;
if (t_6 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_6)) - t_11) + t_12) + t_8;
} else if (t_6 <= 5.6e+14) {
tmp = (t_13 + (Math.sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_7 * Math.sqrt((1.0 / t_7))))))) - t_11;
} else {
tmp = ((1.0 / (t_10 + t_13)) + t_12) + t_8;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmax(t_1, t) t_3 = fmax(fmin(x, y), z) t_4 = fmax(fmax(x, y), t_3) t_5 = fmin(fmax(x, y), t_3) t_6 = fmin(t_5, t_2) t_7 = fmax(t_5, t_2) t_8 = math.sqrt((t_7 + 1.0)) - math.sqrt(t_7) t_9 = fmin(t_1, t) t_10 = math.sqrt(t_9) t_11 = t_10 + math.sqrt(t_6) t_12 = math.sqrt((t_4 + 1.0)) - math.sqrt(t_4) t_13 = math.sqrt((1.0 + t_9)) tmp = 0 if t_6 <= 1.95e-6: tmp = (((2.0 + (0.5 * t_6)) - t_11) + t_12) + t_8 elif t_6 <= 5.6e+14: tmp = (t_13 + (math.sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_7 * math.sqrt((1.0 / t_7))))))) - t_11 else: tmp = ((1.0 / (t_10 + t_13)) + t_12) + t_8 return tmp
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmax(t_1, t) t_3 = fmax(fmin(x, y), z) t_4 = fmax(fmax(x, y), t_3) t_5 = fmin(fmax(x, y), t_3) t_6 = fmin(t_5, t_2) t_7 = fmax(t_5, t_2) t_8 = Float64(sqrt(Float64(t_7 + 1.0)) - sqrt(t_7)) t_9 = fmin(t_1, t) t_10 = sqrt(t_9) t_11 = Float64(t_10 + sqrt(t_6)) t_12 = Float64(sqrt(Float64(t_4 + 1.0)) - sqrt(t_4)) t_13 = sqrt(Float64(1.0 + t_9)) tmp = 0.0 if (t_6 <= 1.95e-6) tmp = Float64(Float64(Float64(Float64(2.0 + Float64(0.5 * t_6)) - t_11) + t_12) + t_8); elseif (t_6 <= 5.6e+14) tmp = Float64(Float64(t_13 + Float64(sqrt(Float64(1.0 + t_6)) + Float64(0.5 * Float64(1.0 / Float64(t_7 * sqrt(Float64(1.0 / t_7))))))) - t_11); else tmp = Float64(Float64(Float64(1.0 / Float64(t_10 + t_13)) + t_12) + t_8); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = max(t_1, t); t_3 = max(min(x, y), z); t_4 = max(max(x, y), t_3); t_5 = min(max(x, y), t_3); t_6 = min(t_5, t_2); t_7 = max(t_5, t_2); t_8 = sqrt((t_7 + 1.0)) - sqrt(t_7); t_9 = min(t_1, t); t_10 = sqrt(t_9); t_11 = t_10 + sqrt(t_6); t_12 = sqrt((t_4 + 1.0)) - sqrt(t_4); t_13 = sqrt((1.0 + t_9)); tmp = 0.0; if (t_6 <= 1.95e-6) tmp = (((2.0 + (0.5 * t_6)) - t_11) + t_12) + t_8; elseif (t_6 <= 5.6e+14) tmp = (t_13 + (sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_7 * sqrt((1.0 / t_7))))))) - t_11; else tmp = ((1.0 / (t_10 + t_13)) + t_12) + t_8; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[x, y], $MachinePrecision], t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Min[N[Max[x, y], $MachinePrecision], t$95$3], $MachinePrecision]}, Block[{t$95$6 = N[Min[t$95$5, t$95$2], $MachinePrecision]}, Block[{t$95$7 = N[Max[t$95$5, t$95$2], $MachinePrecision]}, Block[{t$95$8 = N[(N[Sqrt[N[(t$95$7 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$7], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$9 = N[Min[t$95$1, t], $MachinePrecision]}, Block[{t$95$10 = N[Sqrt[t$95$9], $MachinePrecision]}, Block[{t$95$11 = N[(t$95$10 + N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$12 = N[(N[Sqrt[N[(t$95$4 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[N[(1 + t$95$9), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$6, 287769207549869/147573952589676412928], N[(N[(N[(N[(2 + N[(1/2 * t$95$6), $MachinePrecision]), $MachinePrecision] - t$95$11), $MachinePrecision] + t$95$12), $MachinePrecision] + t$95$8), $MachinePrecision], If[LessEqual[t$95$6, 560000000000000], N[(N[(t$95$13 + N[(N[Sqrt[N[(1 + t$95$6), $MachinePrecision]], $MachinePrecision] + N[(1/2 * N[(1 / N[(t$95$7 * N[Sqrt[N[(1 / t$95$7), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$11), $MachinePrecision], N[(N[(N[(1 / N[(t$95$10 + t$95$13), $MachinePrecision]), $MachinePrecision] + t$95$12), $MachinePrecision] + t$95$8), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(t\_1, t\right)\\
t_3 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_3\right)\\
t_5 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_3\right)\\
t_6 := \mathsf{min}\left(t\_5, t\_2\right)\\
t_7 := \mathsf{max}\left(t\_5, t\_2\right)\\
t_8 := \sqrt{t\_7 + 1} - \sqrt{t\_7}\\
t_9 := \mathsf{min}\left(t\_1, t\right)\\
t_10 := \sqrt{t\_9}\\
t_11 := t\_10 + \sqrt{t\_6}\\
t_12 := \sqrt{t\_4 + 1} - \sqrt{t\_4}\\
t_13 := \sqrt{1 + t\_9}\\
\mathbf{if}\;t\_6 \leq \frac{287769207549869}{147573952589676412928}:\\
\;\;\;\;\left(\left(\left(2 + \frac{1}{2} \cdot t\_6\right) - t\_11\right) + t\_12\right) + t\_8\\
\mathbf{elif}\;t\_6 \leq 560000000000000:\\
\;\;\;\;\left(t\_13 + \left(\sqrt{1 + t\_6} + \frac{1}{2} \cdot \frac{1}{t\_7 \cdot \sqrt{\frac{1}{t\_7}}}\right)\right) - t\_11\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_10 + t\_13} + t\_12\right) + t\_8\\
\end{array}
if y < 1.95e-6Initial program 91.6%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6435.2%
Applied rewrites35.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6426.1%
Applied rewrites26.1%
if 1.95e-6 < y < 5.6e14Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in t around inf
lower--.f64N/A
Applied rewrites12.3%
if 5.6e14 < y Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (sqrt t_1))
(t_3 (fmin (fmin x y) z))
(t_4 (fmin t_3 t))
(t_5 (fmax t_3 t))
(t_6 (fmax (fmax x y) t_5))
(t_7 (sqrt t_6))
(t_8 (fmin (fmax x y) t_5))
(t_9 (sqrt t_8))
(t_10 (sqrt t_4)))
(if (<=
(- (sqrt (+ t_8 1)) t_9)
3022314549036573/151115727451828646838272)
(+
(+ (/ 1 (+ t_10 (sqrt (+ 1 t_4)))) (- (sqrt (+ t_1 1)) t_2))
(- (sqrt (+ t_6 1)) t_7))
(+
(- t_10)
(-
(sqrt (- t_4 -1))
(-
(- (- t_9 (- (sqrt (- t_1 -1)) t_2)) (sqrt (- t_8 -1)))
(- (sqrt (- t_6 -1)) t_7)))))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = sqrt(t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = sqrt(t_8);
double t_10 = sqrt(t_4);
double tmp;
if ((sqrt((t_8 + 1.0)) - t_9) <= 2e-8) {
tmp = ((1.0 / (t_10 + sqrt((1.0 + t_4)))) + (sqrt((t_1 + 1.0)) - t_2)) + (sqrt((t_6 + 1.0)) - t_7);
} else {
tmp = -t_10 + (sqrt((t_4 - -1.0)) - (((t_9 - (sqrt((t_1 - -1.0)) - t_2)) - sqrt((t_8 - -1.0))) - (sqrt((t_6 - -1.0)) - t_7)));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = sqrt(t_1)
t_3 = fmin(fmin(x, y), z)
t_4 = fmin(t_3, t)
t_5 = fmax(t_3, t)
t_6 = fmax(fmax(x, y), t_5)
t_7 = sqrt(t_6)
t_8 = fmin(fmax(x, y), t_5)
t_9 = sqrt(t_8)
t_10 = sqrt(t_4)
if ((sqrt((t_8 + 1.0d0)) - t_9) <= 2d-8) then
tmp = ((1.0d0 / (t_10 + sqrt((1.0d0 + t_4)))) + (sqrt((t_1 + 1.0d0)) - t_2)) + (sqrt((t_6 + 1.0d0)) - t_7)
else
tmp = -t_10 + (sqrt((t_4 - (-1.0d0))) - (((t_9 - (sqrt((t_1 - (-1.0d0))) - t_2)) - sqrt((t_8 - (-1.0d0)))) - (sqrt((t_6 - (-1.0d0))) - t_7)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = Math.sqrt(t_1);
double t_3 = fmin(fmin(x, y), z);
double t_4 = fmin(t_3, t);
double t_5 = fmax(t_3, t);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = Math.sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = Math.sqrt(t_8);
double t_10 = Math.sqrt(t_4);
double tmp;
if ((Math.sqrt((t_8 + 1.0)) - t_9) <= 2e-8) {
tmp = ((1.0 / (t_10 + Math.sqrt((1.0 + t_4)))) + (Math.sqrt((t_1 + 1.0)) - t_2)) + (Math.sqrt((t_6 + 1.0)) - t_7);
} else {
tmp = -t_10 + (Math.sqrt((t_4 - -1.0)) - (((t_9 - (Math.sqrt((t_1 - -1.0)) - t_2)) - Math.sqrt((t_8 - -1.0))) - (Math.sqrt((t_6 - -1.0)) - t_7)));
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = math.sqrt(t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmax(fmax(x, y), t_5) t_7 = math.sqrt(t_6) t_8 = fmin(fmax(x, y), t_5) t_9 = math.sqrt(t_8) t_10 = math.sqrt(t_4) tmp = 0 if (math.sqrt((t_8 + 1.0)) - t_9) <= 2e-8: tmp = ((1.0 / (t_10 + math.sqrt((1.0 + t_4)))) + (math.sqrt((t_1 + 1.0)) - t_2)) + (math.sqrt((t_6 + 1.0)) - t_7) else: tmp = -t_10 + (math.sqrt((t_4 - -1.0)) - (((t_9 - (math.sqrt((t_1 - -1.0)) - t_2)) - math.sqrt((t_8 - -1.0))) - (math.sqrt((t_6 - -1.0)) - t_7))) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = sqrt(t_1) t_3 = fmin(fmin(x, y), z) t_4 = fmin(t_3, t) t_5 = fmax(t_3, t) t_6 = fmax(fmax(x, y), t_5) t_7 = sqrt(t_6) t_8 = fmin(fmax(x, y), t_5) t_9 = sqrt(t_8) t_10 = sqrt(t_4) tmp = 0.0 if (Float64(sqrt(Float64(t_8 + 1.0)) - t_9) <= 2e-8) tmp = Float64(Float64(Float64(1.0 / Float64(t_10 + sqrt(Float64(1.0 + t_4)))) + Float64(sqrt(Float64(t_1 + 1.0)) - t_2)) + Float64(sqrt(Float64(t_6 + 1.0)) - t_7)); else tmp = Float64(Float64(-t_10) + Float64(sqrt(Float64(t_4 - -1.0)) - Float64(Float64(Float64(t_9 - Float64(sqrt(Float64(t_1 - -1.0)) - t_2)) - sqrt(Float64(t_8 - -1.0))) - Float64(sqrt(Float64(t_6 - -1.0)) - t_7)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = sqrt(t_1); t_3 = min(min(x, y), z); t_4 = min(t_3, t); t_5 = max(t_3, t); t_6 = max(max(x, y), t_5); t_7 = sqrt(t_6); t_8 = min(max(x, y), t_5); t_9 = sqrt(t_8); t_10 = sqrt(t_4); tmp = 0.0; if ((sqrt((t_8 + 1.0)) - t_9) <= 2e-8) tmp = ((1.0 / (t_10 + sqrt((1.0 + t_4)))) + (sqrt((t_1 + 1.0)) - t_2)) + (sqrt((t_6 + 1.0)) - t_7); else tmp = -t_10 + (sqrt((t_4 - -1.0)) - (((t_9 - (sqrt((t_1 - -1.0)) - t_2)) - sqrt((t_8 - -1.0))) - (sqrt((t_6 - -1.0)) - t_7))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$4 = N[Min[t$95$3, t], $MachinePrecision]}, Block[{t$95$5 = N[Max[t$95$3, t], $MachinePrecision]}, Block[{t$95$6 = N[Max[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[Min[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$9 = N[Sqrt[t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[Sqrt[t$95$4], $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(t$95$8 + 1), $MachinePrecision]], $MachinePrecision] - t$95$9), $MachinePrecision], 3022314549036573/151115727451828646838272], N[(N[(N[(1 / N[(t$95$10 + N[Sqrt[N[(1 + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$1 + 1), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - t$95$7), $MachinePrecision]), $MachinePrecision], N[((-t$95$10) + N[(N[Sqrt[N[(t$95$4 - -1), $MachinePrecision]], $MachinePrecision] - N[(N[(N[(t$95$9 - N[(N[Sqrt[N[(t$95$1 - -1), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(t$95$8 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[N[(t$95$6 - -1), $MachinePrecision]], $MachinePrecision] - t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \sqrt{t\_1}\\
t_3 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_4 := \mathsf{min}\left(t\_3, t\right)\\
t_5 := \mathsf{max}\left(t\_3, t\right)\\
t_6 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_7 := \sqrt{t\_6}\\
t_8 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_9 := \sqrt{t\_8}\\
t_10 := \sqrt{t\_4}\\
\mathbf{if}\;\sqrt{t\_8 + 1} - t\_9 \leq \frac{3022314549036573}{151115727451828646838272}:\\
\;\;\;\;\left(\frac{1}{t\_10 + \sqrt{1 + t\_4}} + \left(\sqrt{t\_1 + 1} - t\_2\right)\right) + \left(\sqrt{t\_6 + 1} - t\_7\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\_10\right) + \left(\sqrt{t\_4 - -1} - \left(\left(\left(t\_9 - \left(\sqrt{t\_1 - -1} - t\_2\right)\right) - \sqrt{t\_8 - -1}\right) - \left(\sqrt{t\_6 - -1} - t\_7\right)\right)\right)\\
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2e-8Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
if 2e-8 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 91.6%
Applied rewrites43.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmin (fmin x y) z))
(t_3 (fmax t_2 t))
(t_4 (fmax (fmax x y) t_3))
(t_5 (- (sqrt (+ t_4 1)) (sqrt t_4)))
(t_6 (- (sqrt (+ t_1 1)) (sqrt t_1)))
(t_7 (fmin (fmax x y) t_3))
(t_8 (fmin t_2 t))
(t_9 (sqrt t_8)))
(if (<= t_7 560000000000000)
(+
(+
(+ (- (sqrt (+ t_8 1)) t_9) (- (sqrt (+ t_7 1)) (sqrt t_7)))
t_6)
t_5)
(+ (+ (/ 1 (+ t_9 (sqrt (+ 1 t_8)))) t_6) t_5))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmax(t_2, t);
double t_4 = fmax(fmax(x, y), t_3);
double t_5 = sqrt((t_4 + 1.0)) - sqrt(t_4);
double t_6 = sqrt((t_1 + 1.0)) - sqrt(t_1);
double t_7 = fmin(fmax(x, y), t_3);
double t_8 = fmin(t_2, t);
double t_9 = sqrt(t_8);
double tmp;
if (t_7 <= 5.6e+14) {
tmp = (((sqrt((t_8 + 1.0)) - t_9) + (sqrt((t_7 + 1.0)) - sqrt(t_7))) + t_6) + t_5;
} else {
tmp = ((1.0 / (t_9 + sqrt((1.0 + t_8)))) + t_6) + t_5;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmin(fmin(x, y), z)
t_3 = fmax(t_2, t)
t_4 = fmax(fmax(x, y), t_3)
t_5 = sqrt((t_4 + 1.0d0)) - sqrt(t_4)
t_6 = sqrt((t_1 + 1.0d0)) - sqrt(t_1)
t_7 = fmin(fmax(x, y), t_3)
t_8 = fmin(t_2, t)
t_9 = sqrt(t_8)
if (t_7 <= 5.6d+14) then
tmp = (((sqrt((t_8 + 1.0d0)) - t_9) + (sqrt((t_7 + 1.0d0)) - sqrt(t_7))) + t_6) + t_5
else
tmp = ((1.0d0 / (t_9 + sqrt((1.0d0 + t_8)))) + t_6) + t_5
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmax(t_2, t);
double t_4 = fmax(fmax(x, y), t_3);
double t_5 = Math.sqrt((t_4 + 1.0)) - Math.sqrt(t_4);
double t_6 = Math.sqrt((t_1 + 1.0)) - Math.sqrt(t_1);
double t_7 = fmin(fmax(x, y), t_3);
double t_8 = fmin(t_2, t);
double t_9 = Math.sqrt(t_8);
double tmp;
if (t_7 <= 5.6e+14) {
tmp = (((Math.sqrt((t_8 + 1.0)) - t_9) + (Math.sqrt((t_7 + 1.0)) - Math.sqrt(t_7))) + t_6) + t_5;
} else {
tmp = ((1.0 / (t_9 + Math.sqrt((1.0 + t_8)))) + t_6) + t_5;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmin(fmin(x, y), z) t_3 = fmax(t_2, t) t_4 = fmax(fmax(x, y), t_3) t_5 = math.sqrt((t_4 + 1.0)) - math.sqrt(t_4) t_6 = math.sqrt((t_1 + 1.0)) - math.sqrt(t_1) t_7 = fmin(fmax(x, y), t_3) t_8 = fmin(t_2, t) t_9 = math.sqrt(t_8) tmp = 0 if t_7 <= 5.6e+14: tmp = (((math.sqrt((t_8 + 1.0)) - t_9) + (math.sqrt((t_7 + 1.0)) - math.sqrt(t_7))) + t_6) + t_5 else: tmp = ((1.0 / (t_9 + math.sqrt((1.0 + t_8)))) + t_6) + t_5 return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmin(fmin(x, y), z) t_3 = fmax(t_2, t) t_4 = fmax(fmax(x, y), t_3) t_5 = Float64(sqrt(Float64(t_4 + 1.0)) - sqrt(t_4)) t_6 = Float64(sqrt(Float64(t_1 + 1.0)) - sqrt(t_1)) t_7 = fmin(fmax(x, y), t_3) t_8 = fmin(t_2, t) t_9 = sqrt(t_8) tmp = 0.0 if (t_7 <= 5.6e+14) tmp = Float64(Float64(Float64(Float64(sqrt(Float64(t_8 + 1.0)) - t_9) + Float64(sqrt(Float64(t_7 + 1.0)) - sqrt(t_7))) + t_6) + t_5); else tmp = Float64(Float64(Float64(1.0 / Float64(t_9 + sqrt(Float64(1.0 + t_8)))) + t_6) + t_5); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = min(min(x, y), z); t_3 = max(t_2, t); t_4 = max(max(x, y), t_3); t_5 = sqrt((t_4 + 1.0)) - sqrt(t_4); t_6 = sqrt((t_1 + 1.0)) - sqrt(t_1); t_7 = min(max(x, y), t_3); t_8 = min(t_2, t); t_9 = sqrt(t_8); tmp = 0.0; if (t_7 <= 5.6e+14) tmp = (((sqrt((t_8 + 1.0)) - t_9) + (sqrt((t_7 + 1.0)) - sqrt(t_7))) + t_6) + t_5; else tmp = ((1.0 / (t_9 + sqrt((1.0 + t_8)))) + t_6) + t_5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$3 = N[Max[t$95$2, t], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[x, y], $MachinePrecision], t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(t$95$4 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[Sqrt[N[(t$95$1 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Min[N[Max[x, y], $MachinePrecision], t$95$3], $MachinePrecision]}, Block[{t$95$8 = N[Min[t$95$2, t], $MachinePrecision]}, Block[{t$95$9 = N[Sqrt[t$95$8], $MachinePrecision]}, If[LessEqual[t$95$7, 560000000000000], N[(N[(N[(N[(N[Sqrt[N[(t$95$8 + 1), $MachinePrecision]], $MachinePrecision] - t$95$9), $MachinePrecision] + N[(N[Sqrt[N[(t$95$7 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$7], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision] + t$95$5), $MachinePrecision], N[(N[(N[(1 / N[(t$95$9 + N[Sqrt[N[(1 + t$95$8), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision] + t$95$5), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_3 := \mathsf{max}\left(t\_2, t\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_3\right)\\
t_5 := \sqrt{t\_4 + 1} - \sqrt{t\_4}\\
t_6 := \sqrt{t\_1 + 1} - \sqrt{t\_1}\\
t_7 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_3\right)\\
t_8 := \mathsf{min}\left(t\_2, t\right)\\
t_9 := \sqrt{t\_8}\\
\mathbf{if}\;t\_7 \leq 560000000000000:\\
\;\;\;\;\left(\left(\left(\sqrt{t\_8 + 1} - t\_9\right) + \left(\sqrt{t\_7 + 1} - \sqrt{t\_7}\right)\right) + t\_6\right) + t\_5\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_9 + \sqrt{1 + t\_8}} + t\_6\right) + t\_5\\
\end{array}
if y < 5.6e14Initial program 91.6%
if 5.6e14 < y Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmax (fmax x y) t_1))
(t_3 (fmin (fmax x y) t_1))
(t_4 (- (sqrt (+ t_2 1)) (sqrt t_2)))
(t_5 (fmin (fmin x y) z))
(t_6 (fmin t_5 t))
(t_7 (sqrt t_6))
(t_8 (fmax t_5 t))
(t_9 (fmax t_3 t_8))
(t_10 (- (sqrt (+ t_9 1)) (sqrt t_9)))
(t_11 (fmin t_3 t_8))
(t_12 (sqrt t_11)))
(if (<=
(+
(+
(+ (- (sqrt (+ t_6 1)) t_7) (- (sqrt (+ t_11 1)) t_12))
t_4)
t_10)
4503599717442489/4503599627370496)
(+ (+ (/ 1 (+ t_7 (sqrt (+ 1 t_6)))) t_4) t_10)
(+ (+ (- (+ 1 (sqrt (+ 1 t_11))) (+ t_7 t_12)) t_4) t_10))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = sqrt((t_2 + 1.0)) - sqrt(t_2);
double t_5 = fmin(fmin(x, y), z);
double t_6 = fmin(t_5, t);
double t_7 = sqrt(t_6);
double t_8 = fmax(t_5, t);
double t_9 = fmax(t_3, t_8);
double t_10 = sqrt((t_9 + 1.0)) - sqrt(t_9);
double t_11 = fmin(t_3, t_8);
double t_12 = sqrt(t_11);
double tmp;
if (((((sqrt((t_6 + 1.0)) - t_7) + (sqrt((t_11 + 1.0)) - t_12)) + t_4) + t_10) <= 1.00000002) {
tmp = ((1.0 / (t_7 + sqrt((1.0 + t_6)))) + t_4) + t_10;
} else {
tmp = (((1.0 + sqrt((1.0 + t_11))) - (t_7 + t_12)) + t_4) + t_10;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmax(fmax(x, y), t_1)
t_3 = fmin(fmax(x, y), t_1)
t_4 = sqrt((t_2 + 1.0d0)) - sqrt(t_2)
t_5 = fmin(fmin(x, y), z)
t_6 = fmin(t_5, t)
t_7 = sqrt(t_6)
t_8 = fmax(t_5, t)
t_9 = fmax(t_3, t_8)
t_10 = sqrt((t_9 + 1.0d0)) - sqrt(t_9)
t_11 = fmin(t_3, t_8)
t_12 = sqrt(t_11)
if (((((sqrt((t_6 + 1.0d0)) - t_7) + (sqrt((t_11 + 1.0d0)) - t_12)) + t_4) + t_10) <= 1.00000002d0) then
tmp = ((1.0d0 / (t_7 + sqrt((1.0d0 + t_6)))) + t_4) + t_10
else
tmp = (((1.0d0 + sqrt((1.0d0 + t_11))) - (t_7 + t_12)) + t_4) + t_10
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = Math.sqrt((t_2 + 1.0)) - Math.sqrt(t_2);
double t_5 = fmin(fmin(x, y), z);
double t_6 = fmin(t_5, t);
double t_7 = Math.sqrt(t_6);
double t_8 = fmax(t_5, t);
double t_9 = fmax(t_3, t_8);
double t_10 = Math.sqrt((t_9 + 1.0)) - Math.sqrt(t_9);
double t_11 = fmin(t_3, t_8);
double t_12 = Math.sqrt(t_11);
double tmp;
if (((((Math.sqrt((t_6 + 1.0)) - t_7) + (Math.sqrt((t_11 + 1.0)) - t_12)) + t_4) + t_10) <= 1.00000002) {
tmp = ((1.0 / (t_7 + Math.sqrt((1.0 + t_6)))) + t_4) + t_10;
} else {
tmp = (((1.0 + Math.sqrt((1.0 + t_11))) - (t_7 + t_12)) + t_4) + t_10;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = math.sqrt((t_2 + 1.0)) - math.sqrt(t_2) t_5 = fmin(fmin(x, y), z) t_6 = fmin(t_5, t) t_7 = math.sqrt(t_6) t_8 = fmax(t_5, t) t_9 = fmax(t_3, t_8) t_10 = math.sqrt((t_9 + 1.0)) - math.sqrt(t_9) t_11 = fmin(t_3, t_8) t_12 = math.sqrt(t_11) tmp = 0 if ((((math.sqrt((t_6 + 1.0)) - t_7) + (math.sqrt((t_11 + 1.0)) - t_12)) + t_4) + t_10) <= 1.00000002: tmp = ((1.0 / (t_7 + math.sqrt((1.0 + t_6)))) + t_4) + t_10 else: tmp = (((1.0 + math.sqrt((1.0 + t_11))) - (t_7 + t_12)) + t_4) + t_10 return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = Float64(sqrt(Float64(t_2 + 1.0)) - sqrt(t_2)) t_5 = fmin(fmin(x, y), z) t_6 = fmin(t_5, t) t_7 = sqrt(t_6) t_8 = fmax(t_5, t) t_9 = fmax(t_3, t_8) t_10 = Float64(sqrt(Float64(t_9 + 1.0)) - sqrt(t_9)) t_11 = fmin(t_3, t_8) t_12 = sqrt(t_11) tmp = 0.0 if (Float64(Float64(Float64(Float64(sqrt(Float64(t_6 + 1.0)) - t_7) + Float64(sqrt(Float64(t_11 + 1.0)) - t_12)) + t_4) + t_10) <= 1.00000002) tmp = Float64(Float64(Float64(1.0 / Float64(t_7 + sqrt(Float64(1.0 + t_6)))) + t_4) + t_10); else tmp = Float64(Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + t_11))) - Float64(t_7 + t_12)) + t_4) + t_10); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = max(max(x, y), t_1); t_3 = min(max(x, y), t_1); t_4 = sqrt((t_2 + 1.0)) - sqrt(t_2); t_5 = min(min(x, y), z); t_6 = min(t_5, t); t_7 = sqrt(t_6); t_8 = max(t_5, t); t_9 = max(t_3, t_8); t_10 = sqrt((t_9 + 1.0)) - sqrt(t_9); t_11 = min(t_3, t_8); t_12 = sqrt(t_11); tmp = 0.0; if (((((sqrt((t_6 + 1.0)) - t_7) + (sqrt((t_11 + 1.0)) - t_12)) + t_4) + t_10) <= 1.00000002) tmp = ((1.0 / (t_7 + sqrt((1.0 + t_6)))) + t_4) + t_10; else tmp = (((1.0 + sqrt((1.0 + t_11))) - (t_7 + t_12)) + t_4) + t_10; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$2 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$6 = N[Min[t$95$5, t], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$5, t], $MachinePrecision]}, Block[{t$95$9 = N[Max[t$95$3, t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[(N[Sqrt[N[(t$95$9 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$9], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Min[t$95$3, t$95$8], $MachinePrecision]}, Block[{t$95$12 = N[Sqrt[t$95$11], $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - t$95$7), $MachinePrecision] + N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - t$95$12), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + t$95$10), $MachinePrecision], 4503599717442489/4503599627370496], N[(N[(N[(1 / N[(t$95$7 + N[Sqrt[N[(1 + t$95$6), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + t$95$10), $MachinePrecision], N[(N[(N[(N[(1 + N[Sqrt[N[(1 + t$95$11), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$7 + t$95$12), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + t$95$10), $MachinePrecision]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_4 := \sqrt{t\_2 + 1} - \sqrt{t\_2}\\
t_5 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_6 := \mathsf{min}\left(t\_5, t\right)\\
t_7 := \sqrt{t\_6}\\
t_8 := \mathsf{max}\left(t\_5, t\right)\\
t_9 := \mathsf{max}\left(t\_3, t\_8\right)\\
t_10 := \sqrt{t\_9 + 1} - \sqrt{t\_9}\\
t_11 := \mathsf{min}\left(t\_3, t\_8\right)\\
t_12 := \sqrt{t\_11}\\
\mathbf{if}\;\left(\left(\left(\sqrt{t\_6 + 1} - t\_7\right) + \left(\sqrt{t\_11 + 1} - t\_12\right)\right) + t\_4\right) + t\_10 \leq \frac{4503599717442489}{4503599627370496}:\\
\;\;\;\;\left(\frac{1}{t\_7 + \sqrt{1 + t\_6}} + t\_4\right) + t\_10\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(1 + \sqrt{1 + t\_11}\right) - \left(t\_7 + t\_12\right)\right) + t\_4\right) + t\_10\\
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 1.0000000200000001Initial program 91.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f32N/A
lower-*.f32N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-evalN/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval72.6%
Applied rewrites72.6%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-unsound-*.f64N/A
lower-unsound-+.f6472.7%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6472.7%
Applied rewrites72.7%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites92.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-+.f6452.7%
Applied rewrites52.7%
if 1.0000000200000001 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmax (fmin x y) z))
(t_3 (fmax (fmax x y) t_2))
(t_4 (fmin (fmax x y) t_2))
(t_5 (- (sqrt (+ t_3 1)) (sqrt t_3)))
(t_6 (fmin t_1 t))
(t_7 (sqrt t_6))
(t_8 (fmax t_1 t))
(t_9 (fmin t_4 t_8))
(t_10 (+ t_7 (sqrt t_9)))
(t_11 (fmax t_4 t_8))
(t_12 (- (sqrt (+ t_11 1)) (sqrt t_11)))
(t_13 (sqrt (+ 1 t_6))))
(if (<= t_9 287769207549869/147573952589676412928)
(+ (+ (- (+ 2 (* 1/2 t_9)) t_10) t_5) t_12)
(if (<= t_9 560000000000000)
(+ (- (+ t_13 (sqrt (+ 1 t_9))) t_10) t_12)
(+ (+ (- t_13 t_7) t_5) t_12)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmin(x, y), z);
double t_3 = fmax(fmax(x, y), t_2);
double t_4 = fmin(fmax(x, y), t_2);
double t_5 = sqrt((t_3 + 1.0)) - sqrt(t_3);
double t_6 = fmin(t_1, t);
double t_7 = sqrt(t_6);
double t_8 = fmax(t_1, t);
double t_9 = fmin(t_4, t_8);
double t_10 = t_7 + sqrt(t_9);
double t_11 = fmax(t_4, t_8);
double t_12 = sqrt((t_11 + 1.0)) - sqrt(t_11);
double t_13 = sqrt((1.0 + t_6));
double tmp;
if (t_9 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12;
} else if (t_9 <= 5.6e+14) {
tmp = ((t_13 + sqrt((1.0 + t_9))) - t_10) + t_12;
} else {
tmp = ((t_13 - t_7) + t_5) + t_12;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(fmin(x, y), z)
t_2 = fmax(fmin(x, y), z)
t_3 = fmax(fmax(x, y), t_2)
t_4 = fmin(fmax(x, y), t_2)
t_5 = sqrt((t_3 + 1.0d0)) - sqrt(t_3)
t_6 = fmin(t_1, t)
t_7 = sqrt(t_6)
t_8 = fmax(t_1, t)
t_9 = fmin(t_4, t_8)
t_10 = t_7 + sqrt(t_9)
t_11 = fmax(t_4, t_8)
t_12 = sqrt((t_11 + 1.0d0)) - sqrt(t_11)
t_13 = sqrt((1.0d0 + t_6))
if (t_9 <= 1.95d-6) then
tmp = (((2.0d0 + (0.5d0 * t_9)) - t_10) + t_5) + t_12
else if (t_9 <= 5.6d+14) then
tmp = ((t_13 + sqrt((1.0d0 + t_9))) - t_10) + t_12
else
tmp = ((t_13 - t_7) + t_5) + t_12
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmin(x, y), z);
double t_3 = fmax(fmax(x, y), t_2);
double t_4 = fmin(fmax(x, y), t_2);
double t_5 = Math.sqrt((t_3 + 1.0)) - Math.sqrt(t_3);
double t_6 = fmin(t_1, t);
double t_7 = Math.sqrt(t_6);
double t_8 = fmax(t_1, t);
double t_9 = fmin(t_4, t_8);
double t_10 = t_7 + Math.sqrt(t_9);
double t_11 = fmax(t_4, t_8);
double t_12 = Math.sqrt((t_11 + 1.0)) - Math.sqrt(t_11);
double t_13 = Math.sqrt((1.0 + t_6));
double tmp;
if (t_9 <= 1.95e-6) {
tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12;
} else if (t_9 <= 5.6e+14) {
tmp = ((t_13 + Math.sqrt((1.0 + t_9))) - t_10) + t_12;
} else {
tmp = ((t_13 - t_7) + t_5) + t_12;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmin(x, y), z) t_3 = fmax(fmax(x, y), t_2) t_4 = fmin(fmax(x, y), t_2) t_5 = math.sqrt((t_3 + 1.0)) - math.sqrt(t_3) t_6 = fmin(t_1, t) t_7 = math.sqrt(t_6) t_8 = fmax(t_1, t) t_9 = fmin(t_4, t_8) t_10 = t_7 + math.sqrt(t_9) t_11 = fmax(t_4, t_8) t_12 = math.sqrt((t_11 + 1.0)) - math.sqrt(t_11) t_13 = math.sqrt((1.0 + t_6)) tmp = 0 if t_9 <= 1.95e-6: tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12 elif t_9 <= 5.6e+14: tmp = ((t_13 + math.sqrt((1.0 + t_9))) - t_10) + t_12 else: tmp = ((t_13 - t_7) + t_5) + t_12 return tmp
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmin(x, y), z) t_3 = fmax(fmax(x, y), t_2) t_4 = fmin(fmax(x, y), t_2) t_5 = Float64(sqrt(Float64(t_3 + 1.0)) - sqrt(t_3)) t_6 = fmin(t_1, t) t_7 = sqrt(t_6) t_8 = fmax(t_1, t) t_9 = fmin(t_4, t_8) t_10 = Float64(t_7 + sqrt(t_9)) t_11 = fmax(t_4, t_8) t_12 = Float64(sqrt(Float64(t_11 + 1.0)) - sqrt(t_11)) t_13 = sqrt(Float64(1.0 + t_6)) tmp = 0.0 if (t_9 <= 1.95e-6) tmp = Float64(Float64(Float64(Float64(2.0 + Float64(0.5 * t_9)) - t_10) + t_5) + t_12); elseif (t_9 <= 5.6e+14) tmp = Float64(Float64(Float64(t_13 + sqrt(Float64(1.0 + t_9))) - t_10) + t_12); else tmp = Float64(Float64(Float64(t_13 - t_7) + t_5) + t_12); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = max(min(x, y), z); t_3 = max(max(x, y), t_2); t_4 = min(max(x, y), t_2); t_5 = sqrt((t_3 + 1.0)) - sqrt(t_3); t_6 = min(t_1, t); t_7 = sqrt(t_6); t_8 = max(t_1, t); t_9 = min(t_4, t_8); t_10 = t_7 + sqrt(t_9); t_11 = max(t_4, t_8); t_12 = sqrt((t_11 + 1.0)) - sqrt(t_11); t_13 = sqrt((1.0 + t_6)); tmp = 0.0; if (t_9 <= 1.95e-6) tmp = (((2.0 + (0.5 * t_9)) - t_10) + t_5) + t_12; elseif (t_9 <= 5.6e+14) tmp = ((t_13 + sqrt((1.0 + t_9))) - t_10) + t_12; else tmp = ((t_13 - t_7) + t_5) + t_12; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[x, y], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Max[x, y], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(t$95$3 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Min[t$95$1, t], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$9 = N[Min[t$95$4, t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[(t$95$7 + N[Sqrt[t$95$9], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Max[t$95$4, t$95$8], $MachinePrecision]}, Block[{t$95$12 = N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$11], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[N[(1 + t$95$6), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$9, 287769207549869/147573952589676412928], N[(N[(N[(N[(2 + N[(1/2 * t$95$9), $MachinePrecision]), $MachinePrecision] - t$95$10), $MachinePrecision] + t$95$5), $MachinePrecision] + t$95$12), $MachinePrecision], If[LessEqual[t$95$9, 560000000000000], N[(N[(N[(t$95$13 + N[Sqrt[N[(1 + t$95$9), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$10), $MachinePrecision] + t$95$12), $MachinePrecision], N[(N[(N[(t$95$13 - t$95$7), $MachinePrecision] + t$95$5), $MachinePrecision] + t$95$12), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_2\right)\\
t_4 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_2\right)\\
t_5 := \sqrt{t\_3 + 1} - \sqrt{t\_3}\\
t_6 := \mathsf{min}\left(t\_1, t\right)\\
t_7 := \sqrt{t\_6}\\
t_8 := \mathsf{max}\left(t\_1, t\right)\\
t_9 := \mathsf{min}\left(t\_4, t\_8\right)\\
t_10 := t\_7 + \sqrt{t\_9}\\
t_11 := \mathsf{max}\left(t\_4, t\_8\right)\\
t_12 := \sqrt{t\_11 + 1} - \sqrt{t\_11}\\
t_13 := \sqrt{1 + t\_6}\\
\mathbf{if}\;t\_9 \leq \frac{287769207549869}{147573952589676412928}:\\
\;\;\;\;\left(\left(\left(2 + \frac{1}{2} \cdot t\_9\right) - t\_10\right) + t\_5\right) + t\_12\\
\mathbf{elif}\;t\_9 \leq 560000000000000:\\
\;\;\;\;\left(\left(t\_13 + \sqrt{1 + t\_9}\right) - t\_10\right) + t\_12\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_13 - t\_7\right) + t\_5\right) + t\_12\\
\end{array}
if y < 1.95e-6Initial program 91.6%
Taylor expanded in y around 0
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6435.2%
Applied rewrites35.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6426.1%
Applied rewrites26.1%
if 1.95e-6 < y < 5.6e14Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6429.2%
Applied rewrites29.2%
if 5.6e14 < y Initial program 91.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6450.8%
Applied rewrites50.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmin t_1 t))
(t_3 (fmax t_1 t))
(t_4 (sqrt t_2))
(t_5 (fmax (fmin x y) z))
(t_6 (fmax (fmax x y) t_5))
(t_7 (- (sqrt (+ t_6 1)) (sqrt t_6)))
(t_8 (fmin (fmax x y) t_5))
(t_9 (fmax t_8 t_3))
(t_10 (- (sqrt (+ t_9 1)) (sqrt t_9)))
(t_11 (fmin t_8 t_3))
(t_12 (+ t_4 (sqrt t_11)))
(t_13 (sqrt (+ 1 t_2))))
(if (<= t_11 1590140912926291/649037107316853453566312041152512)
(+ (+ (- 2 t_12) t_7) t_10)
(if (<= t_11 560000000000000)
(+ (- (+ t_13 (sqrt (+ 1 t_11))) t_12) t_10)
(+ (+ (- t_13 t_4) t_7) t_10)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmin(t_1, t);
double t_3 = fmax(t_1, t);
double t_4 = sqrt(t_2);
double t_5 = fmax(fmin(x, y), z);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = sqrt((t_6 + 1.0)) - sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = fmax(t_8, t_3);
double t_10 = sqrt((t_9 + 1.0)) - sqrt(t_9);
double t_11 = fmin(t_8, t_3);
double t_12 = t_4 + sqrt(t_11);
double t_13 = sqrt((1.0 + t_2));
double tmp;
if (t_11 <= 2.45e-18) {
tmp = ((2.0 - t_12) + t_7) + t_10;
} else if (t_11 <= 5.6e+14) {
tmp = ((t_13 + sqrt((1.0 + t_11))) - t_12) + t_10;
} else {
tmp = ((t_13 - t_4) + t_7) + t_10;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(fmin(x, y), z)
t_2 = fmin(t_1, t)
t_3 = fmax(t_1, t)
t_4 = sqrt(t_2)
t_5 = fmax(fmin(x, y), z)
t_6 = fmax(fmax(x, y), t_5)
t_7 = sqrt((t_6 + 1.0d0)) - sqrt(t_6)
t_8 = fmin(fmax(x, y), t_5)
t_9 = fmax(t_8, t_3)
t_10 = sqrt((t_9 + 1.0d0)) - sqrt(t_9)
t_11 = fmin(t_8, t_3)
t_12 = t_4 + sqrt(t_11)
t_13 = sqrt((1.0d0 + t_2))
if (t_11 <= 2.45d-18) then
tmp = ((2.0d0 - t_12) + t_7) + t_10
else if (t_11 <= 5.6d+14) then
tmp = ((t_13 + sqrt((1.0d0 + t_11))) - t_12) + t_10
else
tmp = ((t_13 - t_4) + t_7) + t_10
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmin(t_1, t);
double t_3 = fmax(t_1, t);
double t_4 = Math.sqrt(t_2);
double t_5 = fmax(fmin(x, y), z);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = Math.sqrt((t_6 + 1.0)) - Math.sqrt(t_6);
double t_8 = fmin(fmax(x, y), t_5);
double t_9 = fmax(t_8, t_3);
double t_10 = Math.sqrt((t_9 + 1.0)) - Math.sqrt(t_9);
double t_11 = fmin(t_8, t_3);
double t_12 = t_4 + Math.sqrt(t_11);
double t_13 = Math.sqrt((1.0 + t_2));
double tmp;
if (t_11 <= 2.45e-18) {
tmp = ((2.0 - t_12) + t_7) + t_10;
} else if (t_11 <= 5.6e+14) {
tmp = ((t_13 + Math.sqrt((1.0 + t_11))) - t_12) + t_10;
} else {
tmp = ((t_13 - t_4) + t_7) + t_10;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmin(t_1, t) t_3 = fmax(t_1, t) t_4 = math.sqrt(t_2) t_5 = fmax(fmin(x, y), z) t_6 = fmax(fmax(x, y), t_5) t_7 = math.sqrt((t_6 + 1.0)) - math.sqrt(t_6) t_8 = fmin(fmax(x, y), t_5) t_9 = fmax(t_8, t_3) t_10 = math.sqrt((t_9 + 1.0)) - math.sqrt(t_9) t_11 = fmin(t_8, t_3) t_12 = t_4 + math.sqrt(t_11) t_13 = math.sqrt((1.0 + t_2)) tmp = 0 if t_11 <= 2.45e-18: tmp = ((2.0 - t_12) + t_7) + t_10 elif t_11 <= 5.6e+14: tmp = ((t_13 + math.sqrt((1.0 + t_11))) - t_12) + t_10 else: tmp = ((t_13 - t_4) + t_7) + t_10 return tmp
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmin(t_1, t) t_3 = fmax(t_1, t) t_4 = sqrt(t_2) t_5 = fmax(fmin(x, y), z) t_6 = fmax(fmax(x, y), t_5) t_7 = Float64(sqrt(Float64(t_6 + 1.0)) - sqrt(t_6)) t_8 = fmin(fmax(x, y), t_5) t_9 = fmax(t_8, t_3) t_10 = Float64(sqrt(Float64(t_9 + 1.0)) - sqrt(t_9)) t_11 = fmin(t_8, t_3) t_12 = Float64(t_4 + sqrt(t_11)) t_13 = sqrt(Float64(1.0 + t_2)) tmp = 0.0 if (t_11 <= 2.45e-18) tmp = Float64(Float64(Float64(2.0 - t_12) + t_7) + t_10); elseif (t_11 <= 5.6e+14) tmp = Float64(Float64(Float64(t_13 + sqrt(Float64(1.0 + t_11))) - t_12) + t_10); else tmp = Float64(Float64(Float64(t_13 - t_4) + t_7) + t_10); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = min(t_1, t); t_3 = max(t_1, t); t_4 = sqrt(t_2); t_5 = max(min(x, y), z); t_6 = max(max(x, y), t_5); t_7 = sqrt((t_6 + 1.0)) - sqrt(t_6); t_8 = min(max(x, y), t_5); t_9 = max(t_8, t_3); t_10 = sqrt((t_9 + 1.0)) - sqrt(t_9); t_11 = min(t_8, t_3); t_12 = t_4 + sqrt(t_11); t_13 = sqrt((1.0 + t_2)); tmp = 0.0; if (t_11 <= 2.45e-18) tmp = ((2.0 - t_12) + t_7) + t_10; elseif (t_11 <= 5.6e+14) tmp = ((t_13 + sqrt((1.0 + t_11))) - t_12) + t_10; else tmp = ((t_13 - t_4) + t_7) + t_10; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[t$95$1, t], $MachinePrecision]}, Block[{t$95$3 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$6 = N[Max[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[Min[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$9 = N[Max[t$95$8, t$95$3], $MachinePrecision]}, Block[{t$95$10 = N[(N[Sqrt[N[(t$95$9 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$9], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Min[t$95$8, t$95$3], $MachinePrecision]}, Block[{t$95$12 = N[(t$95$4 + N[Sqrt[t$95$11], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[N[(1 + t$95$2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$11, 1590140912926291/649037107316853453566312041152512], N[(N[(N[(2 - t$95$12), $MachinePrecision] + t$95$7), $MachinePrecision] + t$95$10), $MachinePrecision], If[LessEqual[t$95$11, 560000000000000], N[(N[(N[(t$95$13 + N[Sqrt[N[(1 + t$95$11), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$12), $MachinePrecision] + t$95$10), $MachinePrecision], N[(N[(N[(t$95$13 - t$95$4), $MachinePrecision] + t$95$7), $MachinePrecision] + t$95$10), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(t\_1, t\right)\\
t_3 := \mathsf{max}\left(t\_1, t\right)\\
t_4 := \sqrt{t\_2}\\
t_5 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_6 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_7 := \sqrt{t\_6 + 1} - \sqrt{t\_6}\\
t_8 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_9 := \mathsf{max}\left(t\_8, t\_3\right)\\
t_10 := \sqrt{t\_9 + 1} - \sqrt{t\_9}\\
t_11 := \mathsf{min}\left(t\_8, t\_3\right)\\
t_12 := t\_4 + \sqrt{t\_11}\\
t_13 := \sqrt{1 + t\_2}\\
\mathbf{if}\;t\_11 \leq \frac{1590140912926291}{649037107316853453566312041152512}:\\
\;\;\;\;\left(\left(2 - t\_12\right) + t\_7\right) + t\_10\\
\mathbf{elif}\;t\_11 \leq 560000000000000:\\
\;\;\;\;\left(\left(t\_13 + \sqrt{1 + t\_11}\right) - t\_12\right) + t\_10\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_13 - t\_4\right) + t\_7\right) + t\_10\\
\end{array}
if y < 2.4500000000000001e-18Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in y around 0
Applied rewrites24.2%
if 2.4500000000000001e-18 < y < 5.6e14Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6429.2%
Applied rewrites29.2%
if 5.6e14 < y Initial program 91.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6450.8%
Applied rewrites50.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmin t_1 t))
(t_3 (fmax t_1 t))
(t_4 (sqrt t_2))
(t_5 (fmax (fmin x y) z))
(t_6 (fmax (fmax x y) t_5))
(t_7 (fmin (fmax x y) t_5))
(t_8 (fmax t_7 t_3))
(t_9 (- (sqrt (+ t_8 1)) (sqrt t_8)))
(t_10 (fmin t_7 t_3))
(t_11 (+ t_4 (sqrt t_10)))
(t_12 (sqrt (+ 1 t_2))))
(if (<= t_10 1590140912926291/649037107316853453566312041152512)
(+ (+ (- 2 t_11) (- (sqrt (+ t_6 1)) (sqrt t_6))) t_9)
(if (<= t_10 560000000000000)
(+ (- (+ t_12 (sqrt (+ 1 t_10))) t_11) t_9)
(- (+ t_12 (* 1/2 (/ 1 (* t_8 (sqrt (/ 1 t_8)))))) t_4)))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmin(t_1, t);
double t_3 = fmax(t_1, t);
double t_4 = sqrt(t_2);
double t_5 = fmax(fmin(x, y), z);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = fmin(fmax(x, y), t_5);
double t_8 = fmax(t_7, t_3);
double t_9 = sqrt((t_8 + 1.0)) - sqrt(t_8);
double t_10 = fmin(t_7, t_3);
double t_11 = t_4 + sqrt(t_10);
double t_12 = sqrt((1.0 + t_2));
double tmp;
if (t_10 <= 2.45e-18) {
tmp = ((2.0 - t_11) + (sqrt((t_6 + 1.0)) - sqrt(t_6))) + t_9;
} else if (t_10 <= 5.6e+14) {
tmp = ((t_12 + sqrt((1.0 + t_10))) - t_11) + t_9;
} else {
tmp = (t_12 + (0.5 * (1.0 / (t_8 * sqrt((1.0 / t_8)))))) - t_4;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmin(fmin(x, y), z)
t_2 = fmin(t_1, t)
t_3 = fmax(t_1, t)
t_4 = sqrt(t_2)
t_5 = fmax(fmin(x, y), z)
t_6 = fmax(fmax(x, y), t_5)
t_7 = fmin(fmax(x, y), t_5)
t_8 = fmax(t_7, t_3)
t_9 = sqrt((t_8 + 1.0d0)) - sqrt(t_8)
t_10 = fmin(t_7, t_3)
t_11 = t_4 + sqrt(t_10)
t_12 = sqrt((1.0d0 + t_2))
if (t_10 <= 2.45d-18) then
tmp = ((2.0d0 - t_11) + (sqrt((t_6 + 1.0d0)) - sqrt(t_6))) + t_9
else if (t_10 <= 5.6d+14) then
tmp = ((t_12 + sqrt((1.0d0 + t_10))) - t_11) + t_9
else
tmp = (t_12 + (0.5d0 * (1.0d0 / (t_8 * sqrt((1.0d0 / t_8)))))) - t_4
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmin(t_1, t);
double t_3 = fmax(t_1, t);
double t_4 = Math.sqrt(t_2);
double t_5 = fmax(fmin(x, y), z);
double t_6 = fmax(fmax(x, y), t_5);
double t_7 = fmin(fmax(x, y), t_5);
double t_8 = fmax(t_7, t_3);
double t_9 = Math.sqrt((t_8 + 1.0)) - Math.sqrt(t_8);
double t_10 = fmin(t_7, t_3);
double t_11 = t_4 + Math.sqrt(t_10);
double t_12 = Math.sqrt((1.0 + t_2));
double tmp;
if (t_10 <= 2.45e-18) {
tmp = ((2.0 - t_11) + (Math.sqrt((t_6 + 1.0)) - Math.sqrt(t_6))) + t_9;
} else if (t_10 <= 5.6e+14) {
tmp = ((t_12 + Math.sqrt((1.0 + t_10))) - t_11) + t_9;
} else {
tmp = (t_12 + (0.5 * (1.0 / (t_8 * Math.sqrt((1.0 / t_8)))))) - t_4;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmin(t_1, t) t_3 = fmax(t_1, t) t_4 = math.sqrt(t_2) t_5 = fmax(fmin(x, y), z) t_6 = fmax(fmax(x, y), t_5) t_7 = fmin(fmax(x, y), t_5) t_8 = fmax(t_7, t_3) t_9 = math.sqrt((t_8 + 1.0)) - math.sqrt(t_8) t_10 = fmin(t_7, t_3) t_11 = t_4 + math.sqrt(t_10) t_12 = math.sqrt((1.0 + t_2)) tmp = 0 if t_10 <= 2.45e-18: tmp = ((2.0 - t_11) + (math.sqrt((t_6 + 1.0)) - math.sqrt(t_6))) + t_9 elif t_10 <= 5.6e+14: tmp = ((t_12 + math.sqrt((1.0 + t_10))) - t_11) + t_9 else: tmp = (t_12 + (0.5 * (1.0 / (t_8 * math.sqrt((1.0 / t_8)))))) - t_4 return tmp
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmin(t_1, t) t_3 = fmax(t_1, t) t_4 = sqrt(t_2) t_5 = fmax(fmin(x, y), z) t_6 = fmax(fmax(x, y), t_5) t_7 = fmin(fmax(x, y), t_5) t_8 = fmax(t_7, t_3) t_9 = Float64(sqrt(Float64(t_8 + 1.0)) - sqrt(t_8)) t_10 = fmin(t_7, t_3) t_11 = Float64(t_4 + sqrt(t_10)) t_12 = sqrt(Float64(1.0 + t_2)) tmp = 0.0 if (t_10 <= 2.45e-18) tmp = Float64(Float64(Float64(2.0 - t_11) + Float64(sqrt(Float64(t_6 + 1.0)) - sqrt(t_6))) + t_9); elseif (t_10 <= 5.6e+14) tmp = Float64(Float64(Float64(t_12 + sqrt(Float64(1.0 + t_10))) - t_11) + t_9); else tmp = Float64(Float64(t_12 + Float64(0.5 * Float64(1.0 / Float64(t_8 * sqrt(Float64(1.0 / t_8)))))) - t_4); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = min(t_1, t); t_3 = max(t_1, t); t_4 = sqrt(t_2); t_5 = max(min(x, y), z); t_6 = max(max(x, y), t_5); t_7 = min(max(x, y), t_5); t_8 = max(t_7, t_3); t_9 = sqrt((t_8 + 1.0)) - sqrt(t_8); t_10 = min(t_7, t_3); t_11 = t_4 + sqrt(t_10); t_12 = sqrt((1.0 + t_2)); tmp = 0.0; if (t_10 <= 2.45e-18) tmp = ((2.0 - t_11) + (sqrt((t_6 + 1.0)) - sqrt(t_6))) + t_9; elseif (t_10 <= 5.6e+14) tmp = ((t_12 + sqrt((1.0 + t_10))) - t_11) + t_9; else tmp = (t_12 + (0.5 * (1.0 / (t_8 * sqrt((1.0 / t_8)))))) - t_4; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Min[t$95$1, t], $MachinePrecision]}, Block[{t$95$3 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$2], $MachinePrecision]}, Block[{t$95$5 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$6 = N[Max[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[Min[N[Max[x, y], $MachinePrecision], t$95$5], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$7, t$95$3], $MachinePrecision]}, Block[{t$95$9 = N[(N[Sqrt[N[(t$95$8 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$8], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$10 = N[Min[t$95$7, t$95$3], $MachinePrecision]}, Block[{t$95$11 = N[(t$95$4 + N[Sqrt[t$95$10], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$12 = N[Sqrt[N[(1 + t$95$2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$10, 1590140912926291/649037107316853453566312041152512], N[(N[(N[(2 - t$95$11), $MachinePrecision] + N[(N[Sqrt[N[(t$95$6 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$9), $MachinePrecision], If[LessEqual[t$95$10, 560000000000000], N[(N[(N[(t$95$12 + N[Sqrt[N[(1 + t$95$10), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$11), $MachinePrecision] + t$95$9), $MachinePrecision], N[(N[(t$95$12 + N[(1/2 * N[(1 / N[(t$95$8 * N[Sqrt[N[(1 / t$95$8), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$4), $MachinePrecision]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{min}\left(t\_1, t\right)\\
t_3 := \mathsf{max}\left(t\_1, t\right)\\
t_4 := \sqrt{t\_2}\\
t_5 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_6 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_7 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_5\right)\\
t_8 := \mathsf{max}\left(t\_7, t\_3\right)\\
t_9 := \sqrt{t\_8 + 1} - \sqrt{t\_8}\\
t_10 := \mathsf{min}\left(t\_7, t\_3\right)\\
t_11 := t\_4 + \sqrt{t\_10}\\
t_12 := \sqrt{1 + t\_2}\\
\mathbf{if}\;t\_10 \leq \frac{1590140912926291}{649037107316853453566312041152512}:\\
\;\;\;\;\left(\left(2 - t\_11\right) + \left(\sqrt{t\_6 + 1} - \sqrt{t\_6}\right)\right) + t\_9\\
\mathbf{elif}\;t\_10 \leq 560000000000000:\\
\;\;\;\;\left(\left(t\_12 + \sqrt{1 + t\_10}\right) - t\_11\right) + t\_9\\
\mathbf{else}:\\
\;\;\;\;\left(t\_12 + \frac{1}{2} \cdot \frac{1}{t\_8 \cdot \sqrt{\frac{1}{t\_8}}}\right) - t\_4\\
\end{array}
if y < 2.4500000000000001e-18Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in y around 0
Applied rewrites24.2%
if 2.4500000000000001e-18 < y < 5.6e14Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6429.2%
Applied rewrites29.2%
if 5.6e14 < y Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6413.4%
Applied rewrites13.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmax (fmax x y) t_1))
(t_3 (fmin (fmax x y) t_1))
(t_4 (fmin (fmin x y) z))
(t_5 (fmin t_4 t))
(t_6 (sqrt t_5))
(t_7 (fmax t_4 t))
(t_8 (fmax t_3 t_7))
(t_9 (fmin t_2 t_8))
(t_10 (sqrt t_9))
(t_11 (fmin t_3 t_7))
(t_12 (fmax t_2 t_8))
(t_13 (- (sqrt (+ t_12 1)) (sqrt t_12)))
(t_14 (sqrt (+ 1 t_11)))
(t_15 (sqrt t_11))
(t_16
(+
(+
(+ (- (sqrt (+ t_5 1)) t_6) (- (sqrt (+ t_11 1)) t_15))
(- (sqrt (+ t_9 1)) t_10))
t_13))
(t_17 (sqrt (+ 1 t_5))))
(if (<= t_16 4503599717442489/4503599627370496)
(- (+ t_17 (* 1/2 (/ 1 (* t_12 (sqrt (/ 1 t_12)))))) t_6)
(if (<= t_16 2)
(+ (- (+ t_17 t_14) (+ t_6 t_15)) t_13)
(- (+ t_17 (+ t_14 (sqrt (+ 1 t_9)))) (+ t_6 (+ t_15 t_10)))))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = fmin(fmin(x, y), z);
double t_5 = fmin(t_4, t);
double t_6 = sqrt(t_5);
double t_7 = fmax(t_4, t);
double t_8 = fmax(t_3, t_7);
double t_9 = fmin(t_2, t_8);
double t_10 = sqrt(t_9);
double t_11 = fmin(t_3, t_7);
double t_12 = fmax(t_2, t_8);
double t_13 = sqrt((t_12 + 1.0)) - sqrt(t_12);
double t_14 = sqrt((1.0 + t_11));
double t_15 = sqrt(t_11);
double t_16 = (((sqrt((t_5 + 1.0)) - t_6) + (sqrt((t_11 + 1.0)) - t_15)) + (sqrt((t_9 + 1.0)) - t_10)) + t_13;
double t_17 = sqrt((1.0 + t_5));
double tmp;
if (t_16 <= 1.00000002) {
tmp = (t_17 + (0.5 * (1.0 / (t_12 * sqrt((1.0 / t_12)))))) - t_6;
} else if (t_16 <= 2.0) {
tmp = ((t_17 + t_14) - (t_6 + t_15)) + t_13;
} else {
tmp = (t_17 + (t_14 + sqrt((1.0 + t_9)))) - (t_6 + (t_15 + t_10));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_14
real(8) :: t_15
real(8) :: t_16
real(8) :: t_17
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmax(fmax(x, y), t_1)
t_3 = fmin(fmax(x, y), t_1)
t_4 = fmin(fmin(x, y), z)
t_5 = fmin(t_4, t)
t_6 = sqrt(t_5)
t_7 = fmax(t_4, t)
t_8 = fmax(t_3, t_7)
t_9 = fmin(t_2, t_8)
t_10 = sqrt(t_9)
t_11 = fmin(t_3, t_7)
t_12 = fmax(t_2, t_8)
t_13 = sqrt((t_12 + 1.0d0)) - sqrt(t_12)
t_14 = sqrt((1.0d0 + t_11))
t_15 = sqrt(t_11)
t_16 = (((sqrt((t_5 + 1.0d0)) - t_6) + (sqrt((t_11 + 1.0d0)) - t_15)) + (sqrt((t_9 + 1.0d0)) - t_10)) + t_13
t_17 = sqrt((1.0d0 + t_5))
if (t_16 <= 1.00000002d0) then
tmp = (t_17 + (0.5d0 * (1.0d0 / (t_12 * sqrt((1.0d0 / t_12)))))) - t_6
else if (t_16 <= 2.0d0) then
tmp = ((t_17 + t_14) - (t_6 + t_15)) + t_13
else
tmp = (t_17 + (t_14 + sqrt((1.0d0 + t_9)))) - (t_6 + (t_15 + t_10))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = fmin(fmin(x, y), z);
double t_5 = fmin(t_4, t);
double t_6 = Math.sqrt(t_5);
double t_7 = fmax(t_4, t);
double t_8 = fmax(t_3, t_7);
double t_9 = fmin(t_2, t_8);
double t_10 = Math.sqrt(t_9);
double t_11 = fmin(t_3, t_7);
double t_12 = fmax(t_2, t_8);
double t_13 = Math.sqrt((t_12 + 1.0)) - Math.sqrt(t_12);
double t_14 = Math.sqrt((1.0 + t_11));
double t_15 = Math.sqrt(t_11);
double t_16 = (((Math.sqrt((t_5 + 1.0)) - t_6) + (Math.sqrt((t_11 + 1.0)) - t_15)) + (Math.sqrt((t_9 + 1.0)) - t_10)) + t_13;
double t_17 = Math.sqrt((1.0 + t_5));
double tmp;
if (t_16 <= 1.00000002) {
tmp = (t_17 + (0.5 * (1.0 / (t_12 * Math.sqrt((1.0 / t_12)))))) - t_6;
} else if (t_16 <= 2.0) {
tmp = ((t_17 + t_14) - (t_6 + t_15)) + t_13;
} else {
tmp = (t_17 + (t_14 + Math.sqrt((1.0 + t_9)))) - (t_6 + (t_15 + t_10));
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = fmin(fmin(x, y), z) t_5 = fmin(t_4, t) t_6 = math.sqrt(t_5) t_7 = fmax(t_4, t) t_8 = fmax(t_3, t_7) t_9 = fmin(t_2, t_8) t_10 = math.sqrt(t_9) t_11 = fmin(t_3, t_7) t_12 = fmax(t_2, t_8) t_13 = math.sqrt((t_12 + 1.0)) - math.sqrt(t_12) t_14 = math.sqrt((1.0 + t_11)) t_15 = math.sqrt(t_11) t_16 = (((math.sqrt((t_5 + 1.0)) - t_6) + (math.sqrt((t_11 + 1.0)) - t_15)) + (math.sqrt((t_9 + 1.0)) - t_10)) + t_13 t_17 = math.sqrt((1.0 + t_5)) tmp = 0 if t_16 <= 1.00000002: tmp = (t_17 + (0.5 * (1.0 / (t_12 * math.sqrt((1.0 / t_12)))))) - t_6 elif t_16 <= 2.0: tmp = ((t_17 + t_14) - (t_6 + t_15)) + t_13 else: tmp = (t_17 + (t_14 + math.sqrt((1.0 + t_9)))) - (t_6 + (t_15 + t_10)) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = fmin(fmin(x, y), z) t_5 = fmin(t_4, t) t_6 = sqrt(t_5) t_7 = fmax(t_4, t) t_8 = fmax(t_3, t_7) t_9 = fmin(t_2, t_8) t_10 = sqrt(t_9) t_11 = fmin(t_3, t_7) t_12 = fmax(t_2, t_8) t_13 = Float64(sqrt(Float64(t_12 + 1.0)) - sqrt(t_12)) t_14 = sqrt(Float64(1.0 + t_11)) t_15 = sqrt(t_11) t_16 = Float64(Float64(Float64(Float64(sqrt(Float64(t_5 + 1.0)) - t_6) + Float64(sqrt(Float64(t_11 + 1.0)) - t_15)) + Float64(sqrt(Float64(t_9 + 1.0)) - t_10)) + t_13) t_17 = sqrt(Float64(1.0 + t_5)) tmp = 0.0 if (t_16 <= 1.00000002) tmp = Float64(Float64(t_17 + Float64(0.5 * Float64(1.0 / Float64(t_12 * sqrt(Float64(1.0 / t_12)))))) - t_6); elseif (t_16 <= 2.0) tmp = Float64(Float64(Float64(t_17 + t_14) - Float64(t_6 + t_15)) + t_13); else tmp = Float64(Float64(t_17 + Float64(t_14 + sqrt(Float64(1.0 + t_9)))) - Float64(t_6 + Float64(t_15 + t_10))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = max(max(x, y), t_1); t_3 = min(max(x, y), t_1); t_4 = min(min(x, y), z); t_5 = min(t_4, t); t_6 = sqrt(t_5); t_7 = max(t_4, t); t_8 = max(t_3, t_7); t_9 = min(t_2, t_8); t_10 = sqrt(t_9); t_11 = min(t_3, t_7); t_12 = max(t_2, t_8); t_13 = sqrt((t_12 + 1.0)) - sqrt(t_12); t_14 = sqrt((1.0 + t_11)); t_15 = sqrt(t_11); t_16 = (((sqrt((t_5 + 1.0)) - t_6) + (sqrt((t_11 + 1.0)) - t_15)) + (sqrt((t_9 + 1.0)) - t_10)) + t_13; t_17 = sqrt((1.0 + t_5)); tmp = 0.0; if (t_16 <= 1.00000002) tmp = (t_17 + (0.5 * (1.0 / (t_12 * sqrt((1.0 / t_12)))))) - t_6; elseif (t_16 <= 2.0) tmp = ((t_17 + t_14) - (t_6 + t_15)) + t_13; else tmp = (t_17 + (t_14 + sqrt((1.0 + t_9)))) - (t_6 + (t_15 + t_10)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$5 = N[Min[t$95$4, t], $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[Max[t$95$4, t], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$3, t$95$7], $MachinePrecision]}, Block[{t$95$9 = N[Min[t$95$2, t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[Sqrt[t$95$9], $MachinePrecision]}, Block[{t$95$11 = N[Min[t$95$3, t$95$7], $MachinePrecision]}, Block[{t$95$12 = N[Max[t$95$2, t$95$8], $MachinePrecision]}, Block[{t$95$13 = N[(N[Sqrt[N[(t$95$12 + 1), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t$95$12], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$14 = N[Sqrt[N[(1 + t$95$11), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$15 = N[Sqrt[t$95$11], $MachinePrecision]}, Block[{t$95$16 = N[(N[(N[(N[(N[Sqrt[N[(t$95$5 + 1), $MachinePrecision]], $MachinePrecision] - t$95$6), $MachinePrecision] + N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - t$95$15), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$9 + 1), $MachinePrecision]], $MachinePrecision] - t$95$10), $MachinePrecision]), $MachinePrecision] + t$95$13), $MachinePrecision]}, Block[{t$95$17 = N[Sqrt[N[(1 + t$95$5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$16, 4503599717442489/4503599627370496], N[(N[(t$95$17 + N[(1/2 * N[(1 / N[(t$95$12 * N[Sqrt[N[(1 / t$95$12), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$6), $MachinePrecision], If[LessEqual[t$95$16, 2], N[(N[(N[(t$95$17 + t$95$14), $MachinePrecision] - N[(t$95$6 + t$95$15), $MachinePrecision]), $MachinePrecision] + t$95$13), $MachinePrecision], N[(N[(t$95$17 + N[(t$95$14 + N[Sqrt[N[(1 + t$95$9), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$6 + N[(t$95$15 + t$95$10), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_5 := \mathsf{min}\left(t\_4, t\right)\\
t_6 := \sqrt{t\_5}\\
t_7 := \mathsf{max}\left(t\_4, t\right)\\
t_8 := \mathsf{max}\left(t\_3, t\_7\right)\\
t_9 := \mathsf{min}\left(t\_2, t\_8\right)\\
t_10 := \sqrt{t\_9}\\
t_11 := \mathsf{min}\left(t\_3, t\_7\right)\\
t_12 := \mathsf{max}\left(t\_2, t\_8\right)\\
t_13 := \sqrt{t\_12 + 1} - \sqrt{t\_12}\\
t_14 := \sqrt{1 + t\_11}\\
t_15 := \sqrt{t\_11}\\
t_16 := \left(\left(\left(\sqrt{t\_5 + 1} - t\_6\right) + \left(\sqrt{t\_11 + 1} - t\_15\right)\right) + \left(\sqrt{t\_9 + 1} - t\_10\right)\right) + t\_13\\
t_17 := \sqrt{1 + t\_5}\\
\mathbf{if}\;t\_16 \leq \frac{4503599717442489}{4503599627370496}:\\
\;\;\;\;\left(t\_17 + \frac{1}{2} \cdot \frac{1}{t\_12 \cdot \sqrt{\frac{1}{t\_12}}}\right) - t\_6\\
\mathbf{elif}\;t\_16 \leq 2:\\
\;\;\;\;\left(\left(t\_17 + t\_14\right) - \left(t\_6 + t\_15\right)\right) + t\_13\\
\mathbf{else}:\\
\;\;\;\;\left(t\_17 + \left(t\_14 + \sqrt{1 + t\_9}\right)\right) - \left(t\_6 + \left(t\_15 + t\_10\right)\right)\\
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 1.0000000200000001Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6413.4%
Applied rewrites13.4%
if 1.0000000200000001 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 2Initial program 91.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6436.6%
Applied rewrites36.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6429.2%
Applied rewrites29.2%
if 2 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmax (fmin x y) z))
(t_2 (fmax (fmax x y) t_1))
(t_3 (fmin (fmax x y) t_1))
(t_4 (fmin (fmin x y) z))
(t_5 (fmin t_4 t))
(t_6 (sqrt t_5))
(t_7 (fmax t_4 t))
(t_8 (fmax t_3 t_7))
(t_9 (fmin t_2 t_8))
(t_10 (sqrt t_9))
(t_11 (fmin t_3 t_7))
(t_12 (fmax t_2 t_8))
(t_13 (sqrt t_12))
(t_14 (sqrt t_11))
(t_15
(+
(+
(+ (- (sqrt (+ t_5 1)) t_6) (- (sqrt (+ t_11 1)) t_14))
(- (sqrt (+ t_9 1)) t_10))
(- (sqrt (+ t_12 1)) t_13)))
(t_16 (sqrt (+ 1 t_5))))
(if (<= t_15 3/2)
(- (+ t_16 (* 1/2 (/ 1 (* t_12 (sqrt (/ 1 t_12)))))) t_6)
(if (<= t_15 2)
(+
(+ (sqrt (- t_5 -1)) (sqrt (- t_11 -1)))
(- (sqrt (- t_12 -1)) (+ (+ t_14 t_6) t_13)))
(-
(+ t_16 (+ (sqrt (+ 1 t_11)) (sqrt (+ 1 t_9))))
(+ t_6 (+ t_14 t_10)))))))double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = fmin(fmin(x, y), z);
double t_5 = fmin(t_4, t);
double t_6 = sqrt(t_5);
double t_7 = fmax(t_4, t);
double t_8 = fmax(t_3, t_7);
double t_9 = fmin(t_2, t_8);
double t_10 = sqrt(t_9);
double t_11 = fmin(t_3, t_7);
double t_12 = fmax(t_2, t_8);
double t_13 = sqrt(t_12);
double t_14 = sqrt(t_11);
double t_15 = (((sqrt((t_5 + 1.0)) - t_6) + (sqrt((t_11 + 1.0)) - t_14)) + (sqrt((t_9 + 1.0)) - t_10)) + (sqrt((t_12 + 1.0)) - t_13);
double t_16 = sqrt((1.0 + t_5));
double tmp;
if (t_15 <= 1.5) {
tmp = (t_16 + (0.5 * (1.0 / (t_12 * sqrt((1.0 / t_12)))))) - t_6;
} else if (t_15 <= 2.0) {
tmp = (sqrt((t_5 - -1.0)) + sqrt((t_11 - -1.0))) + (sqrt((t_12 - -1.0)) - ((t_14 + t_6) + t_13));
} else {
tmp = (t_16 + (sqrt((1.0 + t_11)) + sqrt((1.0 + t_9)))) - (t_6 + (t_14 + t_10));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_10
real(8) :: t_11
real(8) :: t_12
real(8) :: t_13
real(8) :: t_14
real(8) :: t_15
real(8) :: t_16
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
real(8) :: tmp
t_1 = fmax(fmin(x, y), z)
t_2 = fmax(fmax(x, y), t_1)
t_3 = fmin(fmax(x, y), t_1)
t_4 = fmin(fmin(x, y), z)
t_5 = fmin(t_4, t)
t_6 = sqrt(t_5)
t_7 = fmax(t_4, t)
t_8 = fmax(t_3, t_7)
t_9 = fmin(t_2, t_8)
t_10 = sqrt(t_9)
t_11 = fmin(t_3, t_7)
t_12 = fmax(t_2, t_8)
t_13 = sqrt(t_12)
t_14 = sqrt(t_11)
t_15 = (((sqrt((t_5 + 1.0d0)) - t_6) + (sqrt((t_11 + 1.0d0)) - t_14)) + (sqrt((t_9 + 1.0d0)) - t_10)) + (sqrt((t_12 + 1.0d0)) - t_13)
t_16 = sqrt((1.0d0 + t_5))
if (t_15 <= 1.5d0) then
tmp = (t_16 + (0.5d0 * (1.0d0 / (t_12 * sqrt((1.0d0 / t_12)))))) - t_6
else if (t_15 <= 2.0d0) then
tmp = (sqrt((t_5 - (-1.0d0))) + sqrt((t_11 - (-1.0d0)))) + (sqrt((t_12 - (-1.0d0))) - ((t_14 + t_6) + t_13))
else
tmp = (t_16 + (sqrt((1.0d0 + t_11)) + sqrt((1.0d0 + t_9)))) - (t_6 + (t_14 + t_10))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmax(fmin(x, y), z);
double t_2 = fmax(fmax(x, y), t_1);
double t_3 = fmin(fmax(x, y), t_1);
double t_4 = fmin(fmin(x, y), z);
double t_5 = fmin(t_4, t);
double t_6 = Math.sqrt(t_5);
double t_7 = fmax(t_4, t);
double t_8 = fmax(t_3, t_7);
double t_9 = fmin(t_2, t_8);
double t_10 = Math.sqrt(t_9);
double t_11 = fmin(t_3, t_7);
double t_12 = fmax(t_2, t_8);
double t_13 = Math.sqrt(t_12);
double t_14 = Math.sqrt(t_11);
double t_15 = (((Math.sqrt((t_5 + 1.0)) - t_6) + (Math.sqrt((t_11 + 1.0)) - t_14)) + (Math.sqrt((t_9 + 1.0)) - t_10)) + (Math.sqrt((t_12 + 1.0)) - t_13);
double t_16 = Math.sqrt((1.0 + t_5));
double tmp;
if (t_15 <= 1.5) {
tmp = (t_16 + (0.5 * (1.0 / (t_12 * Math.sqrt((1.0 / t_12)))))) - t_6;
} else if (t_15 <= 2.0) {
tmp = (Math.sqrt((t_5 - -1.0)) + Math.sqrt((t_11 - -1.0))) + (Math.sqrt((t_12 - -1.0)) - ((t_14 + t_6) + t_13));
} else {
tmp = (t_16 + (Math.sqrt((1.0 + t_11)) + Math.sqrt((1.0 + t_9)))) - (t_6 + (t_14 + t_10));
}
return tmp;
}
def code(x, y, z, t): t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = fmin(fmin(x, y), z) t_5 = fmin(t_4, t) t_6 = math.sqrt(t_5) t_7 = fmax(t_4, t) t_8 = fmax(t_3, t_7) t_9 = fmin(t_2, t_8) t_10 = math.sqrt(t_9) t_11 = fmin(t_3, t_7) t_12 = fmax(t_2, t_8) t_13 = math.sqrt(t_12) t_14 = math.sqrt(t_11) t_15 = (((math.sqrt((t_5 + 1.0)) - t_6) + (math.sqrt((t_11 + 1.0)) - t_14)) + (math.sqrt((t_9 + 1.0)) - t_10)) + (math.sqrt((t_12 + 1.0)) - t_13) t_16 = math.sqrt((1.0 + t_5)) tmp = 0 if t_15 <= 1.5: tmp = (t_16 + (0.5 * (1.0 / (t_12 * math.sqrt((1.0 / t_12)))))) - t_6 elif t_15 <= 2.0: tmp = (math.sqrt((t_5 - -1.0)) + math.sqrt((t_11 - -1.0))) + (math.sqrt((t_12 - -1.0)) - ((t_14 + t_6) + t_13)) else: tmp = (t_16 + (math.sqrt((1.0 + t_11)) + math.sqrt((1.0 + t_9)))) - (t_6 + (t_14 + t_10)) return tmp
function code(x, y, z, t) t_1 = fmax(fmin(x, y), z) t_2 = fmax(fmax(x, y), t_1) t_3 = fmin(fmax(x, y), t_1) t_4 = fmin(fmin(x, y), z) t_5 = fmin(t_4, t) t_6 = sqrt(t_5) t_7 = fmax(t_4, t) t_8 = fmax(t_3, t_7) t_9 = fmin(t_2, t_8) t_10 = sqrt(t_9) t_11 = fmin(t_3, t_7) t_12 = fmax(t_2, t_8) t_13 = sqrt(t_12) t_14 = sqrt(t_11) t_15 = Float64(Float64(Float64(Float64(sqrt(Float64(t_5 + 1.0)) - t_6) + Float64(sqrt(Float64(t_11 + 1.0)) - t_14)) + Float64(sqrt(Float64(t_9 + 1.0)) - t_10)) + Float64(sqrt(Float64(t_12 + 1.0)) - t_13)) t_16 = sqrt(Float64(1.0 + t_5)) tmp = 0.0 if (t_15 <= 1.5) tmp = Float64(Float64(t_16 + Float64(0.5 * Float64(1.0 / Float64(t_12 * sqrt(Float64(1.0 / t_12)))))) - t_6); elseif (t_15 <= 2.0) tmp = Float64(Float64(sqrt(Float64(t_5 - -1.0)) + sqrt(Float64(t_11 - -1.0))) + Float64(sqrt(Float64(t_12 - -1.0)) - Float64(Float64(t_14 + t_6) + t_13))); else tmp = Float64(Float64(t_16 + Float64(sqrt(Float64(1.0 + t_11)) + sqrt(Float64(1.0 + t_9)))) - Float64(t_6 + Float64(t_14 + t_10))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = max(min(x, y), z); t_2 = max(max(x, y), t_1); t_3 = min(max(x, y), t_1); t_4 = min(min(x, y), z); t_5 = min(t_4, t); t_6 = sqrt(t_5); t_7 = max(t_4, t); t_8 = max(t_3, t_7); t_9 = min(t_2, t_8); t_10 = sqrt(t_9); t_11 = min(t_3, t_7); t_12 = max(t_2, t_8); t_13 = sqrt(t_12); t_14 = sqrt(t_11); t_15 = (((sqrt((t_5 + 1.0)) - t_6) + (sqrt((t_11 + 1.0)) - t_14)) + (sqrt((t_9 + 1.0)) - t_10)) + (sqrt((t_12 + 1.0)) - t_13); t_16 = sqrt((1.0 + t_5)); tmp = 0.0; if (t_15 <= 1.5) tmp = (t_16 + (0.5 * (1.0 / (t_12 * sqrt((1.0 / t_12)))))) - t_6; elseif (t_15 <= 2.0) tmp = (sqrt((t_5 - -1.0)) + sqrt((t_11 - -1.0))) + (sqrt((t_12 - -1.0)) - ((t_14 + t_6) + t_13)); else tmp = (t_16 + (sqrt((1.0 + t_11)) + sqrt((1.0 + t_9)))) - (t_6 + (t_14 + t_10)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[x, y], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$5 = N[Min[t$95$4, t], $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[t$95$5], $MachinePrecision]}, Block[{t$95$7 = N[Max[t$95$4, t], $MachinePrecision]}, Block[{t$95$8 = N[Max[t$95$3, t$95$7], $MachinePrecision]}, Block[{t$95$9 = N[Min[t$95$2, t$95$8], $MachinePrecision]}, Block[{t$95$10 = N[Sqrt[t$95$9], $MachinePrecision]}, Block[{t$95$11 = N[Min[t$95$3, t$95$7], $MachinePrecision]}, Block[{t$95$12 = N[Max[t$95$2, t$95$8], $MachinePrecision]}, Block[{t$95$13 = N[Sqrt[t$95$12], $MachinePrecision]}, Block[{t$95$14 = N[Sqrt[t$95$11], $MachinePrecision]}, Block[{t$95$15 = N[(N[(N[(N[(N[Sqrt[N[(t$95$5 + 1), $MachinePrecision]], $MachinePrecision] - t$95$6), $MachinePrecision] + N[(N[Sqrt[N[(t$95$11 + 1), $MachinePrecision]], $MachinePrecision] - t$95$14), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$9 + 1), $MachinePrecision]], $MachinePrecision] - t$95$10), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$12 + 1), $MachinePrecision]], $MachinePrecision] - t$95$13), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$16 = N[Sqrt[N[(1 + t$95$5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$15, 3/2], N[(N[(t$95$16 + N[(1/2 * N[(1 / N[(t$95$12 * N[Sqrt[N[(1 / t$95$12), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$6), $MachinePrecision], If[LessEqual[t$95$15, 2], N[(N[(N[Sqrt[N[(t$95$5 - -1), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(t$95$11 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$12 - -1), $MachinePrecision]], $MachinePrecision] - N[(N[(t$95$14 + t$95$6), $MachinePrecision] + t$95$13), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$16 + N[(N[Sqrt[N[(1 + t$95$11), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1 + t$95$9), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$6 + N[(t$95$14 + t$95$10), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_5 := \mathsf{min}\left(t\_4, t\right)\\
t_6 := \sqrt{t\_5}\\
t_7 := \mathsf{max}\left(t\_4, t\right)\\
t_8 := \mathsf{max}\left(t\_3, t\_7\right)\\
t_9 := \mathsf{min}\left(t\_2, t\_8\right)\\
t_10 := \sqrt{t\_9}\\
t_11 := \mathsf{min}\left(t\_3, t\_7\right)\\
t_12 := \mathsf{max}\left(t\_2, t\_8\right)\\
t_13 := \sqrt{t\_12}\\
t_14 := \sqrt{t\_11}\\
t_15 := \left(\left(\left(\sqrt{t\_5 + 1} - t\_6\right) + \left(\sqrt{t\_11 + 1} - t\_14\right)\right) + \left(\sqrt{t\_9 + 1} - t\_10\right)\right) + \left(\sqrt{t\_12 + 1} - t\_13\right)\\
t_16 := \sqrt{1 + t\_5}\\
\mathbf{if}\;t\_15 \leq \frac{3}{2}:\\
\;\;\;\;\left(t\_16 + \frac{1}{2} \cdot \frac{1}{t\_12 \cdot \sqrt{\frac{1}{t\_12}}}\right) - t\_6\\
\mathbf{elif}\;t\_15 \leq 2:\\
\;\;\;\;\left(\sqrt{t\_5 - -1} + \sqrt{t\_11 - -1}\right) + \left(\sqrt{t\_12 - -1} - \left(\left(t\_14 + t\_6\right) + t\_13\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_16 + \left(\sqrt{1 + t\_11} + \sqrt{1 + t\_9}\right)\right) - \left(t\_6 + \left(t\_14 + t\_10\right)\right)\\
\end{array}
if (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 1.5Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6413.4%
Applied rewrites13.4%
if 1.5 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 2Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower--.f6418.1%
Applied rewrites18.1%
if 2 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmax x y) (fmax (fmin x y) z)))
(t_2 (fmin (fmin x y) z))
(t_3 (fmax t_2 t))
(t_4 (fmax t_1 t_3))
(t_5 (fmin t_1 t_3))
(t_6 (fmin t_2 t))
(t_7 (sqrt t_6)))
(if (<= t_5 5188146770730811/288230376151711744)
(+
(+ (sqrt (- t_6 -1)) (sqrt (- t_5 -1)))
(- (sqrt (- t_4 -1)) (+ (+ (sqrt t_5) t_7) (sqrt t_4))))
(-
(+ (sqrt (+ 1 t_6)) (* 1/2 (/ 1 (* t_4 (sqrt (/ 1 t_4))))))
t_7))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmax(x, y), fmax(fmin(x, y), z));
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmax(t_2, t);
double t_4 = fmax(t_1, t_3);
double t_5 = fmin(t_1, t_3);
double t_6 = fmin(t_2, t);
double t_7 = sqrt(t_6);
double tmp;
if (t_5 <= 0.018) {
tmp = (sqrt((t_6 - -1.0)) + sqrt((t_5 - -1.0))) + (sqrt((t_4 - -1.0)) - ((sqrt(t_5) + t_7) + sqrt(t_4)));
} else {
tmp = (sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_4 * sqrt((1.0 / t_4)))))) - t_7;
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = fmin(fmax(x, y), fmax(fmin(x, y), z))
t_2 = fmin(fmin(x, y), z)
t_3 = fmax(t_2, t)
t_4 = fmax(t_1, t_3)
t_5 = fmin(t_1, t_3)
t_6 = fmin(t_2, t)
t_7 = sqrt(t_6)
if (t_5 <= 0.018d0) then
tmp = (sqrt((t_6 - (-1.0d0))) + sqrt((t_5 - (-1.0d0)))) + (sqrt((t_4 - (-1.0d0))) - ((sqrt(t_5) + t_7) + sqrt(t_4)))
else
tmp = (sqrt((1.0d0 + t_6)) + (0.5d0 * (1.0d0 / (t_4 * sqrt((1.0d0 / t_4)))))) - t_7
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmax(x, y), fmax(fmin(x, y), z));
double t_2 = fmin(fmin(x, y), z);
double t_3 = fmax(t_2, t);
double t_4 = fmax(t_1, t_3);
double t_5 = fmin(t_1, t_3);
double t_6 = fmin(t_2, t);
double t_7 = Math.sqrt(t_6);
double tmp;
if (t_5 <= 0.018) {
tmp = (Math.sqrt((t_6 - -1.0)) + Math.sqrt((t_5 - -1.0))) + (Math.sqrt((t_4 - -1.0)) - ((Math.sqrt(t_5) + t_7) + Math.sqrt(t_4)));
} else {
tmp = (Math.sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_4 * Math.sqrt((1.0 / t_4)))))) - t_7;
}
return tmp;
}
def code(x, y, z, t): t_1 = fmin(fmax(x, y), fmax(fmin(x, y), z)) t_2 = fmin(fmin(x, y), z) t_3 = fmax(t_2, t) t_4 = fmax(t_1, t_3) t_5 = fmin(t_1, t_3) t_6 = fmin(t_2, t) t_7 = math.sqrt(t_6) tmp = 0 if t_5 <= 0.018: tmp = (math.sqrt((t_6 - -1.0)) + math.sqrt((t_5 - -1.0))) + (math.sqrt((t_4 - -1.0)) - ((math.sqrt(t_5) + t_7) + math.sqrt(t_4))) else: tmp = (math.sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_4 * math.sqrt((1.0 / t_4)))))) - t_7 return tmp
function code(x, y, z, t) t_1 = fmin(fmax(x, y), fmax(fmin(x, y), z)) t_2 = fmin(fmin(x, y), z) t_3 = fmax(t_2, t) t_4 = fmax(t_1, t_3) t_5 = fmin(t_1, t_3) t_6 = fmin(t_2, t) t_7 = sqrt(t_6) tmp = 0.0 if (t_5 <= 0.018) tmp = Float64(Float64(sqrt(Float64(t_6 - -1.0)) + sqrt(Float64(t_5 - -1.0))) + Float64(sqrt(Float64(t_4 - -1.0)) - Float64(Float64(sqrt(t_5) + t_7) + sqrt(t_4)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t_6)) + Float64(0.5 * Float64(1.0 / Float64(t_4 * sqrt(Float64(1.0 / t_4)))))) - t_7); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = min(max(x, y), max(min(x, y), z)); t_2 = min(min(x, y), z); t_3 = max(t_2, t); t_4 = max(t_1, t_3); t_5 = min(t_1, t_3); t_6 = min(t_2, t); t_7 = sqrt(t_6); tmp = 0.0; if (t_5 <= 0.018) tmp = (sqrt((t_6 - -1.0)) + sqrt((t_5 - -1.0))) + (sqrt((t_4 - -1.0)) - ((sqrt(t_5) + t_7) + sqrt(t_4))); else tmp = (sqrt((1.0 + t_6)) + (0.5 * (1.0 / (t_4 * sqrt((1.0 / t_4)))))) - t_7; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Max[x, y], $MachinePrecision], N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$3 = N[Max[t$95$2, t], $MachinePrecision]}, Block[{t$95$4 = N[Max[t$95$1, t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Min[t$95$1, t$95$3], $MachinePrecision]}, Block[{t$95$6 = N[Min[t$95$2, t], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[t$95$6], $MachinePrecision]}, If[LessEqual[t$95$5, 5188146770730811/288230376151711744], N[(N[(N[Sqrt[N[(t$95$6 - -1), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(t$95$5 - -1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t$95$4 - -1), $MachinePrecision]], $MachinePrecision] - N[(N[(N[Sqrt[t$95$5], $MachinePrecision] + t$95$7), $MachinePrecision] + N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1 + t$95$6), $MachinePrecision]], $MachinePrecision] + N[(1/2 * N[(1 / N[(t$95$4 * N[Sqrt[N[(1 / t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$7), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{max}\left(x, y\right), \mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right)\right)\\
t_2 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_3 := \mathsf{max}\left(t\_2, t\right)\\
t_4 := \mathsf{max}\left(t\_1, t\_3\right)\\
t_5 := \mathsf{min}\left(t\_1, t\_3\right)\\
t_6 := \mathsf{min}\left(t\_2, t\right)\\
t_7 := \sqrt{t\_6}\\
\mathbf{if}\;t\_5 \leq \frac{5188146770730811}{288230376151711744}:\\
\;\;\;\;\left(\sqrt{t\_6 - -1} + \sqrt{t\_5 - -1}\right) + \left(\sqrt{t\_4 - -1} - \left(\left(\sqrt{t\_5} + t\_7\right) + \sqrt{t\_4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t\_6} + \frac{1}{2} \cdot \frac{1}{t\_4 \cdot \sqrt{\frac{1}{t\_4}}}\right) - t\_7\\
\end{array}
if y < 0.017999999999999999Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower--.f6418.1%
Applied rewrites18.1%
if 0.017999999999999999 < y Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6413.4%
Applied rewrites13.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmax (fmax (fmin x y) z) (fmax (fmax x y) (fmax t_1 t))))
(t_3 (fmin t_1 t)))
(-
(+ (sqrt (+ 1 t_3)) (* 1/2 (/ 1 (* t_2 (sqrt (/ 1 t_2))))))
(sqrt t_3))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmax(fmin(x, y), z), fmax(fmax(x, y), fmax(t_1, t)));
double t_3 = fmin(t_1, t);
return (sqrt((1.0 + t_3)) + (0.5 * (1.0 / (t_2 * sqrt((1.0 / t_2)))))) - sqrt(t_3);
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
t_1 = fmin(fmin(x, y), z)
t_2 = fmax(fmax(fmin(x, y), z), fmax(fmax(x, y), fmax(t_1, t)))
t_3 = fmin(t_1, t)
code = (sqrt((1.0d0 + t_3)) + (0.5d0 * (1.0d0 / (t_2 * sqrt((1.0d0 / t_2)))))) - sqrt(t_3)
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(fmax(fmin(x, y), z), fmax(fmax(x, y), fmax(t_1, t)));
double t_3 = fmin(t_1, t);
return (Math.sqrt((1.0 + t_3)) + (0.5 * (1.0 / (t_2 * Math.sqrt((1.0 / t_2)))))) - Math.sqrt(t_3);
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmax(fmin(x, y), z), fmax(fmax(x, y), fmax(t_1, t))) t_3 = fmin(t_1, t) return (math.sqrt((1.0 + t_3)) + (0.5 * (1.0 / (t_2 * math.sqrt((1.0 / t_2)))))) - math.sqrt(t_3)
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmax(fmax(fmin(x, y), z), fmax(fmax(x, y), fmax(t_1, t))) t_3 = fmin(t_1, t) return Float64(Float64(sqrt(Float64(1.0 + t_3)) + Float64(0.5 * Float64(1.0 / Float64(t_2 * sqrt(Float64(1.0 / t_2)))))) - sqrt(t_3)) end
function tmp = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = max(max(min(x, y), z), max(max(x, y), max(t_1, t))); t_3 = min(t_1, t); tmp = (sqrt((1.0 + t_3)) + (0.5 * (1.0 / (t_2 * sqrt((1.0 / t_2)))))) - sqrt(t_3); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Min[x, y], $MachinePrecision], z], $MachinePrecision], N[Max[N[Max[x, y], $MachinePrecision], N[Max[t$95$1, t], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Min[t$95$1, t], $MachinePrecision]}, N[(N[(N[Sqrt[N[(1 + t$95$3), $MachinePrecision]], $MachinePrecision] + N[(1/2 * N[(1 / N[(t$95$2 * N[Sqrt[N[(1 / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{min}\left(x, y\right), z\right), \mathsf{max}\left(\mathsf{max}\left(x, y\right), \mathsf{max}\left(t\_1, t\right)\right)\right)\\
t_3 := \mathsf{min}\left(t\_1, t\right)\\
\left(\sqrt{1 + t\_3} + \frac{1}{2} \cdot \frac{1}{t\_2 \cdot \sqrt{\frac{1}{t\_2}}}\right) - \sqrt{t\_3}
\end{array}
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6413.4%
Applied rewrites13.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fmin (fmin x y) z))
(t_2 (fmax t_1 t))
(t_3 (fmin t_1 t)))
(+
(sqrt (- t_3 -1))
(- (sqrt (- t_2 -1)) (+ (sqrt t_2) (sqrt t_3))))))double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(t_1, t);
double t_3 = fmin(t_1, t);
return sqrt((t_3 - -1.0)) + (sqrt((t_2 - -1.0)) - (sqrt(t_2) + sqrt(t_3)));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
t_1 = fmin(fmin(x, y), z)
t_2 = fmax(t_1, t)
t_3 = fmin(t_1, t)
code = sqrt((t_3 - (-1.0d0))) + (sqrt((t_2 - (-1.0d0))) - (sqrt(t_2) + sqrt(t_3)))
end function
public static double code(double x, double y, double z, double t) {
double t_1 = fmin(fmin(x, y), z);
double t_2 = fmax(t_1, t);
double t_3 = fmin(t_1, t);
return Math.sqrt((t_3 - -1.0)) + (Math.sqrt((t_2 - -1.0)) - (Math.sqrt(t_2) + Math.sqrt(t_3)));
}
def code(x, y, z, t): t_1 = fmin(fmin(x, y), z) t_2 = fmax(t_1, t) t_3 = fmin(t_1, t) return math.sqrt((t_3 - -1.0)) + (math.sqrt((t_2 - -1.0)) - (math.sqrt(t_2) + math.sqrt(t_3)))
function code(x, y, z, t) t_1 = fmin(fmin(x, y), z) t_2 = fmax(t_1, t) t_3 = fmin(t_1, t) return Float64(sqrt(Float64(t_3 - -1.0)) + Float64(sqrt(Float64(t_2 - -1.0)) - Float64(sqrt(t_2) + sqrt(t_3)))) end
function tmp = code(x, y, z, t) t_1 = min(min(x, y), z); t_2 = max(t_1, t); t_3 = min(t_1, t); tmp = sqrt((t_3 - -1.0)) + (sqrt((t_2 - -1.0)) - (sqrt(t_2) + sqrt(t_3))); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]}, Block[{t$95$2 = N[Max[t$95$1, t], $MachinePrecision]}, Block[{t$95$3 = N[Min[t$95$1, t], $MachinePrecision]}, N[(N[Sqrt[N[(t$95$3 - -1), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(t$95$2 - -1), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t$95$2], $MachinePrecision] + N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)\\
t_2 := \mathsf{max}\left(t\_1, t\right)\\
t_3 := \mathsf{min}\left(t\_1, t\right)\\
\sqrt{t\_3 - -1} + \left(\sqrt{t\_2 - -1} - \left(\sqrt{t\_2} + \sqrt{t\_3}\right)\right)
\end{array}
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower--.f6421.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6421.5%
Applied rewrites21.5%
(FPCore (x y z t) :precision binary64 (- (+ 1 (+ (sqrt (+ 1 x)) (* 1/2 t))) (+ (sqrt t) (sqrt x))))
double code(double x, double y, double z, double t) {
return (1.0 + (sqrt((1.0 + x)) + (0.5 * t))) - (sqrt(t) + sqrt(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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 + (sqrt((1.0d0 + x)) + (0.5d0 * t))) - (sqrt(t) + sqrt(x))
end function
public static double code(double x, double y, double z, double t) {
return (1.0 + (Math.sqrt((1.0 + x)) + (0.5 * t))) - (Math.sqrt(t) + Math.sqrt(x));
}
def code(x, y, z, t): return (1.0 + (math.sqrt((1.0 + x)) + (0.5 * t))) - (math.sqrt(t) + math.sqrt(x))
function code(x, y, z, t) return Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + x)) + Float64(0.5 * t))) - Float64(sqrt(t) + sqrt(x))) end
function tmp = code(x, y, z, t) tmp = (1.0 + (sqrt((1.0 + x)) + (0.5 * t))) - (sqrt(t) + sqrt(x)); end
code[x_, y_, z_, t_] := N[(N[(1 + N[(N[Sqrt[N[(1 + x), $MachinePrecision]], $MachinePrecision] + N[(1/2 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(1 + \left(\sqrt{1 + x} + \frac{1}{2} \cdot t\right)\right) - \left(\sqrt{t} + \sqrt{x}\right)
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in t around 0
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f6413.3%
Applied rewrites13.3%
(FPCore (x y z t) :precision binary64 (- (+ 1 (+ (sqrt (+ 1 t)) (* 1/2 x))) (+ (sqrt t) (sqrt x))))
double code(double x, double y, double z, double t) {
return (1.0 + (sqrt((1.0 + t)) + (0.5 * x))) - (sqrt(t) + sqrt(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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 + (sqrt((1.0d0 + t)) + (0.5d0 * x))) - (sqrt(t) + sqrt(x))
end function
public static double code(double x, double y, double z, double t) {
return (1.0 + (Math.sqrt((1.0 + t)) + (0.5 * x))) - (Math.sqrt(t) + Math.sqrt(x));
}
def code(x, y, z, t): return (1.0 + (math.sqrt((1.0 + t)) + (0.5 * x))) - (math.sqrt(t) + math.sqrt(x))
function code(x, y, z, t) return Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(0.5 * x))) - Float64(sqrt(t) + sqrt(x))) end
function tmp = code(x, y, z, t) tmp = (1.0 + (sqrt((1.0 + t)) + (0.5 * x))) - (sqrt(t) + sqrt(x)); end
code[x_, y_, z_, t_] := N[(N[(1 + N[(N[Sqrt[N[(1 + t), $MachinePrecision]], $MachinePrecision] + N[(1/2 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(1 + \left(\sqrt{1 + t} + \frac{1}{2} \cdot x\right)\right) - \left(\sqrt{t} + \sqrt{x}\right)
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f6413.2%
Applied rewrites13.2%
(FPCore (x y z t) :precision binary64 (- (+ 1 (sqrt (+ 1 t))) (+ (sqrt t) (sqrt (fmin (fmin x y) z)))))
double code(double x, double y, double z, double t) {
return (1.0 + sqrt((1.0 + t))) - (sqrt(t) + sqrt(fmin(fmin(x, y), z)));
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (1.0d0 + sqrt((1.0d0 + t))) - (sqrt(t) + sqrt(fmin(fmin(x, y), z)))
end function
public static double code(double x, double y, double z, double t) {
return (1.0 + Math.sqrt((1.0 + t))) - (Math.sqrt(t) + Math.sqrt(fmin(fmin(x, y), z)));
}
def code(x, y, z, t): return (1.0 + math.sqrt((1.0 + t))) - (math.sqrt(t) + math.sqrt(fmin(fmin(x, y), z)))
function code(x, y, z, t) return Float64(Float64(1.0 + sqrt(Float64(1.0 + t))) - Float64(sqrt(t) + sqrt(fmin(fmin(x, y), z)))) end
function tmp = code(x, y, z, t) tmp = (1.0 + sqrt((1.0 + t))) - (sqrt(t) + sqrt(min(min(x, y), z))); end
code[x_, y_, z_, t_] := N[(N[(1 + N[Sqrt[N[(1 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[Min[N[Min[x, y], $MachinePrecision], z], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(1 + \sqrt{1 + t}\right) - \left(\sqrt{t} + \sqrt{\mathsf{min}\left(\mathsf{min}\left(x, y\right), z\right)}\right)
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f6411.5%
Applied rewrites11.5%
(FPCore (x y z t) :precision binary64 (- (sqrt (+ 1 t)) (sqrt t)))
double code(double x, double y, double z, double t) {
return sqrt((1.0 + t)) - sqrt(t);
}
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, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + t)) - sqrt(t)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + t)) - Math.sqrt(t);
}
def code(x, y, z, t): return math.sqrt((1.0 + t)) - math.sqrt(t)
function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) end
function tmp = code(x, y, z, t) tmp = sqrt((1.0 + t)) - sqrt(t); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]
\sqrt{1 + t} - \sqrt{t}
Initial program 91.6%
Taylor expanded in z around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites11.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6413.3%
Applied rewrites13.3%
Taylor expanded in x around inf
lower--.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-sqrt.f6415.5%
Applied rewrites15.5%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
(+ (+ (+ (- (sqrt (+ x 1)) (sqrt x)) (- (sqrt (+ y 1)) (sqrt y))) (- (sqrt (+ z 1)) (sqrt z))) (- (sqrt (+ t 1)) (sqrt t))))