MCPcopy Create free account
hub / github.com/Sinflower/UberWolf / CL_vsprintf_help_ftoa

Function CL_vsprintf_help_ftoa

3rdParty/DXLib/CharCode.cpp:3908–4137  ·  view source on GitHub ↗

浮動小数点値を文字列化する関数、戻り値は書き込んだバイト数

Source from the content-addressed store, hash-verified

3906
3907// 浮動小数点値を文字列化する関数、戻り値は書き込んだバイト数
3908static int CL_vsprintf_help_ftoa(
3909 double Number,
3910 int Type,
3911 int Flag_Sharp,
3912 int Flag_Zero,
3913 int Flag_Minus,
3914 int Flag_Plus,
3915 int Flag_Space,
3916 int Width,
3917 int Precision,
3918 char *Dest,
3919 int DestCharCodeFormat
3920)
3921{
3922 int DestSize ;
3923 u32 NumberNum ;
3924 u32 SignedCharNum ;
3925 int NumberMinus ;
3926 int FPClass ;
3927 int NaN ;
3928 int Big ;
3929 int i ;
3930 int Flag_Precision ;
3931 u8 NumberStrTemp[ 1024 ] ;
3932
3933 DestSize = 0 ;
3934
3935 // NaNチェック
3936 FPClass = _fpclass( Number ) ;
3937 NaN = 0 ;
3938 if( FPClass == _FPCLASS_SNAN ||
3939 FPClass == _FPCLASS_QNAN ||
3940 FPClass == _FPCLASS_NINF ||
3941 FPClass == _FPCLASS_PINF )
3942 {
3943 NaN = 1 ;
3944
3945 // NaNの値はプラス扱い
3946 if( FPClass == _FPCLASS_SNAN ||
3947 FPClass == _FPCLASS_QNAN )
3948 {
3949 NumberMinus = 0 ;
3950 }
3951 else
3952 {
3953 // それ以外は負の無限大の場合のみマイナス扱い
3954 NumberMinus = FPClass == _FPCLASS_NINF ? 1 : 0 ;
3955 }
3956 }
3957 else
3958 {
3959 // 通常の値の場合の処理
3960
3961 // マイナスの値はプラスにする
3962 NumberMinus = 0 ;
3963 if( Number < 0.0 )
3964 {
3965 Number = -Number ;

Callers 1

CL_vsprintfFunction · 0.85

Calls 10

CL_vsprintf_help_ftoa_fFunction · 0.85
CL_vsprintf_help_ftoa_eFunction · 0.85
CL_vsprintf_help_ftoa_gFunction · 0.85
CL_vsprintf_help_ftoa_aFunction · 0.85
PutCharCode_inlineFunction · 0.85

Tested by

no test coverage detected