語言

Float.ToHexString(Single) 方法

定義

回傳參數的十六進位字串表示 float

[Android.Runtime.Register("toHexString", "(F)Ljava/lang/String;", "")]
public static string ToHexString(float f);
[<Android.Runtime.Register("toHexString", "(F)Ljava/lang/String;", "")>]
static member ToHexString : single -> string

參數

f
Single

float將被改造。

傳回

一個參數的十六進位字串表示。

屬性

備註

回傳參數的十六進位字串表示 float 。 以下提及的所有字元均為 ASCII 字元。

<ul><li>若參數為 NaN,結果為字串 “NaN”。 <li>否則,結果是一串字串,代表參數的符號與大小(絕對值)。 若符號為負,結果的第一個字元為 '-'('\u005Cu002D');若符號為正,則結果中不會出現符號字元。 至於星等 m

<ul><li>若 m 為無限大,則由字串 "Infinity"表示;因此,正無限大產生結果 "Infinity" ,負無限大得到結果 "-Infinity"

<li>若 m 為零,則由字串 "0x0.0p0"表示;因此,負零產生結果 "-0x0.0p0" ,正零產生結果 "0x0.0p0"

<li>若 mfloat 具有正規化表示的值,則使用子串來表示顯著數域與指數域。 顯著數以字元 "0x1." 表示,後接著以小寫十六進位表示其餘的 significand 分數。 除非所有數字皆為零,否則十六進位表示法中的尾隨零會被移除,此時使用單一零。 接著,指數以 "p" 表示,接著是無偏指數的十進位串,就像對指數值呼叫 所 Integer#toString(int) Integer.toString 產生的。

<li>若 mfloat 具有次正規表示的值,則 significand 以字元 "0x0." 表示,後接 significand 其餘部分的十六進位表示。 十六進位表示中尾隨的零會被移除。 接著,指數由 表示 "p-126"。 請注意,次正規顯著值中必須至少有一個非零數字。

</ul>

</ul>

<table class=“striped”>caption<範例>/caption<>thead<>tr<th scope=“col”><Floating-point Value>/th<th scope=“col”><十六進位字串>/th<>/thead<>tbody<>tr<th scope=“row”><>1.0/th<>td<>0x1.0p0/td<>tr<th scope=“row”/th td/td tr scope = “row”><>-1.0/th td<></td>-0x1.0p0<>tr<scope =“row”><>/th2.0<td><>/td0x1.0p1<tr>th scope=「row」<><>/th3.0<td><>/td0x1.8p1<tr>th scope =「row」/th td/td tr th scope =「row」<><>/th0.5<td><>/td0x1.0p-1<tr>th scope =「row」<><>/th td0.25<>/td<>0x1.0p-2<tr>th scope = 「row」/th td<><>/thFloat.MAX_VALUE<><>(tr th scope=「row」)0x1.fffffep127<><><>/thMinimum Normal Value<td><>/td0x1.0p-126<tr>th scope=“row”<><>/thMaximum Subnormal Value<td><>/td0x0.fffffep-126<tr>th scope = “row”<><>/th tdFloat.MIN_VALUE<>/td<>/tbody0x0.000002p-126<></table ><>

已在1.5中新增。

Java 文件 java.lang.Float.toHexString(float)

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於