Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/attn_views_constants.wl # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / attn_views_constants.wl` 3 lines · 1697 bytes Raw Blame History 1 (* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *) 2 ss={"0.0", "1.`7976931348623157e308`", "2.`2250738585072014e`-308", "`18014398509481984`.0", "1.`41421356237309504880`", "0.5", "1.0", "6.`93147180369123816490e`-01", "2.0", "1.`90821492927058770002e`-10", "709.78", "-745.2", "1.`44269504088896338700`", "-0.5", "6.`36619772367581382433e`-01", "1.`57079632673412561417`", "6.`07710050630396597660e`-11", "2.`02226624871116645580e`-21", "8.`47842766036889956997e`-32"}; parse[s_]:=Module[{t=StringSplit[s,"e"],m,e=0,sg=1,d},m=First[t];If[Length[t]>1,e=ToExpression[t[[2]]]];If[StringStartsQ[m,"-"],sg=-1;m=StringDrop[m,1]];d=StringSplit[m,"."];sg FromDigits[StringJoin[d]]/10^StringLength[d[[2]]] 10^e]; bits[s_]:=Module[{x=parse[s],sg=0,e,m},If[x<0,sg=2^63;x=-x];If[x==0,Return[sg]];e=Floor[Log[2,x]];m=Round[x 2^(52-e)];If[m==2^53,m=2^52;e++];If[e>=-1022,sg+(e+1023)2^52+(m-2^52),sg+Round[x 2^1074]]]; Map[{#,bits[#]}&,ss] 3 (* Result: {'0.0': 0, '1.`7976931348623157e308`': `9218868437227405311`, '2.`2250738585072014e`-308': `4503599627370496`, '`18014398509481984`.0': `4850376798678024192`, '1.`41421356237309504880`': `4609047870845172685`, '0.5': `4602678819172646912`, '1.0': `4607182418800017408`, '6.`93147180369123816490e`-01': `4604418534311723008`, '2.0': `4611686018427387904`, '1.`90821492927058770002e`-10': `4461442080421002358`, '709.78': `4649454506724284170`, '-745.2': `13873138101193906586`, '1.`44269504088896338700`': `4609176140021203710`, '-0.5': `13826050856027422720`, '6.`36619772367581382433e`-01': `4603909380684499075`, '1.`57079632673412561417`': `4609753056924401664`, '6.`07710050630396597660e`-11': `4454258360616747008`, '2.`02226624871116645580e`-21': `4297306550709518336`, '8.`47842766036889956997e`-32': `4142048980368378305`} *)