
(FPCore (z1 z0) :precision binary64 (/ (- (* 0.053051646556513725 z1) (* 0.02210485264800276 z0)) (* z1 z1)))
double code(double z1, double z0) {
return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = ((0.053051646556513725d0 * z1) - (0.02210485264800276d0 * z0)) / (z1 * z1)
end function
public static double code(double z1, double z0) {
return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
}
def code(z1, z0): return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1)
function code(z1, z0) return Float64(Float64(Float64(0.053051646556513725 * z1) - Float64(0.02210485264800276 * z0)) / Float64(z1 * z1)) end
function tmp = code(z1, z0) tmp = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1); end
code[z1_, z0_] := N[(N[(N[(0.053051646556513725 * z1), $MachinePrecision] - N[(0.02210485264800276 * z0), $MachinePrecision]), $MachinePrecision] / N[(z1 * z1), $MachinePrecision]), $MachinePrecision]
\frac{0.053051646556513725 \cdot z1 - 0.02210485264800276 \cdot z0}{z1 \cdot z1}
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0) :precision binary64 (/ (- (* 0.053051646556513725 z1) (* 0.02210485264800276 z0)) (* z1 z1)))
double code(double z1, double z0) {
return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = ((0.053051646556513725d0 * z1) - (0.02210485264800276d0 * z0)) / (z1 * z1)
end function
public static double code(double z1, double z0) {
return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
}
def code(z1, z0): return ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1)
function code(z1, z0) return Float64(Float64(Float64(0.053051646556513725 * z1) - Float64(0.02210485264800276 * z0)) / Float64(z1 * z1)) end
function tmp = code(z1, z0) tmp = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1); end
code[z1_, z0_] := N[(N[(N[(0.053051646556513725 * z1), $MachinePrecision] - N[(0.02210485264800276 * z0), $MachinePrecision]), $MachinePrecision] / N[(z1 * z1), $MachinePrecision]), $MachinePrecision]
\frac{0.053051646556513725 \cdot z1 - 0.02210485264800276 \cdot z0}{z1 \cdot z1}
(FPCore (z1 z0) :precision binary64 (- (/ 0.053051646556513725 z1) (* (/ z0 z1) (/ 0.02210485264800276 z1))))
double code(double z1, double z0) {
return (0.053051646556513725 / z1) - ((z0 / z1) * (0.02210485264800276 / z1));
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = (0.053051646556513725d0 / z1) - ((z0 / z1) * (0.02210485264800276d0 / z1))
end function
public static double code(double z1, double z0) {
return (0.053051646556513725 / z1) - ((z0 / z1) * (0.02210485264800276 / z1));
}
def code(z1, z0): return (0.053051646556513725 / z1) - ((z0 / z1) * (0.02210485264800276 / z1))
function code(z1, z0) return Float64(Float64(0.053051646556513725 / z1) - Float64(Float64(z0 / z1) * Float64(0.02210485264800276 / z1))) end
function tmp = code(z1, z0) tmp = (0.053051646556513725 / z1) - ((z0 / z1) * (0.02210485264800276 / z1)); end
code[z1_, z0_] := N[(N[(0.053051646556513725 / z1), $MachinePrecision] - N[(N[(z0 / z1), $MachinePrecision] * N[(0.02210485264800276 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{0.053051646556513725}{z1} - \frac{z0}{z1} \cdot \frac{0.02210485264800276}{z1}
Initial program 71.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-*l*N/A
mult-flipN/A
lift-*.f64N/A
associate-/r*N/A
*-inversesN/A
mult-flipN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.5%
Applied rewrites91.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lift-/.f64N/A
lower-*.f6499.8%
Applied rewrites99.8%
(FPCore (z1 z0) :precision binary64 (/ (- (* -0.02210485264800276 (/ z0 z1)) -0.053051646556513725) z1))
double code(double z1, double z0) {
return ((-0.02210485264800276 * (z0 / z1)) - -0.053051646556513725) / z1;
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = (((-0.02210485264800276d0) * (z0 / z1)) - (-0.053051646556513725d0)) / z1
end function
public static double code(double z1, double z0) {
return ((-0.02210485264800276 * (z0 / z1)) - -0.053051646556513725) / z1;
}
def code(z1, z0): return ((-0.02210485264800276 * (z0 / z1)) - -0.053051646556513725) / z1
function code(z1, z0) return Float64(Float64(Float64(-0.02210485264800276 * Float64(z0 / z1)) - -0.053051646556513725) / z1) end
function tmp = code(z1, z0) tmp = ((-0.02210485264800276 * (z0 / z1)) - -0.053051646556513725) / z1; end
code[z1_, z0_] := N[(N[(N[(-0.02210485264800276 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision] - -0.053051646556513725), $MachinePrecision] / z1), $MachinePrecision]
\frac{-0.02210485264800276 \cdot \frac{z0}{z1} - -0.053051646556513725}{z1}
Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0
(/
(- (* 0.053051646556513725 z1) (* 0.02210485264800276 z0))
(* z1 z1))))
(if (<= t_0 -5e-82)
t_0
(if (<= t_0 2e-68) (/ 0.053051646556513725 z1) t_0))))double code(double z1, double z0) {
double t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
double tmp;
if (t_0 <= -5e-82) {
tmp = t_0;
} else if (t_0 <= 2e-68) {
tmp = 0.053051646556513725 / z1;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: tmp
t_0 = ((0.053051646556513725d0 * z1) - (0.02210485264800276d0 * z0)) / (z1 * z1)
if (t_0 <= (-5d-82)) then
tmp = t_0
else if (t_0 <= 2d-68) then
tmp = 0.053051646556513725d0 / z1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
double tmp;
if (t_0 <= -5e-82) {
tmp = t_0;
} else if (t_0 <= 2e-68) {
tmp = 0.053051646556513725 / z1;
} else {
tmp = t_0;
}
return tmp;
}
def code(z1, z0): t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1) tmp = 0 if t_0 <= -5e-82: tmp = t_0 elif t_0 <= 2e-68: tmp = 0.053051646556513725 / z1 else: tmp = t_0 return tmp
function code(z1, z0) t_0 = Float64(Float64(Float64(0.053051646556513725 * z1) - Float64(0.02210485264800276 * z0)) / Float64(z1 * z1)) tmp = 0.0 if (t_0 <= -5e-82) tmp = t_0; elseif (t_0 <= 2e-68) tmp = Float64(0.053051646556513725 / z1); else tmp = t_0; end return tmp end
function tmp_2 = code(z1, z0) t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1); tmp = 0.0; if (t_0 <= -5e-82) tmp = t_0; elseif (t_0 <= 2e-68) tmp = 0.053051646556513725 / z1; else tmp = t_0; end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[(0.053051646556513725 * z1), $MachinePrecision] - N[(0.02210485264800276 * z0), $MachinePrecision]), $MachinePrecision] / N[(z1 * z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-82], t$95$0, If[LessEqual[t$95$0, 2e-68], N[(0.053051646556513725 / z1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{0.053051646556513725 \cdot z1 - 0.02210485264800276 \cdot z0}{z1 \cdot z1}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\frac{0.053051646556513725}{z1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) < -4.9999999999999998e-82 or 2.0000000000000001e-68 < (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) Initial program 71.8%
if -4.9999999999999998e-82 < (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) < 2.0000000000000001e-68Initial program 71.8%
Taylor expanded in z1 around inf
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0
(/
(- (* 0.053051646556513725 z1) (* 0.02210485264800276 z0))
(* z1 z1)))
(t_1 (/ (* -0.02210485264800276 z0) (* z1 z1))))
(if (<= t_0 -1e+186)
t_1
(if (<= t_0 2e+78) (/ 0.053051646556513725 z1) t_1))))double code(double z1, double z0) {
double t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
double t_1 = (-0.02210485264800276 * z0) / (z1 * z1);
double tmp;
if (t_0 <= -1e+186) {
tmp = t_1;
} else if (t_0 <= 2e+78) {
tmp = 0.053051646556513725 / z1;
} else {
tmp = t_1;
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((0.053051646556513725d0 * z1) - (0.02210485264800276d0 * z0)) / (z1 * z1)
t_1 = ((-0.02210485264800276d0) * z0) / (z1 * z1)
if (t_0 <= (-1d+186)) then
tmp = t_1
else if (t_0 <= 2d+78) then
tmp = 0.053051646556513725d0 / z1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1);
double t_1 = (-0.02210485264800276 * z0) / (z1 * z1);
double tmp;
if (t_0 <= -1e+186) {
tmp = t_1;
} else if (t_0 <= 2e+78) {
tmp = 0.053051646556513725 / z1;
} else {
tmp = t_1;
}
return tmp;
}
def code(z1, z0): t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1) t_1 = (-0.02210485264800276 * z0) / (z1 * z1) tmp = 0 if t_0 <= -1e+186: tmp = t_1 elif t_0 <= 2e+78: tmp = 0.053051646556513725 / z1 else: tmp = t_1 return tmp
function code(z1, z0) t_0 = Float64(Float64(Float64(0.053051646556513725 * z1) - Float64(0.02210485264800276 * z0)) / Float64(z1 * z1)) t_1 = Float64(Float64(-0.02210485264800276 * z0) / Float64(z1 * z1)) tmp = 0.0 if (t_0 <= -1e+186) tmp = t_1; elseif (t_0 <= 2e+78) tmp = Float64(0.053051646556513725 / z1); else tmp = t_1; end return tmp end
function tmp_2 = code(z1, z0) t_0 = ((0.053051646556513725 * z1) - (0.02210485264800276 * z0)) / (z1 * z1); t_1 = (-0.02210485264800276 * z0) / (z1 * z1); tmp = 0.0; if (t_0 <= -1e+186) tmp = t_1; elseif (t_0 <= 2e+78) tmp = 0.053051646556513725 / z1; else tmp = t_1; end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[(0.053051646556513725 * z1), $MachinePrecision] - N[(0.02210485264800276 * z0), $MachinePrecision]), $MachinePrecision] / N[(z1 * z1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.02210485264800276 * z0), $MachinePrecision] / N[(z1 * z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+186], t$95$1, If[LessEqual[t$95$0, 2e+78], N[(0.053051646556513725 / z1), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{0.053051646556513725 \cdot z1 - 0.02210485264800276 \cdot z0}{z1 \cdot z1}\\
t_1 := \frac{-0.02210485264800276 \cdot z0}{z1 \cdot z1}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+78}:\\
\;\;\;\;\frac{0.053051646556513725}{z1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) < -9.9999999999999998e185 or 2e78 < (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) Initial program 71.8%
Taylor expanded in z1 around 0
lower-*.f6446.3%
Applied rewrites46.3%
if -9.9999999999999998e185 < (/.f64 (-.f64 (*.f64 #s(literal 2122065862260549/40000000000000000 binary64) z1) (*.f64 #s(literal 552621316200069/25000000000000000 binary64) z0)) (*.f64 z1 z1)) < 2e78Initial program 71.8%
Taylor expanded in z1 around inf
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (z1 z0) :precision binary64 (/ 0.053051646556513725 z1))
double code(double z1, double z0) {
return 0.053051646556513725 / z1;
}
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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 0.053051646556513725d0 / z1
end function
public static double code(double z1, double z0) {
return 0.053051646556513725 / z1;
}
def code(z1, z0): return 0.053051646556513725 / z1
function code(z1, z0) return Float64(0.053051646556513725 / z1) end
function tmp = code(z1, z0) tmp = 0.053051646556513725 / z1; end
code[z1_, z0_] := N[(0.053051646556513725 / z1), $MachinePrecision]
\frac{0.053051646556513725}{z1}
Initial program 71.8%
Taylor expanded in z1 around inf
lower-/.f6451.3%
Applied rewrites51.3%
herbie shell --seed 2025250
(FPCore (z1 z0)
:name "(/ (- (* 2122065862260549/40000000000000000 z1) (* 552621316200069/25000000000000000 z0)) (* z1 z1))"
:precision binary64
(/ (- (* 0.053051646556513725 z1) (* 0.02210485264800276 z0)) (* z1 z1)))