
(FPCore (x) :precision binary64 (* x (/ 1.0 255.0)))
double code(double x) {
return x * (1.0 / 255.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * (1.0d0 / 255.0d0)
end function
public static double code(double x) {
return x * (1.0 / 255.0);
}
def code(x): return x * (1.0 / 255.0)
function code(x) return Float64(x * Float64(1.0 / 255.0)) end
function tmp = code(x) tmp = x * (1.0 / 255.0); end
code[x_] := N[(x * N[(1.0 / 255.0), $MachinePrecision]), $MachinePrecision]
x \cdot \frac{1}{255}
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* x (/ 1.0 255.0)))
double code(double x) {
return x * (1.0 / 255.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * (1.0d0 / 255.0d0)
end function
public static double code(double x) {
return x * (1.0 / 255.0);
}
def code(x): return x * (1.0 / 255.0)
function code(x) return Float64(x * Float64(1.0 / 255.0)) end
function tmp = code(x) tmp = x * (1.0 / 255.0); end
code[x_] := N[(x * N[(1.0 / 255.0), $MachinePrecision]), $MachinePrecision]
x \cdot \frac{1}{255}
(FPCore (x) :precision binary64 (* x 0.00392156862745098))
double code(double x) {
return x * 0.00392156862745098;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * 0.00392156862745098d0
end function
public static double code(double x) {
return x * 0.00392156862745098;
}
def code(x): return x * 0.00392156862745098
function code(x) return Float64(x * 0.00392156862745098) end
function tmp = code(x) tmp = x * 0.00392156862745098; end
code[x_] := N[(x * 0.00392156862745098), $MachinePrecision]
x \cdot 0.00392156862745098
Initial program 99.9%
lift-/.f64N/A
metadata-eval99.9%
Applied rewrites99.9%
herbie shell --seed 1
(FPCore (x)
:name "x * (1/255)"
:precision binary64
:pre (and (<= 0.0 x) (<= x 255.0))
(* x (/ 1.0 255.0)))