Skip to content

Commit

Permalink
Add float_compose to complement float_decompose
Browse files Browse the repository at this point in the history
This can be useful for example to make a generic canonical_NaN() function.
  • Loading branch information
Timmmm committed Jan 25, 2025
1 parent 2dbe7b4 commit bc4b5a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/float/common.sail
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function float_decompose(op) = {
}
}

val float_compose : forall 'n, 'n in { 16, 32, 64, 128 }. float_bits('n) -> bits('n)
function float_compose(op) = op.sign @ op.exp @ op.mantissa

val float_has_max_exp : forall 'n, 'n in { 16, 32, 64, 128 }. bits('n) -> bool
function float_has_max_exp (op) = {
let fp = float_decompose (op);
Expand Down

0 comments on commit bc4b5a5

Please sign in to comment.