Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

close

  • Follows somewhat the advice of Knuth on checking for floating-point equality. The closeness relationship is: $$ \mathrm{close}(x,y,n) \equiv |x-y| \leq \varepsilon |x| \wedge |x-y| \leq \varepsilon |y| $$ where $ \varepsilon $ is $ n $ times the machine accuracy; $ n $ equals 42 if not given.

    Parameters

    Returns boolean

close_enough

  • Follows somewhat the advice of Knuth on checking for floating-point equality. The closeness relationship is: $$ \mathrm{close}(x,y,n) \equiv |x-y| \leq \varepsilon |x| \vee |x-y| \leq \varepsilon |y| $$ where $ \varepsilon $ is $ n $ times the machine accuracy; $ n $ equals 42 if not given.

    Parameters

    Returns boolean