Skip to content

Commit cfbc578

Browse files
authored
First step of float revision (#1285)
* Updated Data.Float.Base to import correct version of primitives, and Data.Float.Properties to remove the strict inequality induced via Word64.
1 parent d02343d commit cfbc578

File tree

5 files changed

+50
-46
lines changed

5 files changed

+50
-46
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ matrix:
5656
cd ../ &&
5757
git clone https://github.com/agda/agda &&
5858
cd agda &&
59-
git checkout e9007b49996e041760fee0b4e44ac10f2721d22c &&
59+
git checkout 0f4538c8dcd175b92acd577ca0bdca232f5cd17f &&
6060
cabal install --only-dependencies --dry -v > $HOME/installplan.txt ;
6161
fi
6262

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ Bug-fixes
1212
Non-backwards compatible changes
1313
--------------------------------
1414

15+
#### Changes to floating-point arithmetic
16+
17+
* The functions in `Data.Float.Base` were updated following changes upstream,
18+
in `Agda.Builtin.Float`, see <https://github.com/agda/agda/pull/4885>.
19+
20+
* The bitwise binary relations on floating-point numbers (`_<_`, `_≈ᵇ_`, `_==_`)
21+
have been removed without replacement, as they were deeply unintuitive, e.g., `∀ x → x < -x`.
22+
1523
#### Reflection
1624

1725
* The representation of reflected syntax in `Reflection.Term` and

src/Data/Float.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ module Data.Float where
1212
-- Re-export base definitions and decidability of equality
1313

1414
open import Data.Float.Base public
15-
open import Data.Float.Properties using (_≈?_; _<?_; _≟_; _==_) public
15+
open import Data.Float.Properties using (_≈?_; __) public

src/Data/Float/Base.agda

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,49 @@ open import Agda.Builtin.Float public
2020
using (Float)
2121
renaming
2222
-- Relations
23-
( primFloatEquality to _≡ᵇ_
24-
; primFloatLess to _≤ᵇ_
25-
; primFloatNumericalEquality to _≈ᵇ_
26-
; primFloatNumericalLess to _≲ᵇ_
23+
( primFloatInequality to infix 4 _≤ᵇ_
24+
; primFloatEquality to infix 4 _≡ᵇ_
25+
; primFloatLess to infix 4 _<ᵇ_
26+
; primFloatIsInfinite to isInfinite
27+
; primFloatIsNaN to isNaN
28+
; primFloatIsNegativeZero to isNegativeZero
29+
; primFloatIsSafeInteger to isSafeInteger
2730
-- Conversions
28-
; primShowFloat to show
29-
; primFloatToWord64 to toWord
30-
; primNatToFloat to fromℕ
31+
; primFloatToWord64 to toWord
32+
; primNatToFloat to fromℕ
33+
; primIntToFloat to fromℤ
34+
; primFloatRound to round
35+
; primFloatFloor to ⌊_⌋
36+
; primFloatCeiling to ⌈_⌉
37+
; primFloatToRatio to toRatio
38+
; primRatioToFloat to fromRatio
39+
; primFloatDecode to decode
40+
; primFloatEncode to encode
41+
; primShowFloat to show
3142
-- Operations
32-
; primFloatPlus to infixl 6 _+_
33-
; primFloatMinus to infixl 6 _-_
34-
; primFloatTimes to infixl 7 _*_
35-
; primFloatDiv to infixl 7 _÷_
36-
; primFloatNegate to -_
37-
; primFloatSqrt to sqrt
38-
; primRound to round
39-
; primFloor to ⌊_⌋
40-
; primCeiling to ⌈_⌉
41-
; primExp to e^_
42-
; primLog to log
43-
; primSin to sin
44-
; primCos to cos
45-
; primTan to tan
46-
; primASin to asin
47-
; primACos to acos
48-
; primATan to atan
43+
; primFloatPlus to infixl 6 _+_
44+
; primFloatMinus to infixl 6 _-_
45+
; primFloatTimes to infixl 7 _*_
46+
; primFloatDiv to infixl 7 _÷_
47+
; primFloatPow to infixl 8 _**_
48+
; primFloatNegate to infixr 9 -_
49+
; primFloatSqrt to sqrt
50+
; primFloatExp to infixr 9 e^_
51+
; primFloatLog to log
52+
; primFloatSin to sin
53+
; primFloatCos to cos
54+
; primFloatTan to tan
55+
; primFloatASin to asin
56+
; primFloatACos to acos
57+
; primFloatATan to atan
58+
; primFloatATan2 to atan2
59+
; primFloatSinh to sinh
60+
; primFloatCosh to cosh
61+
; primFloatTanh to tanh
62+
; primFloatASinh to asinh
63+
; primFloatACosh to acosh
64+
; primFloatATanh to atanh
4965
)
5066

5167
_≈_ : Rel Float _
5268
_≈_ = Word._≈_ on toWord
53-
54-
_<_ : Rel Float _
55-
_<_ = Word._<_ on toWord

src/Data/Float/Properties.agda

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,3 @@ x ≟ y = map′ ≈⇒≡ ≈-reflexive (x ≈? y)
8383

8484
≡-decSetoid : DecSetoid _ _
8585
≡-decSetoid = decSetoid _≟_
86-
87-
------------------------------------------------------------------------
88-
-- Boolean equality test.
89-
90-
infix 4 _==_
91-
_==_ : Float Float Bool
92-
w₁ == w₂ = RN.⌊ w₁ ≟ w₂ ⌋
93-
94-
------------------------------------------------------------------------
95-
-- Properties of _<_
96-
97-
infix 4 _<?_
98-
_<?_ : Decidable _<_
99-
_<?_ = On.decidable toWord Word._<_ Wₚ._<?_
100-
101-
<-strictTotalOrder-≈ : StrictTotalOrder _ _ _
102-
<-strictTotalOrder-≈ = On.strictTotalOrder Wₚ.<-strictTotalOrder-≈ toWord

0 commit comments

Comments
 (0)