final
class
FpFilter[A] extends AnyRef
Instance Constructors
-
new
FpFilter(apx: Double, mes: Double, ind: Int, exact0: ⇒ A)
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
-
-
-
-
def
<(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
def
<=(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
def
===(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
def
>(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
def
>=(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
def
abs(implicit ev: Signed[A]): FpFilter[A]
-
val
apx: Double
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(that: Any): Boolean
-
def
error: Double
-
lazy val
exact: A
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
val
ind: Int
-
final
def
isInstanceOf[T0]: Boolean
-
val
mes: Double
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
signum(implicit ev: Signed[A]): Int
-
def
sqrt(implicit ev: NRoot[A]): FpFilter[A]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
unary_-(implicit ev: Rng[A]): FpFilter[A]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
A Floating-point Filter [1] provides a
Numeric
type that wraps anotherNumeric
type, but defers its computation, instead providing a floating point (Double
) approximation. For some operations, likesignum
, comparisons, equality checks, toFloat, etc, theDouble
approximation may be used to compute the result, rather than having to compute the exact value.An
FpFilter
can generally be used with any Ring numeric type (also supports EuclideanRing, Field, and NRoot). However, it should be kept in mind thatFpFilter
knows nothing about the type its wrapping and assumes that, generally, it is more accurate than it is. When anFpFilter
cannot determine an answer to some predicate exactly, it will defer to the wrapped value, so it probably doesn't make sense to wrapInt
s, when anInt
will overflow before aDouble
!Good candidates to wrap in
FpFilter
are BigInts, Rationals, BigDecimals, and Algebraic. Note that while Algebraic has an internal floating-point filter, this still provides benefits. Namely, the operator-fusion and allocation removal provided by the macros can make for much faster hot paths.Note: Both equals and hashCode will generally force the exact computation. They should be avoided (prefer
===
for equals)... otherwise why use bother?[1] Burnikel, Funke, Seel. Exact Geometric Computation Using Cascading. SoCG 1998.