fact stringlengths 6 2.88k | type stringclasses 17
values | library stringclasses 2
values | imports listlengths 0 16 | filename stringclasses 89
values | symbolic_name stringlengths 1 36 | docstring stringclasses 1
value |
|---|---|---|---|---|---|---|
SF64mul:= SFmul prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64mul | |
SF64add:= SFadd prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64add | |
SF64sub:= SFsub prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64sub | |
SF64div:= SFdiv prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64div | |
SF64sqrt:= SFsqrt prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64sqrt | |
SF64succ:= SFsucc prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64succ | |
SF64pred:= SFpred prec emax. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF64pred | |
Prim2SF_valid: forall x, valid_binary (Prim2SF x) = true. | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | Prim2SF_valid | |
SF2Prim_Prim2SF: forall x, SF2Prim (Prim2SF x) = x. | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF2Prim_Prim2SF | |
Prim2SF_SF2Prim: forall x, valid_binary x = true -> Prim2SF (SF2Prim x) = x. | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | Prim2SF_SF2Prim | |
Prim2SF_inj: forall x y, Prim2SF x = Prim2SF y -> x = y.
intros. rewrite <- SF2Prim_Prim2SF. symmetry. rewrite <- SF2Prim_Prim2SF. now rewrite H.
Qed. | Theorem | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | Prim2SF_inj | |
SF2Prim_inj: forall x y, SF2Prim x = SF2Prim y -> valid_binary x = true -> valid_binary y = true -> x = y.
intros. rewrite <- Prim2SF_SF2Prim by assumption. symmetry. rewrite <- Prim2SF_SF2Prim by assumption. rewrite H. reflexivity.
Qed. | Theorem | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | SF2Prim_inj | |
opp_spec: forall x, Prim2SF (-x)%float = SFopp (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | opp_spec | |
abs_spec: forall x, Prim2SF (abs x) = SFabs (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | abs_spec | |
eqb_spec: forall x y, (x =? y)%float = SFeqb (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | eqb_spec | |
ltb_spec: forall x y, (x <? y)%float = SFltb (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | ltb_spec | |
leb_spec: forall x y, (x <=? y)%float = SFleb (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | leb_spec | |
flatten_cmp_optc :=
match c with
| None => FNotComparable
| Some Eq => FEq
| Some Lt => FLt
| Some Gt => FGt
end. | Definition | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | flatten_cmp_opt | |
compare_spec: forall x y, (x ?= y)%float = flatten_cmp_opt (SFcompare (Prim2SF x) (Prim2SF y)). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | compare_spec | |
eqb_spec: forall x y, Leibniz.eqb x y = true <-> x = y. | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | eqb_spec | |
classify_spec: forall x, classify x = SF64classify (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | classify_spec | |
mul_spec: forall x y, Prim2SF (x * y)%float = SF64mul (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | mul_spec | |
add_spec: forall x y, Prim2SF (x + y)%float = SF64add (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | add_spec | |
sub_spec: forall x y, Prim2SF (x - y)%float = SF64sub (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | sub_spec | |
div_spec: forall x y, Prim2SF (x / y)%float = SF64div (Prim2SF x) (Prim2SF y). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | div_spec | |
sqrt_spec: forall x, Prim2SF (sqrt x) = SF64sqrt (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | sqrt_spec | |
of_uint63_spec: forall n, Prim2SF (of_uint63 n) = binary_normalize prec emax (to_Z n) Z0 false. | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | of_uint63_spec | |
normfr_mantissa_spec: forall f, to_Z (normfr_mantissa f) = Z.of_N (SFnormfr_mantissa prec (Prim2SF f)). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | normfr_mantissa_spec | |
frshiftexp_spec: forall f,
let (m,e) := frshiftexp f in
(Prim2SF m, Z.sub (to_Z e) shift) = SFfrexp prec emax (Prim2SF f). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | frshiftexp_spec | |
ldshiftexp_spec: forall f e,
Prim2SF (ldshiftexp f e) = SFldexp prec emax (Prim2SF f) (Z.sub (to_Z e) shift). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | ldshiftexp_spec | |
next_up_spec: forall x, Prim2SF (next_up x) = SF64succ (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | next_up_spec | |
next_down_spec: forall x, Prim2SF (next_down x) = SF64pred (Prim2SF x). | Axiom | Corelib | [
"From Corelib Require Import BinNums IntDef Uint63Axioms",
"From Corelib Require Import SpecFloat PrimFloat FloatOps"
] | Corelib/Floats/FloatAxioms.v | next_down_spec | |
float_class: Set :=
| PNormal | NNormal | PSubn | NSubn | PZero | NZero | PInf | NInf | NaN. | Variant | Corelib | [] | Corelib/Floats/FloatClass.v | float_class | |
prec:= Eval compute in Z.of_nat 53. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | prec | |
emax:= Eval compute in Z.of_nat 1024.
Abbreviation emin := (emin prec emax). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | emax | |
shift:= Eval compute in Z.of_nat 2101. (** [= 2*emax + prec] *) | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | shift | |
frexpf :=
let (m, se) := frshiftexp f in
(m, (Z.sub (to_Z se) shift)). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | frexp | |
ldexpf e :=
let e' := Z.max (Z.min e (Z.sub emax emin)) (Z.sub (Z.sub emin emax) (Zpos 1)) in
ldshiftexp f (of_Z (Z.add e' shift)). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | ldexp | |
ulpf := Z.ldexp one (fexp prec emax (snd (Z.frexp f))). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | ulp | |
Prim2SFf :=
if is_nan f then S754_nan
else if is_zero f then S754_zero (get_sign f)
else if is_infinity f then S754_infinity (get_sign f)
else
let (r, exp) := Z.frexp f in
let e := Z.sub exp prec in
let (shr, e') := shr_fexp prec emax (to_Z (normfr_mantis... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | Prim2SF | |
SF2Primef :=
match ef with
| S754_nan => nan
| S754_zero false => zero
| S754_zero true => neg_zero
| S754_infinity false => infinity
| S754_infinity true => neg_infinity
| S754_finite s m e =>
let pm := of_uint63 (of_Z (Zpos m)) in
let f := Z.ldexp pm e in
if s then (-f)%float else f
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef Uint63Axioms",
"From Corelib Require Import FloatClass SpecFloat PrimFloat"
] | Corelib/Floats/FloatOps.v | SF2Prim | |
float_comparison: Set := FEq | FLt | FGt | FNotComparable.
Register float_comparison as kernel.ind_f_cmp.
Register float_class as kernel.ind_f_class. | Variant | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | float_comparison | |
float_wrapper:= wrap_float { float_wrap : float }.
Register float_wrapper as num.float.float_wrapper.
Register wrap_float as num.float.wrap_float. | Record | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | float_wrapper | |
printer(x : float_wrapper) : float := float_wrap x. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | printer | |
parser(x : float) : float := x. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | parser | |
infinity:= Eval compute in div (of_uint63 1) (of_uint63 0). | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | infinity | |
neg_infinity:= Eval compute in opp infinity. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | neg_infinity | |
nan:= Eval compute in div (of_uint63 0) (of_uint63 0).
Register infinity as num.float.infinity.
Register neg_infinity as num.float.neg_infinity.
Register nan as num.float.nan. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | nan | |
one:= Eval compute in (of_uint63 1). | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | one | |
zero:= Eval compute in (of_uint63 0). | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | zero | |
neg_zero:= Eval compute in (-zero)%float. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | neg_zero | |
two:= Eval compute in (of_uint63 2). | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | two | |
is_nanf := negb (f =? f)%float. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | is_nan | |
is_zerof := (f =? zero)%float. (* note: 0 =? -0 with floats *) | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | is_zero | |
is_infinityf := (abs f =? infinity)%float. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | is_infinity | |
is_finite(x : float) := negb (is_nan x || is_infinity x). | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | is_finite | |
get_signf :=
let f := if is_zero f then (one / f)%float else f in
(f <? zero)%float. | Definition | Corelib | [
"Require Import PrimInt63 FloatClass"
] | Corelib/Floats/PrimFloat.v | get_sign | |
spec_float:=
| S754_zero (s : bool)
| S754_infinity (s : bool)
| S754_nan
| S754_finite (s : bool) (m : positive) (e : Z). | Variant | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | spec_float | |
emin:= Z.sub (Z.sub (Zpos 3) emax) prec. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | emin | |
fexpe := Z.max (Z.sub e prec) emin. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | fexp | |
digits2_pos(n : positive) : positive :=
match n with
| xH => xH
| xO p => Pos.succ (digits2_pos p)
| xI p => Pos.succ (digits2_pos p)
end. | Fixpoint | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | digits2_pos | |
Zdigits2n :=
match n with
| Z0 => n
| Zpos p => Zpos (digits2_pos p)
| Zneg p => Zpos (digits2_pos p)
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | Zdigits2 | |
canonical_mantissam e :=
Z.eqb (fexp (Z.add (Zpos (digits2_pos m)) e)) e. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | canonical_mantissa | |
boundedm e :=
andb (canonical_mantissa m e) (Z.leb e (Z.sub emax prec)). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | bounded | |
valid_binaryx :=
match x with
| S754_finite _ m e => bounded m e
| _ => true
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | valid_binary | |
iter_pos(n : positive) (x : A) {struct n} : A :=
match n with
| xI n' => iter_pos n' (iter_pos n' (f x))
| xO n' => iter_pos n' (iter_pos n' x)
| xH => f x
end. | Fixpoint | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | iter_pos | |
location:= loc_Exact | loc_Inexact : comparison -> location. | Inductive | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | location | |
shr_record:= { shr_m : Z ; shr_r : bool ; shr_s : bool }. | Record | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shr_record | |
shr_1mrs :=
let '(Build_shr_record m r s) := mrs in
let s := orb r s in
match m with
| Z0 => Build_shr_record Z0 false s
| Zpos xH => Build_shr_record Z0 true s
| Zpos (xO p) => Build_shr_record (Zpos p) false s
| Zpos (xI p) => Build_shr_record (Zpos p) true s
| Zneg xH ... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shr_1 | |
loc_of_shr_recordmrs :=
match mrs with
| Build_shr_record _ false false => loc_Exact
| Build_shr_record _ false true => loc_Inexact Lt
| Build_shr_record _ true false => loc_Inexact Eq
| Build_shr_record _ true true => loc_Inexact Gt
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | loc_of_shr_record | |
shr_record_of_locm l :=
match l with
| loc_Exact => Build_shr_record m false false
| loc_Inexact Lt => Build_shr_record m false true
| loc_Inexact Eq => Build_shr_record m true false
| loc_Inexact Gt => Build_shr_record m true true
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shr_record_of_loc | |
shrmrs e n :=
match n with
| Zpos p => (iter_pos shr_1 p mrs, Z.add e n)
| _ => (mrs, e)
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shr | |
shr_fexpm e l :=
shr (shr_record_of_loc m l) e (Z.sub (fexp (Z.add (Zdigits2 m) e)) e). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shr_fexp | |
round_nearest_evenmx lx :=
match lx with
| loc_Exact => mx
| loc_Inexact Lt => mx
| loc_Inexact Eq => if Z.even mx then mx else Z.add mx (Zpos 1)
| loc_Inexact Gt => Z.add mx (Zpos 1)
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | round_nearest_even | |
binary_round_auxsx mx ex lx :=
let '(mrs', e') := shr_fexp mx ex lx in
let '(mrs'', e'') := shr_fexp (round_nearest_even (shr_m mrs') (loc_of_shr_record mrs')) e' loc_Exact in
match shr_m mrs'' with
| Z0 => S754_zero sx
| Zpos m => if Z.leb e'' (Z.sub emax prec) then S754_finite sx m e'' e... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | binary_round_aux | |
shl_alignmx ex ex' :=
match Z.sub ex' ex with
| Zneg d => (Pos.iter xO mx d, ex')
| _ => (mx, ex)
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | shl_align | |
binary_roundsx mx ex :=
let '(mz, ez) := shl_align mx ex (fexp (Z.add (Zpos (digits2_pos mx)) ex))in
binary_round_aux sx (Zpos mz) ez loc_Exact. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | binary_round | |
binary_normalizem e szero :=
match m with
| Z0 => S754_zero szero
| Zpos m => binary_round false m e
| Zneg m => binary_round true m e
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | binary_normalize | |
SFoppx :=
match x with
| S754_nan => S754_nan
| S754_infinity sx => S754_infinity (negb sx)
| S754_finite sx mx ex => S754_finite (negb sx) mx ex
| S754_zero sx => S754_zero (negb sx)
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFopp | |
SFabsx :=
match x with
| S754_nan => S754_nan
| S754_infinity sx => S754_infinity false
| S754_finite sx mx ex => S754_finite false mx ex
| S754_zero sx => S754_zero false
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFabs | |
SFcomparef1 f2 :=
match f1, f2 with
| S754_nan , _ | _, S754_nan => None
| S754_infinity s1, S754_infinity s2 =>
Some match s1, s2 with
| true, true => Eq
| false, false => Eq
| true, false => Lt
| false, true => Gt
end
| S754_infinity s, _ => Some (if s then Lt else ... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFcompare | |
SFeqbf1 f2 :=
match SFcompare f1 f2 with
| Some Eq => true
| _ => false
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFeqb | |
SFltbf1 f2 :=
match SFcompare f1 f2 with
| Some Lt => true
| _ => false
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFltb | |
SFlebf1 f2 :=
match SFcompare f1 f2 with
| Some (Lt | Eq) => true
| _ => false
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFleb | |
SFclassifyf :=
match f with
| S754_nan => NaN
| S754_infinity false => PInf
| S754_infinity true => NInf
| S754_zero false => PZero
| S754_zero true => NZero
| S754_finite false m _ =>
if Z.eqb (Zpos (digits2_pos m)) prec then PNormal
else PSubn
| S754_finite true m _ =>
... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFclassify | |
SFmulx y :=
match x, y with
| S754_nan, _ | _, S754_nan => S754_nan
| S754_infinity sx, S754_infinity sy => S754_infinity (xorb sx sy)
| S754_infinity sx, S754_finite sy _ _ => S754_infinity (xorb sx sy)
| S754_finite sx _ _, S754_infinity sy => S754_infinity (xorb sx sy)
| S754_infinity _, S754... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFmul | |
cond_Zopp(b : bool) m := if b then Z.opp m else m. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | cond_Zopp | |
SFaddx y :=
match x, y with
| S754_nan, _ | _, S754_nan => S754_nan
| S754_infinity sx, S754_infinity sy =>
match sx, sy with true, true | false, false => x | _, _ => S754_nan end
| S754_infinity _, _ => x
| _, S754_infinity _ => y
| S754_zero sx, S754_zero sy =>
match sx, sy with tr... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFadd | |
SFsubx y :=
match x, y with
| S754_nan, _ | _, S754_nan => S754_nan
| S754_infinity sx, S754_infinity sy =>
match sx, sy with true, false | false, true => x | _, _ => S754_nan end
| S754_infinity _, _ => x
| _, S754_infinity sy => S754_infinity (negb sy)
| S754_zero sx, S754_zero sy =>
... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFsub | |
new_location_evennb_steps k :=
if Z.eqb k Z0 then loc_Exact
else loc_Inexact (Z.compare (Z.mul (Zpos 2) k) nb_steps). | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | new_location_even | |
new_location_oddnb_steps k :=
if Z.eqb k Z0 then loc_Exact
else
loc_Inexact
match Z.compare (Z.add (Z.mul (Zpos 2) k) (Zpos 1)) nb_steps with
| Lt => Lt
| Eq => Lt
| Gt => Gt
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | new_location_odd | |
new_locationnb_steps :=
if Z.even nb_steps then new_location_even nb_steps else new_location_odd nb_steps. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | new_location | |
SFdiv_core_binarym1 e1 m2 e2 :=
let d1 := Zdigits2 m1 in
let d2 := Zdigits2 m2 in
let e' := Z.min (fexp (Z.sub (Z.add d1 e1) (Z.add d2 e2))) (Z.sub e1 e2) in
let s := Z.sub (Z.sub e1 e2) e' in
let m' :=
match s with
| Zpos _ => Z.shiftl m1 s
| Z0 => m1
| Zneg _ => Z0
en... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFdiv_core_binary | |
SFdivx y :=
match x, y with
| S754_nan, _ | _, S754_nan => S754_nan
| S754_infinity sx, S754_infinity sy => S754_nan
| S754_infinity sx, S754_finite sy _ _ => S754_infinity (xorb sx sy)
| S754_finite sx _ _, S754_infinity sy => S754_zero (xorb sx sy)
| S754_infinity sx, S754_zero sy => S754_infi... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFdiv | |
SFsqrt_core_binarym e :=
let d := Zdigits2 m in
let e' := Z.min (fexp (Z.div2 (Z.add (Z.add d e) (Zpos 1)))) (Z.div2 e) in
let s := Z.sub e (Z.mul (Zpos 2) e') in
let m' :=
match s with
| Zpos p => Z.shiftl m s
| Z0 => m
| Zneg _ => Z0
end in
let (q, r) := Z.sqrtrem m' ... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFsqrt_core_binary | |
SFsqrtx :=
match x with
| S754_nan => S754_nan
| S754_infinity false => x
| S754_infinity true => S754_nan
| S754_finite true _ _ => S754_nan
| S754_zero _ => x
| S754_finite false mx ex =>
let '(mz, ez, lz) := SFsqrt_core_binary (Zpos mx) ex in
binary_round_aux false mz ez lz
... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFsqrt | |
SFnormfr_mantissaf :=
match f with
| S754_finite _ mx ex =>
if Z.eqb ex (Z.opp prec) then Npos mx else N0
| _ => N0
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFnormfr_mantissa | |
SFldexpf e :=
match f with
| S754_finite sx mx ex => binary_round sx mx (Z.add ex e)
| _ => f
end. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFldexp | |
SFfrexpf :=
match f with
| S754_finite sx mx ex =>
if Z.leb prec (Zpos (digits2_pos mx)) then
(S754_finite sx mx (Z.opp prec), Z.add ex prec)
else
let d := Z.sub prec (Zpos (digits2_pos mx)) in
(S754_finite sx (Pos.iter xO mx (Z.to_pos d)) (Z.opp prec), Z.sub (Z.add ex prec) ... | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFfrexp | |
SFone:= binary_round false 1 Z0. | Definition | Corelib | [
"From Corelib Require Import BinNums PosDef IntDef FloatClass"
] | Corelib/Floats/SpecFloat.v | SFone |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.