
(FPCore (x y) :precision binary64 :pre TRUE (* x (- 1.0 y)))
double code(double x, double y) {
return x * (1.0 - y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (1.0d0 - y)
end function
public static double code(double x, double y) {
return x * (1.0 - y);
}
def code(x, y): return x * (1.0 - y)
function code(x, y) return Float64(x * Float64(1.0 - y)) end
function tmp = code(x, y) tmp = x * (1.0 - y); end
code[x_, y_] := N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * ((1) - y) END code
x \cdot \left(1 - y\right)
Herbie found 3 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 :pre TRUE (* x (- 1.0 y)))
double code(double x, double y) {
return x * (1.0 - y);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (1.0d0 - y)
end function
public static double code(double x, double y) {
return x * (1.0 - y);
}
def code(x, y): return x * (1.0 - y)
function code(x, y) return Float64(x * Float64(1.0 - y)) end
function tmp = code(x, y) tmp = x * (1.0 - y); end
code[x_, y_] := N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * ((1) - y) END code
x \cdot \left(1 - y\right)
(FPCore (x y) :precision binary64 :pre TRUE (- x (* y x)))
double code(double x, double y) {
return x - (y * x);
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x - (y * x)
end function
public static double code(double x, double y) {
return x - (y * x);
}
def code(x, y): return x - (y * x)
function code(x, y) return Float64(x - Float64(y * x)) end
function tmp = code(x, y) tmp = x - (y * x); end
code[x_, y_] := N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x - (y * x) END code
x - y \cdot x
Initial program 100.0%
Applied rewrites100.0%
(FPCore (x y) :precision binary64 :pre TRUE (* x 1.0))
double code(double x, double y) {
return x * 1.0;
}
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * 1.0d0
end function
public static double code(double x, double y) {
return x * 1.0;
}
def code(x, y): return x * 1.0
function code(x, y) return Float64(x * 1.0) end
function tmp = code(x, y) tmp = x * 1.0; end
code[x_, y_] := N[(x * 1.0), $MachinePrecision]
f(x, y): x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(x, y: real): real = x * (1) END code
x \cdot 1
Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites50.7%
herbie shell --seed 2026092
(FPCore (x y)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, H"
:precision binary64
(* x (- 1.0 y)))