'     portable (with CPP)stablewren@community.haskell.org Safe-Inferred(semi-portable (OverlappingInstances,...)stablewren@community.haskell.orgNone >This class defines a partially ordered type. The method names ( were chosen so as not to conflict with  and  . We use   instead of defining new types PartialOrdering and   FuzzyBool2 because this way should make the class easier to  use. Minimum complete definition:  like   like (!) like (") like (#) like ($) like (%) like (&) like '1. The default instance returns the left argument  when they' re equal. like (1. The default instance returns the left argument  when they' re equal. Like Data.Ord.comparing". Helpful in conjunction with the  xxxBy family of functions from  Data.List  )*+     )*+portablestablewren@community.haskell.orgNone Many numbers are not , yet, even though they can > represent arbitrarily large values, they are not necessarily ? able to represent transfinite values such as infinity itself. @ This class is for types which are capable of representing such = values. Notably, this class does not require the type to be  - nor .& since integral types could also have ? representations for transfinite values. By popular demand the  /; restriction has been lifted as well, due to complications  of defining 0 or  for some types. AIn particular, this class extends the ordered projection to have  a maximum value  and a minimum value , ! as well as an exceptional value . All the natural  laws regarding infinity and negativeInfinity should pertain. & (Some of these are discussed below.) 8Hugs (September 2006) has buggy Prelude definitions for   and  on Float and Double. 6 This module provides correct definitions, so long as Hugs.RealFloat  is compiled correctly. =A transfinite value which is greater than all finite values. : Adding or subtracting any finite value is a no-op. As is 7 multiplying by any non-zero positive value (including  infinity3), and dividing by any positive finite value. Also  obeys the law "negate infinity = negativeInfinity with all  appropriate ramifications. :A transfinite value which is less than all finite values.  Obeys all the same laws as infinity with the appropriate " changes for the sign difference. <An exceptional transfinite value for dealing with undefined : results when manipulating infinite values. The following  operations must return  notANumber, where inf is any value  which  isInfinite:  infinity + negativeInfinity negativeInfinity + infinity infinity - infinity #negativeInfinity - negativeInfinity inf * 0 0 * inf inf / inf inf 1 inf 0 / 0 0 1 0-Additionally, any mathematical operations on  notANumber  must also return  notANumber, and any equality or ordering  comparison on  notANumber must return False (violating @ the law of the excluded middle, often assumed but not required  for ; thus,  and  are preferred over (#) and  ($6)). Since it returns false for equality, there may be . more than one machine representation of this value. Return true for both infinity and negativeInfinity,  false for all other values. Return true only for  notANumber. Since the normal 2 throws an error on zero, we @ have to redefine it in order for things to work right. Arguing  from limits we can see that log 0 == negativeInfinity. Newer @ versions of GHC have this behavior already, but older versions  and Hugs do not. BThis function will raise an error when taking the log of negative  numbers, rather than returning  as the newer GHC @ implementation does. The reason being that typically this is a  logical error, and  notANumber allows the error to propegate  silently. %In order to improve portability, the   class is  required to indicate that the . type does in fact have > a representation for negative infinity. Both native floating  types (3 and 4$) are supported. If you define your  own instance of  Transfinite", verify the above equation holds  for your 0 and negativeInfinity . If it doesn' t, then you  should avoid importing our log# and will probably want converters  to handle the discrepancy. For GHC, this version of log has rules for fusion with exp. = These can give different behavior by preventing overflow to  infinity3 and preventing errors for taking the logarithm of  negative values. For 3 and 4 they can also give ? different answers due to eliminating floating point fuzz. The C rules strictly improve mathematical accuracy, however they should C be noted in case your code depends on the implementation details. 56   56/semi-portable (CPP, MPTC, OverlappingInstances)stablewren@community.haskell.orgNoneThe 7& function is defined to pivot through  a 87 according to the haskell98 spec. This is non-portable ! and problematic as discussed in Data.Number.Transfinite. Since C there is resistance to breaking from the spec, this class defines : a reasonable variant which deals with transfinite values  appropriately. =There is a generic instance from any Transfinite Real to any A Transfinite Fractional, using checks to ensure correctness. GHC = has specialized versions for some types which use primitive E converters instead, for large performance gains. (These definitions C are hidden from other compilers via CPP.) Due to a bug in Haddock D the specialized instances are shown twice and the generic instance  isn'7t shown at all. Since the instances are overlapped, you'll 2 need to give type signatures if the arguments to   are polymorphic. There''s also a generic instance for any Real D Fractional type to itself, thus if you write any generic instances  beware of incoherence. ;If any of these restrictions (CPP, GHC-only optimizations, B OverlappingInstances) are onerous to you, contact the maintainer $ (we like patches). Note that this does work for Hugs with  suitable options (e.g. hugs -98 +o -F'cpp -P'). However, Hugs  doesn't allow IncoherentInstances nor does it allow diamonds  with OverlappingInstances%, which restricts the ability to add  additional generic instances. 9:;<=>?@ 9:;<=>?@portable (with CPP, FFI)stablewren@community.haskell.orgNoneA LogFloat is just a 3 with a special interpretation.  The 3 function is presented instead of the constructor, 8 in order to ensure semantic conversion. At present the 0 > instance will convert back to the normal-domain, and so will B underflow at that point. This behavior may change in the future. ;Performing operations in the log-domain is cheap, prevents B underflow, and is otherwise very nice for dealing with miniscule A probabilities. However, crossing into and out of the log-domain < is expensive and should be avoided as much as possible. In  particular, if you'+re doing a series of multiplications as in  lp * logFloat q * logFloat r it's faster to do lp * logFloat  (q * r) if you'4re reasonably sure the normal-domain multiplication  won'<t underflow, because that way you enter the log-domain only  once, instead of twice. #Even more particularly, you should avoid addition whenever * possible. Addition is provided because it's necessary at times ? and the proper implementation is not immediately transparent.  However, between two LogFloat!s addition requires crossing the  exp/log boundary twice; with a LogFloat and a regular number  it':s three times since the regular number needs to enter the ? log-domain first. This makes addition incredibly slow. Again, > if you can parenthesize to do plain operations first, do it!  Definition: expm1 == (subtract 1) . exp. The C language # provides a special definition for  which is more accurate B than doing the naive thing, especially for very small arguments.  This function isn')t needed internally, but is provided for  symmetry with . >This installation was compiled to use the specialized version.  Definition: log1p == log . (1+). The C language provides a  special definition for # which is more accurate than doing D the naive thing, especially for very small arguments. For example, % the naive version underflows around 2 ** -53, whereas the ' specialized version underflows around  2 ** -1074. This function  is used by (A) and (B) on LogFloat. >This installation was compiled to use the specialized version. C@Reduce the number of constant string literals we need to store. >Constructor which does semantic conversion from normal-domain 1 to log-domain. Throws errors on negative input. 9Constructor which assumes the argument is already in the  log-domain. Throws errors on  notANumber input. <Return our log-domain value back into normal-domain. Beware  of overflow/ underflow. 7Return the log-domain value itself without conversion. DCEFGHIJK DCEFGHIJKL      !"#!"$%&'!"(!")!"*!"+!",!"-!".!"/!"0123%45%67%89%:;%<=%6>%8!?@!?ABC%6%6DEFGHIJKL%:M%:NOPQRSTUVWlogfloat-0.12.1Hugs.RealFloatData.Number.PartialOrdData.Number.TransfiniteData.Number.RealToFracData.Number.LogFloat isInfiniteisNaN PartialOrdcmpgtgeeqneleltmaxPOminPO comparingPO TransfiniteinfinitynegativeInfinity notANumberlog RealToFrac realToFracLogFloatexpm1log1plogFloat logToLogFloat fromLogFloatlogFromLogFloatghc-prim GHC.ClassesOrdEqbase Data.MaybeMaybecompare>>===/=<=<maxmin$fPartialOrdDouble$fPartialOrdFloat $fPartialOrdaGHC.EnumBoundedGHC.Real Fractional GHC.FloatFloatingGHC.NumNumGHC.ShowShowdiv GHC.TypesDoubleFloat$fTransfiniteFloat$fTransfiniteDoubleRational$fRealToFracDoubleFloat$fRealToFracFloatDouble$fRealToFracIntegerDouble$fRealToFracIntegerFloat$fRealToFracIntDouble$fRealToFracIntFloat$fRealToFracab$fRealToFracaa+-errorOutOfRangeguardNonNegativeguardIsANumber$fRealLogFloat$fFractionalLogFloat $fNumLogFloat$fShowLogFloat$fPartialOrdLogFloat