
(FPCore (x y z) :precision binary64 :pre TRUE (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = (x + y) / ((1) - (y / z)) END code
\frac{x + y}{1 - \frac{y}{z}}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 :pre TRUE (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = (x + y) / ((1) - (y / z)) END code
\frac{x + y}{1 - \frac{y}{z}}
(FPCore (x y z)
:precision binary64
:pre TRUE
(if (<= y -3.782608026078261e+52)
(/ z (/ (- z y) (+ y x)))
(if (<= y 2.782787727800268e+40)
(/ (+ x y) (- 1.0 (/ y z)))
(* z (/ (+ y x) (- z y))))))double code(double x, double y, double z) {
double tmp;
if (y <= -3.782608026078261e+52) {
tmp = z / ((z - y) / (y + x));
} else if (y <= 2.782787727800268e+40) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = z * ((y + x) / (z - y));
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.782608026078261d+52)) then
tmp = z / ((z - y) / (y + x))
else if (y <= 2.782787727800268d+40) then
tmp = (x + y) / (1.0d0 - (y / z))
else
tmp = z * ((y + x) / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.782608026078261e+52) {
tmp = z / ((z - y) / (y + x));
} else if (y <= 2.782787727800268e+40) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = z * ((y + x) / (z - y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.782608026078261e+52: tmp = z / ((z - y) / (y + x)) elif y <= 2.782787727800268e+40: tmp = (x + y) / (1.0 - (y / z)) else: tmp = z * ((y + x) / (z - y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.782608026078261e+52) tmp = Float64(z / Float64(Float64(z - y) / Float64(y + x))); elseif (y <= 2.782787727800268e+40) tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))); else tmp = Float64(z * Float64(Float64(y + x) / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.782608026078261e+52) tmp = z / ((z - y) / (y + x)); elseif (y <= 2.782787727800268e+40) tmp = (x + y) / (1.0 - (y / z)); else tmp = z * ((y + x) / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.782608026078261e+52], N[(z / N[(N[(z - y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.782787727800268e+40], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp_1 = IF (y <= (27827877278002678491622181790330216513536)) THEN ((x + y) / ((1) - (y / z))) ELSE (z * ((y + x) / (z - y))) ENDIF IN LET tmp = IF (y <= (-37826080260782611780427230706470323719289090349203456)) THEN (z / ((z - y) / (y + x))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -3.782608026078261 \cdot 10^{+52}:\\
\;\;\;\;\frac{z}{\frac{z - y}{y + x}}\\
\mathbf{elif}\;y \leq 2.782787727800268 \cdot 10^{+40}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y + x}{z - y}\\
\end{array}
if y < -3.7826080260782612e52Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
if -3.7826080260782612e52 < y < 2.7827877278002678e40Initial program 88.0%
if 2.7827877278002678e40 < y Initial program 88.0%
Applied rewrites92.3%
(FPCore (x y z)
:precision binary64
:pre TRUE
(if (<= y -4.779069952465816e+41)
(/ z (/ (- z y) (+ y x)))
(if (<= y 2.782787727800268e+40)
(* (+ y x) (/ z (- z y)))
(* z (/ (+ y x) (- z y))))))double code(double x, double y, double z) {
double tmp;
if (y <= -4.779069952465816e+41) {
tmp = z / ((z - y) / (y + x));
} else if (y <= 2.782787727800268e+40) {
tmp = (y + x) * (z / (z - y));
} else {
tmp = z * ((y + x) / (z - y));
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-4.779069952465816d+41)) then
tmp = z / ((z - y) / (y + x))
else if (y <= 2.782787727800268d+40) then
tmp = (y + x) * (z / (z - y))
else
tmp = z * ((y + x) / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.779069952465816e+41) {
tmp = z / ((z - y) / (y + x));
} else if (y <= 2.782787727800268e+40) {
tmp = (y + x) * (z / (z - y));
} else {
tmp = z * ((y + x) / (z - y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.779069952465816e+41: tmp = z / ((z - y) / (y + x)) elif y <= 2.782787727800268e+40: tmp = (y + x) * (z / (z - y)) else: tmp = z * ((y + x) / (z - y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.779069952465816e+41) tmp = Float64(z / Float64(Float64(z - y) / Float64(y + x))); elseif (y <= 2.782787727800268e+40) tmp = Float64(Float64(y + x) * Float64(z / Float64(z - y))); else tmp = Float64(z * Float64(Float64(y + x) / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.779069952465816e+41) tmp = z / ((z - y) / (y + x)); elseif (y <= 2.782787727800268e+40) tmp = (y + x) * (z / (z - y)); else tmp = z * ((y + x) / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.779069952465816e+41], N[(z / N[(N[(z - y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.782787727800268e+40], N[(N[(y + x), $MachinePrecision] * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp_1 = IF (y <= (27827877278002678491622181790330216513536)) THEN ((y + x) * (z / (z - y))) ELSE (z * ((y + x) / (z - y))) ENDIF IN LET tmp = IF (y <= (-477906995246581564721202183051219172327424)) THEN (z / ((z - y) / (y + x))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -4.779069952465816 \cdot 10^{+41}:\\
\;\;\;\;\frac{z}{\frac{z - y}{y + x}}\\
\mathbf{elif}\;y \leq 2.782787727800268 \cdot 10^{+40}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y + x}{z - y}\\
\end{array}
if y < -4.7790699524658156e41Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
if -4.7790699524658156e41 < y < 2.7827877278002678e40Initial program 88.0%
Applied rewrites88.8%
if 2.7827877278002678e40 < y Initial program 88.0%
Applied rewrites92.3%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* z (/ (+ y x) (- z y)))))
(if (<= y -2.349987207420596e+38)
t_0
(if (<= y 2.782787727800268e+40) (* (+ y x) (/ z (- z y))) t_0))))double code(double x, double y, double z) {
double t_0 = z * ((y + x) / (z - y));
double tmp;
if (y <= -2.349987207420596e+38) {
tmp = t_0;
} else if (y <= 2.782787727800268e+40) {
tmp = (y + x) * (z / (z - y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * ((y + x) / (z - y))
if (y <= (-2.349987207420596d+38)) then
tmp = t_0
else if (y <= 2.782787727800268d+40) then
tmp = (y + x) * (z / (z - y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((y + x) / (z - y));
double tmp;
if (y <= -2.349987207420596e+38) {
tmp = t_0;
} else if (y <= 2.782787727800268e+40) {
tmp = (y + x) * (z / (z - y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * ((y + x) / (z - y)) tmp = 0 if y <= -2.349987207420596e+38: tmp = t_0 elif y <= 2.782787727800268e+40: tmp = (y + x) * (z / (z - y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(y + x) / Float64(z - y))) tmp = 0.0 if (y <= -2.349987207420596e+38) tmp = t_0; elseif (y <= 2.782787727800268e+40) tmp = Float64(Float64(y + x) * Float64(z / Float64(z - y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((y + x) / (z - y)); tmp = 0.0; if (y <= -2.349987207420596e+38) tmp = t_0; elseif (y <= 2.782787727800268e+40) tmp = (y + x) * (z / (z - y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.349987207420596e+38], t$95$0, If[LessEqual[y, 2.782787727800268e+40], N[(N[(y + x), $MachinePrecision] * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = (z * ((y + x) / (z - y))) IN LET tmp_1 = IF (y <= (27827877278002678491622181790330216513536)) THEN ((y + x) * (z / (z - y))) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-234998720742059599760376513388584370176)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := z \cdot \frac{y + x}{z - y}\\
\mathbf{if}\;y \leq -2.349987207420596 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.782787727800268 \cdot 10^{+40}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{z}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -2.349987207420596e38 or 2.7827877278002678e40 < y Initial program 88.0%
Applied rewrites92.3%
if -2.349987207420596e38 < y < 2.7827877278002678e40Initial program 88.0%
Applied rewrites88.8%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* z (/ (+ y x) (- z y)))))
(if (<= y -1.393380278335505e-132)
t_0
(if (<= y 1.2590884414245868e-121) (+ x y) t_0))))double code(double x, double y, double z) {
double t_0 = z * ((y + x) / (z - y));
double tmp;
if (y <= -1.393380278335505e-132) {
tmp = t_0;
} else if (y <= 1.2590884414245868e-121) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * ((y + x) / (z - y))
if (y <= (-1.393380278335505d-132)) then
tmp = t_0
else if (y <= 1.2590884414245868d-121) then
tmp = x + y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((y + x) / (z - y));
double tmp;
if (y <= -1.393380278335505e-132) {
tmp = t_0;
} else if (y <= 1.2590884414245868e-121) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * ((y + x) / (z - y)) tmp = 0 if y <= -1.393380278335505e-132: tmp = t_0 elif y <= 1.2590884414245868e-121: tmp = x + y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(y + x) / Float64(z - y))) tmp = 0.0 if (y <= -1.393380278335505e-132) tmp = t_0; elseif (y <= 1.2590884414245868e-121) tmp = Float64(x + y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((y + x) / (z - y)); tmp = 0.0; if (y <= -1.393380278335505e-132) tmp = t_0; elseif (y <= 1.2590884414245868e-121) tmp = x + y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.393380278335505e-132], t$95$0, If[LessEqual[y, 1.2590884414245868e-121], N[(x + y), $MachinePrecision], t$95$0]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = (z * ((y + x) / (z - y))) IN LET tmp_1 = IF (y <= (12590884414245867916964251781670553425417828492279866593888021910993250080090161244863213897198858140141885910576060382130240866304915151059412932972558710258646141320215692889407817085927726543953633644674597646893887990114242500969246794803344558933696047747674296307472368679095407872762547862866000514259212650358676910400390625e-452)) THEN (x + y) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-139338027833550495421609237833855785807980735895209602394223859933222193787226464124841903037081523468805133003768223682553246453031977759931545536458730632658134641763278300327297454251337311798227706847060284131383382562262257891156626774541822376601076696158484243728964800060628392342937379722448231107140534479706985016012055211831466294825077056884765625e-491)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := z \cdot \frac{y + x}{z - y}\\
\mathbf{if}\;y \leq -1.393380278335505 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.2590884414245868 \cdot 10^{-121}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.393380278335505e-132 or 1.2590884414245868e-121 < y Initial program 88.0%
Applied rewrites92.3%
if -1.393380278335505e-132 < y < 1.2590884414245868e-121Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
Taylor expanded in x around inf
Applied rewrites45.0%
Taylor expanded in z around inf
Applied rewrites50.6%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (* (/ y (- z y)) z)))
(if (<= y -3.2190743546567084e-42)
t_0
(if (<= y -4.73466363203287e-181)
(* x (/ z (- z y)))
(if (<= y 1.218357395521096e-7) (+ x y) t_0)))))double code(double x, double y, double z) {
double t_0 = (y / (z - y)) * z;
double tmp;
if (y <= -3.2190743546567084e-42) {
tmp = t_0;
} else if (y <= -4.73466363203287e-181) {
tmp = x * (z / (z - y));
} else if (y <= 1.218357395521096e-7) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (y / (z - y)) * z
if (y <= (-3.2190743546567084d-42)) then
tmp = t_0
else if (y <= (-4.73466363203287d-181)) then
tmp = x * (z / (z - y))
else if (y <= 1.218357395521096d-7) then
tmp = x + y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y / (z - y)) * z;
double tmp;
if (y <= -3.2190743546567084e-42) {
tmp = t_0;
} else if (y <= -4.73466363203287e-181) {
tmp = x * (z / (z - y));
} else if (y <= 1.218357395521096e-7) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (y / (z - y)) * z tmp = 0 if y <= -3.2190743546567084e-42: tmp = t_0 elif y <= -4.73466363203287e-181: tmp = x * (z / (z - y)) elif y <= 1.218357395521096e-7: tmp = x + y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(y / Float64(z - y)) * z) tmp = 0.0 if (y <= -3.2190743546567084e-42) tmp = t_0; elseif (y <= -4.73466363203287e-181) tmp = Float64(x * Float64(z / Float64(z - y))); elseif (y <= 1.218357395521096e-7) tmp = Float64(x + y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y / (z - y)) * z; tmp = 0.0; if (y <= -3.2190743546567084e-42) tmp = t_0; elseif (y <= -4.73466363203287e-181) tmp = x * (z / (z - y)); elseif (y <= 1.218357395521096e-7) tmp = x + y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -3.2190743546567084e-42], t$95$0, If[LessEqual[y, -4.73466363203287e-181], N[(x * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.218357395521096e-7], N[(x + y), $MachinePrecision], t$95$0]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = ((y / (z - y)) * z) IN LET tmp_2 = IF (y <= (121835739552109587254476760591337392014565921272151172161102294921875e-75)) THEN (x + y) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (-4734663632032869917938737926775996076304363301531924046625645605168081914623443707539272548654688762786328737096233062537483599475836292175195387950595192747046857263437979868700255469409554212834747288476811883514543915831968463510360557257527096592511330425377670450249512797864810003927783307768410582167096042022980766605779449371542008021586849605881386176575670165330092589403825487986570776211361618841752453989202417675347979442168622199460514821112155914306640625e-652)) THEN (x * (z / (z - y))) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-321907435465670843865925379648631418932056154541407274247954021849173747255142939905268844251927711768855762397567588095625978894531726837158203125e-188)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := \frac{y}{z - y} \cdot z\\
\mathbf{if}\;y \leq -3.2190743546567084 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -4.73466363203287 \cdot 10^{-181}:\\
\;\;\;\;x \cdot \frac{z}{z - y}\\
\mathbf{elif}\;y \leq 1.218357395521096 \cdot 10^{-7}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -3.2190743546567084e-42 or 1.2183573955210959e-7 < y Initial program 88.0%
Taylor expanded in x around 0
Applied rewrites42.0%
Applied rewrites49.8%
if -3.2190743546567084e-42 < y < -4.7346636320328699e-181Initial program 88.0%
Taylor expanded in x around inf
Applied rewrites48.3%
Applied rewrites48.5%
if -4.7346636320328699e-181 < y < 1.2183573955210959e-7Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
Taylor expanded in x around inf
Applied rewrites45.0%
Taylor expanded in z around inf
Applied rewrites50.6%
(FPCore (x y z)
:precision binary64
:pre TRUE
(let* ((t_0 (/ z (- z y))))
(if (<= y -8.03123504347913e+206)
(- z)
(if (<= y -3.2190743546567084e-42)
(* y t_0)
(if (<= y -4.73466363203287e-181)
(* x t_0)
(if (<= y 4.681666818528092e+63) (+ x y) (- z)))))))double code(double x, double y, double z) {
double t_0 = z / (z - y);
double tmp;
if (y <= -8.03123504347913e+206) {
tmp = -z;
} else if (y <= -3.2190743546567084e-42) {
tmp = y * t_0;
} else if (y <= -4.73466363203287e-181) {
tmp = x * t_0;
} else if (y <= 4.681666818528092e+63) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z / (z - y)
if (y <= (-8.03123504347913d+206)) then
tmp = -z
else if (y <= (-3.2190743546567084d-42)) then
tmp = y * t_0
else if (y <= (-4.73466363203287d-181)) then
tmp = x * t_0
else if (y <= 4.681666818528092d+63) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (z - y);
double tmp;
if (y <= -8.03123504347913e+206) {
tmp = -z;
} else if (y <= -3.2190743546567084e-42) {
tmp = y * t_0;
} else if (y <= -4.73466363203287e-181) {
tmp = x * t_0;
} else if (y <= 4.681666818528092e+63) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = z / (z - y) tmp = 0 if y <= -8.03123504347913e+206: tmp = -z elif y <= -3.2190743546567084e-42: tmp = y * t_0 elif y <= -4.73466363203287e-181: tmp = x * t_0 elif y <= 4.681666818528092e+63: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(z / Float64(z - y)) tmp = 0.0 if (y <= -8.03123504347913e+206) tmp = Float64(-z); elseif (y <= -3.2190743546567084e-42) tmp = Float64(y * t_0); elseif (y <= -4.73466363203287e-181) tmp = Float64(x * t_0); elseif (y <= 4.681666818528092e+63) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (z - y); tmp = 0.0; if (y <= -8.03123504347913e+206) tmp = -z; elseif (y <= -3.2190743546567084e-42) tmp = y * t_0; elseif (y <= -4.73466363203287e-181) tmp = x * t_0; elseif (y <= 4.681666818528092e+63) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.03123504347913e+206], (-z), If[LessEqual[y, -3.2190743546567084e-42], N[(y * t$95$0), $MachinePrecision], If[LessEqual[y, -4.73466363203287e-181], N[(x * t$95$0), $MachinePrecision], If[LessEqual[y, 4.681666818528092e+63], N[(x + y), $MachinePrecision], (-z)]]]]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET t_0 = (z / (z - y)) IN LET tmp_3 = IF (y <= (4681666818528092203036118676955019348905995956188990931967410176)) THEN (x + y) ELSE (- z) ENDIF IN LET tmp_2 = IF (y <= (-4734663632032869917938737926775996076304363301531924046625645605168081914623443707539272548654688762786328737096233062537483599475836292175195387950595192747046857263437979868700255469409554212834747288476811883514543915831968463510360557257527096592511330425377670450249512797864810003927783307768410582167096042022980766605779449371542008021586849605881386176575670165330092589403825487986570776211361618841752453989202417675347979442168622199460514821112155914306640625e-652)) THEN (x * t_0) ELSE tmp_3 ENDIF IN LET tmp_1 = IF (y <= (-321907435465670843865925379648631418932056154541407274247954021849173747255142939905268844251927711768855762397567588095625978894531726837158203125e-188)) THEN (y * t_0) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-803123504347913009913273388224513530471665723338522923978604741586461544313617260628683085621740752238018556851792543899478292393703587484937124172655362631178881111759137227320373164508270778886514532155392)) THEN (- z) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := \frac{z}{z - y}\\
\mathbf{if}\;y \leq -8.03123504347913 \cdot 10^{+206}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -3.2190743546567084 \cdot 10^{-42}:\\
\;\;\;\;y \cdot t\_0\\
\mathbf{elif}\;y \leq -4.73466363203287 \cdot 10^{-181}:\\
\;\;\;\;x \cdot t\_0\\
\mathbf{elif}\;y \leq 4.681666818528092 \cdot 10^{+63}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -8.0312350434791301e206 or 4.6816668185280922e63 < y Initial program 88.0%
Taylor expanded in y around inf
Applied rewrites34.9%
Applied rewrites34.9%
if -8.0312350434791301e206 < y < -3.2190743546567084e-42Initial program 88.0%
Taylor expanded in x around 0
Applied rewrites42.0%
Applied rewrites42.6%
if -3.2190743546567084e-42 < y < -4.7346636320328699e-181Initial program 88.0%
Taylor expanded in x around inf
Applied rewrites48.3%
Applied rewrites48.5%
if -4.7346636320328699e-181 < y < 4.6816668185280922e63Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
Taylor expanded in x around inf
Applied rewrites45.0%
Taylor expanded in z around inf
Applied rewrites50.6%
(FPCore (x y z) :precision binary64 :pre TRUE (if (<= y -6.632586809221022e+115) (- z) (if (<= y 4.681666818528092e+63) (+ x y) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.632586809221022e+115) {
tmp = -z;
} else if (y <= 4.681666818528092e+63) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-6.632586809221022d+115)) then
tmp = -z
else if (y <= 4.681666818528092d+63) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6.632586809221022e+115) {
tmp = -z;
} else if (y <= 4.681666818528092e+63) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.632586809221022e+115: tmp = -z elif y <= 4.681666818528092e+63: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.632586809221022e+115) tmp = Float64(-z); elseif (y <= 4.681666818528092e+63) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.632586809221022e+115) tmp = -z; elseif (y <= 4.681666818528092e+63) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.632586809221022e+115], (-z), If[LessEqual[y, 4.681666818528092e+63], N[(x + y), $MachinePrecision], (-z)]]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = LET tmp_1 = IF (y <= (4681666818528092203036118676955019348905995956188990931967410176)) THEN (x + y) ELSE (- z) ENDIF IN LET tmp = IF (y <= (-66325868092210219984679563846771621306077676758794470155515335874769546430828771989845968860035693982987589091590144)) THEN (- z) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -6.632586809221022 \cdot 10^{+115}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 4.681666818528092 \cdot 10^{+63}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
if y < -6.632586809221022e115 or 4.6816668185280922e63 < y Initial program 88.0%
Taylor expanded in y around inf
Applied rewrites34.9%
Applied rewrites34.9%
if -6.632586809221022e115 < y < 4.6816668185280922e63Initial program 88.0%
Applied rewrites88.8%
Applied rewrites92.4%
Taylor expanded in x around inf
Applied rewrites45.0%
Taylor expanded in z around inf
Applied rewrites50.6%
(FPCore (x y z) :precision binary64 :pre TRUE (- z))
double code(double x, double y, double z) {
return -z;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = - z END code
-z
Initial program 88.0%
Taylor expanded in y around inf
Applied rewrites34.9%
Applied rewrites34.9%
herbie shell --seed 2026092
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
(/ (+ x y) (- 1.0 (/ y z))))