Skip to content

Commit a8267f7

Browse files
authored
Merge pull request #146 from CertiRocq/fix-float-codegen
Fix code generation for floats, removing an Admitted proof
2 parents e37f8ce + 150958a commit a8267f7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

theories/Codegen/LambdaANF_to_Clight_stack.v

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -842,16 +842,16 @@ Defined.
842842
Definition float64_to_model (f : PrimFloat.float) : float64_model :=
843843
exist (FloatOps.Prim2SF f) (FloatAxioms.Prim2SF_valid f).
844844

845-
Definition model_to_ff (f : float64_model) : Binary.full_float :=
846-
Binary.SF2FF (proj1_sig f).
845+
Definition model_to_binary (f : float64_model) : Floats.float :=
846+
match proj1_sig f as x return is_true (SpecFloat.valid_binary FloatOps.prec FloatOps.emax x) -> Floats.float with
847+
| SpecFloat.S754_zero s => fun _ => Binary.B754_zero _ _ s
848+
| SpecFloat.S754_infinity s => fun _ => Binary.B754_infinity _ _ s
849+
| SpecFloat.S754_nan => fun _ => Binary.B754_nan FloatOps.prec FloatOps.emax false xH eq_refl
850+
| SpecFloat.S754_finite s m e => fun h => Binary.B754_finite _ _ s m e h
851+
end (proj2_sig f).
847852

848-
Program Definition to_float (f : PrimFloat.float) : Floats.float :=
849-
Binary.FF2B _ _ (model_to_ff (float64_to_model f)) _.
850-
Next Obligation.
851-
unfold model_to_ff.
852-
pose proof (FloatAxioms.Prim2SF_valid f).
853-
rewrite Binary.valid_binary_SF2FF; auto.
854-
Admitted.
853+
Definition to_float (f : PrimFloat.float) : Floats.float :=
854+
model_to_binary (float64_to_model f).
855855

856856
Definition compile_float (cenv : ctor_env) (ienv : n_ind_env) (fenv : fun_env) (map : fun_info_env)
857857
(x : positive) (f : Floats.float) :=
@@ -886,7 +886,6 @@ Section Translation.
886886

887887
Context (args_opt : bool).
888888

889-
890889
Section Body.
891890
Context
892891
(prim_map : list (kername * string * nat * positive))

0 commit comments

Comments
 (0)