FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
assemblyscript/scripts/hexfloat.html at master · developerfred/assemblyscript · GitHub
developerfred
/
assemblyscript
Public
forked from
AssemblyScript/assemblyscript
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
assemblyscript
/
scripts
/
hexfloat.html
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (38 loc) · 1.42 KB
Breadcrumbs
assemblyscript
/
scripts
/
hexfloat.html
Copy path
File metadata and controls
40 lines (38 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<
style
>
html
,
body
{
margin
:
0
; }
body
{
font-family
:
sans-serif;
border-top
:
5
px
solid
#
0074C1
; }
form
{
margin
:
10
px
; }
label
{
cursor
:
pointer; }
</
style
>
<
form
onsubmit
="
convert(this); return false
"
>
<
h1
>
Hexadecimal float to decimal float converter
</
h1
>
<
p
>
<
label
for
="
f64
"
>
<
input
id
="
f64
"
name
="
precision
"
value
="
f64
"
type
="
radio
"
checked
/>
f64
</
label
>
<
label
for
="
f32
"
>
<
input
id
="
f32
"
name
="
precision
"
value
="
f32
"
type
="
radio
"
/>
f32
</
label
>
<
input
id
="
pre
"
type
="
text
"
value
="
test(
"
/>
<
input
id
="
post
"
type
="
text
"
value
="
);
"
/>
<
button
>
Convert
</
button
>
</
p
>
<
p
>
<
textarea
cols
="
120
"
rows
="
20
"
id
="
input
"
>
</
textarea
>
</
p
>
<
p
>
<
textarea
cols
="
120
"
rows
="
20
"
id
="
output
"
readonly
>
</
textarea
>
</
p
>
</
form
>
<
script
src
="
hexfloat.js
"
>
</
script
>
<
script
>
function
convert
(
form
)
{
var
isF64
=
document
.
getElementById
(
"f64"
)
.
checked
;
var
pre
=
document
.
getElementById
(
"pre"
)
.
value
;
var
post
=
document
.
getElementById
(
"post"
)
.
value
;
var
input
=
document
.
getElementById
(
"input"
)
.
value
;
document
.
getElementById
(
"output"
)
.
value
=
input
.
replace
(
/
\b
(
\-
?
0
x
[
0
-
9
a
-
f
A
-
F
]
*
(?:
\.
[
0
-
9
a
-
f
A
-
F
]
+
)
?
[
p
P
]
[
+
-
]
?
[
0
-
9
]
+
\b
)
/
g
,
(
$0
,
$1
)
=>
{
var
val
=
parse
(
$1
)
;
return
val
.
toPrecision
(
isF64
?
18
:
10
)
;
}
)
.
replace
(
/
(
\d
\.
[
0
-
9
]
)
0
+
\b
/
g
,
"$1"
)
.
replace
(
/
\b
n
a
n
\b
/
g
,
"NaN"
)
.
replace
(
/
\b
i
n
f
\b
/
g
,
"Infinity"
)
.
replace
(
/
^
T
\(
R
\w
,
*
/
mg
,
pre
)
.
replace
(
/
\)
;
?
$
/
mg
,
post
)
.
replace
(
/
+
/
g
,
" "
)
;
}
</
script
>
Back
|
FazBrowse Home
|
New Git URL