F64 Version 0.95 - another quality product by freedimension
Germany, Octobre 31st. 2003
 
Special thanks to Florian W., he was the one who had the idea with the additional optional result parameters.
 
Please report all bugs to Jack at the PureBasic Forum.
 
1. Introduction
----------------
F64 is a library for those of you who can't wait no more for the native Double Floats (64Bit).
This library is not a replacement for the, hopefully coming soon, native double type.
Also it never will be as fast as native types would be, this is because of the additional procedure calls made.
 
I still wonder why this wasn't done by someone else before.
 
 
2. Usage
---------
df means Double Float
 
Defining a new double variable is as easy as
[code]
df.double
[/code]
 
Values can be assigned by simply calling the Function F64Val() or F64Float()
[code]
F64_Val(df.double, "25.0")
F64_Float(df.double, 25.0)
[/code]
 
All Functions expecting a double as result are writing this result in the first passed double parameter (df1 or df in the descriptions).
Example:
[code]
df1.double
df2.double
F64_Val(df1, "23") ;df1 becomes 23
F64_Val(df2, "19") ;df2   -"-   19
F64_Add(df1, df2)  ;df1 should now be 42 while df2 remains 19
[/code]
 
Since version 0.9 the result can also be stored in an optional parameter. In this case, the first parameter stays untouched.
Example:
[code]
df1.double
df2.double
result.double
F64_Val(df1, "23") ;df1 becomes 23
F64_Val(df2, "19") ;df2   -"-   19
F64_Add(df1, df2, result)  ;df1 should now still be 23, df2 remains 19 too. result will be the only changed variable, it's value now 42.
[/code]
 
3. Functions
-------------
Functions marked with an asterisk * return a pointer to the result.
 
 
;Conversion
Procedure.s F64_Str(df.double [[, p.l]]); Converts df to a string [with p significant digits]. Returns a String.
  You can alter the Output by specifying one or two optional parameters.
  The first optional parameter specifies the number of digits behind the dot.
  The second further specifies the format of the output.
  By now there are 3 Constants for the last parameter
  #F64_Format_Decimal       Output as decimal number
  #F64_Format_Scientific    Output as decimal number in scientific format
  #F64_Format_Auto          Output as one of the above, shortest wins
 
Procedure F64_Val(df.double); Converts a string to a double.
Procedure F64_Float(df.double, f.f); Converts a float to a double
Procedure.f F64_toFloat(df.double); Returns the float value of df
Procedure F64_toInt(df.double); Returns the integer value of df
 
;Basic Math
* Procedure F64_Add(df1.double, df2.double [, result.double]); Adds two doubles
* Procedure F64_Sub(df1.double, df2.double [, result.double]); Subtracts df2 from df1
* Procedure F64_Mul(df1.double, df2.double [, result.double]); Multiplies two doubles
* Procedure F64_Div(df1.double, df2.double [, result.double]); Divides df1 by df2
* Procedure F64_Inc(df.double); Increases df by 1
* Procedure F64_Dec(df.double); Decreases df by 1
 
;Additional Math
* Procedure F64_Mod(df1.double, df2.double [, result.double]); Calculates the Remainder of df1/df2
* Procedure F64_Pow(df1.double, df2.double [, result.double]); Calculates df1 to the power of df2
* Procedure F64_Abs(df.double [, result.double]); Calculates the absolute value of df
* Procedure F64_Sqrt(df.double [, result.double]); Calculates the Squareroot of df
* Procedure F64_Negate(df.double [, result.double]); Changes the sign of df
* Procedure F64_LN(df.double [, result.double]); Calculate the natural logarithm (base e)
* Procedure F64_Log(df.double [, result.double]); Calculates the base 10 logarithm
 
;Logical
Procedure F64_Cmp(df1.double, df2.double); Compares df1 and df2. Returns 1 if df1>df2, 0 if df1=df2 and -1 if df1<df2.
Procedure F64_Equ(df1.double, df2.double); Compares df1 and df2. Returns 1 if df1=df2 else 0.
Procedure F64_Copy(df1.double, df2.double); Copys the value from df2 into the variable df1
 
;Trigonometry
* Procedure F64_Sin(df.double [, result.double]); Calculates the Sine of df
* Procedure F64_Cos(df.double [, result.double]); Calculates the Cosine of df
* Procedure F64_Tan(df.double [, result.double]); Calculates the Tangent of df
* Procedure F64_ASin(df.double [, result.double]); Calculates the Arcus Sine of df
* Procedure F64_ACos(df.double [, result.double]); Calculates the Arcus Cosine of df
* Procedure F64_ATan(df.double [, result.double]); Calculates the Arcus Tangent of df
* Procedure F64_SinH(df.double [, result.double]); Calculates the Hyperbolic Sine of df
* Procedure F64_CosH(df.double [, result.double]); Calculates the Hyperbolic Cosine of df
* Procedure F64_TanH(df.double [, result.double]); Calculates the Hyperbolic Tangent of df
* Procedure F64_ASinH(df.double [, result.double]); Calculates the Arcus Hyperbolic Sine of df
* Procedure F64_ACosH(df.double [, result.double]); Calculates the Arcus Hyperbolic Cosine of df
* Procedure F64_ATanH(df.double [, result.double]); Calculates the Arcus Hyperbolic Tangent of df
* Procedure F64_Cot(df.double [, result.double]); calculates the cotangent of df
* Procedure F64_CotH(df.double [, result.double]); calculates the hyperbolic cotangent of df
* Procedure F64_ACotH(df.double [, result.double]); calculates the arcus hyperbolic cotangent of df
 
;Misc
Procedure F64Version(); Returns the Version of this Library, HighWord = Major, LowWord = Minor (no leading 0)
 
 
4. Example
-----------
An example can be found in $PB-Root$\Examples\UserLibraries\
 
 
5. Known issues
----------------
- By now there are no debugger checks, so be sure to pass only valid Parameters (i.e. no NULLs or other invalid pointers)
- F64Str() : Trailing 0 (zeros) aren't removed, I'll have a look at it in Version 1.0 (that's what I call a Fredism ;-)
 
That's all for now, but there's no doubt there will soon be more.
 
 
6. ToDo
--------
Any ideas?
 
 
7. History
-----------
v0.95
- Added F64_Sign, F64_AtanQuad, F64_Frac, F64_Integer, F64_Int, F64_IsInt, F64_iDiv, F64_Inv
- Added F64_Cbrt, F64_Factorial, F64_Ceil, F64_Floor, F64_Round, F64_IsInfinite, F64_IsNaN
 
v0.9
- Added F64_Exp, -Sqrt, -Abs, -Negate
- Implemented optional result parameter
- last "f64 readme.txt" was an older version, so features F64_Log and F64_Ln weren't documented
  Also there is no need to declare a structure anymore, a structure called "double" has been put into a resident file.
 
v0.7
- Added F64_Inc, -Dec  (slightly Faster (~10-20%) than using F64_Add or F64_Sub)
- Now nested Function Calls are possible. All calculational Functions return the Pointer to the Result.
 
v0.6
- !!! Inserted underscores _ for better readability (F64_Command instead of F64Command) !!!
- Added F64_ASin, -ACos, -ATan, -SinH, -CosH, -TanH, -ASinH, -ACosH, -ATanH
- Added F64_Cot, -CotH, -ACotH
- Added F64_Equ, -Swap
- Added F64_toInt
- Added F64_E, -PI
- Fixed F64_toFloat
- F64_Str has now 1 parameter (double input) + 2 optional parameters (precision and output format)
- made a resident file with the double structure and 3 Constants (#F64_Format_Decimal, #F64_Format_Scientific and #F64_Format_Auto)
 
v0.5
- First public Version, so no changes
 
 
8. License
-----------
This library is for free, so spread it but please keep the readme.txt attached unaltered.