In F #, the symbols =,<>,<,>,<= and >= represent equal, not equal to, less than, greater than, less than, and greater than or equal to, respectively.
F # provides 6 bitwise operators: ~ ~ ~ (Fetch),&&& (with), | | | (or), ^^ ^ (XOR),<<< (left shift),>>> (right Shift)
Common mathematical functions:
extremum function max,min integers and real numbers
Absolute value function abs integers and real numbers
Rounding function Ceil,floor,round Real number
exponential function exp,** real numbers
Trigonometric Sin,cos,tan,asin,acos,atan,sinh,cosh,tanh Real numbers
F # also provides a truncation function, which always truncates the decimal portion of the truncate
For large number operations, F # provides bigint and Bignum
Here is an expression that evaluates:
[<entrypoint>]let main argv=Let Eva (s:string) =Let SS= S.trim (). Split (' ') Let X= ss.[0] |>System.Double.Parse let y= ss.[2] |>System.Double.Parse Match ss.[1] with|"+"-X +y|"-"-X-y|"*"X *y|"/"-X/y|"%"X%y|"**"-X * *y| _,0.0PRINTFN"Please enter an expression:"Let s=System.Console.ReadLine ()ifS.trim (). Split (' '). Length <2Then PRINTFN"expression is not well-formed" ElseS |> Eva |> printfn"=%f" 0 //returns an integer exit code
F # Learning Notes (integer and real number operations)