Skip to content

Commit

Permalink
Merge pull request mockingbirdnest#3994 from pleroy/LeNonDUneBranche
Browse files Browse the repository at this point in the history
Add control over the number of bits after the mantissa
  • Loading branch information
pleroy authored May 4, 2024
2 parents de651a2 + b8e022e commit e3e538c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mathematica/floating_point.wl
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ CorrectlyRound[x_]:=If[x==\[Infinity]||x==-\[Infinity],x,If[Abs[#]>=2^(bias+1),S
UlpDistance[x_,y_]:=Abs[Representation[x]-Representation[y]]


Bits[n_]:=If[n>=0,"0","1"]<>
Bits[n_, extraBits_: 10]:=If[n>=0,"0","1"]<>
"|"<>IntegerString[IntegerPart[Representation[Abs[n]]/2^(significandBits-1)],2,exponentBits]<>
"|"<>IntegerString[Mod[IntegerPart[Representation[Abs[n]]],2^(significandBits-1)],2,significandBits-1]<>
";"<>If[FractionalPart[Representation[Abs[n]]]==0,"",ToString/@RealDigits[N[FractionalPart[Representation[Abs[n]]],5],2,10,-1][[1]]<>"\[Ellipsis]"];
";"<>If[FractionalPart[Representation[Abs[n]]]==0,"",ToString/@RealDigits[N[FractionalPart[Representation[Abs[n]]],extraBits/2],2,extraBits,-1][[1]]<>"\[Ellipsis]"];


fullHexDigits:=Floor[(significandBits-1)/4]
Expand Down
1 change: 1 addition & 0 deletions mathematica/mathematica.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<ItemGroup>
<None Include="associated_legendre_function.wl" />
<None Include="elliptic_integrals.wl" />
<None Include="floating_point.wl" />
<None Include="fornberg.wl" />
<None Include="fukushima_elliptic_bd.wl" />
<None Include="generate_graphs.wl" />
Expand Down
3 changes: 3 additions & 0 deletions mathematica/mathematica.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@
<None Include="newhall.wl">
<Filter>Scripts</Filter>
</None>
<None Include="floating_point.wl">
<Filter>Scripts</Filter>
</None>
</ItemGroup>
</Project>

0 comments on commit e3e538c

Please sign in to comment.