- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Sample Literals in Visual Basic .NET
Sample Literals Painting Data Matrix 2d Barcode In VB.NET Using Barcode encoder for Visual Studio .NET Control to generate, create DataMatrix image in Visual Studio .NET applications. www.OnBarcode.comDataMatrix Reader In VB.NET Using Barcode reader for VS .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.com0us, 19us, 0x0800us 0, 19, 0x0800, 0b0001 0u, 19u, 0x0800u 0L, 19L, 0x0800L 0UL, 19UL, 0x0800UL 0n, 19n, 0x0800n 0un, 19un, 0x0800un 0.0f, 19.7f, 1.3e4f 0.0, 19.7, 1.3e4 0M, 19M, 19.03M 0I, 19I 0N, 19N () Code 128B Generator In VB.NET Using Barcode generation for .NET framework Control to generate, create Code 128B image in .NET applications. www.OnBarcode.comBarcode Generator In Visual Basic .NET Using Barcode creator for .NET Control to generate, create Barcode image in .NET applications. www.OnBarcode.com.NET Name
PDF-417 2d Barcode Drawer In VB.NET Using Barcode drawer for Visual Studio .NET Control to generate, create PDF 417 image in VS .NET applications. www.OnBarcode.comDrawing Linear In Visual Basic .NET Using Barcode generator for .NET Control to generate, create 1D image in .NET applications. www.OnBarcode.comSystem.UInt16 System.Int32 System.UInt32 System.Int64 System.UInt64 System.IntPtr System.UIntPtr System.Single System.Double System.Decimal Math.BigInt Math.BigNum Core.Unit Encoding UPC Code In Visual Basic .NET Using Barcode generator for VS .NET Control to generate, create UPC A image in Visual Studio .NET applications. www.OnBarcode.comI-2/5 Creator In Visual Basic .NET Using Barcode creator for .NET Control to generate, create ANSI/AIM I-2/5 image in VS .NET applications. www.OnBarcode.comArithmetic Operators
Draw ECC200 In None Using Barcode maker for Word Control to generate, create Data Matrix 2d barcode image in Microsoft Word applications. www.OnBarcode.comECC200 Creation In Java Using Barcode encoder for Android Control to generate, create Data Matrix ECC200 image in Android applications. www.OnBarcode.comTable 3-2 lists the most commonly used arithmetic operators. These are overloaded to work with all the numeric types listed in Table 3-1. Table 3-2. Arithmetic Operators and Examples Make GTIN - 12 In Visual C#.NET Using Barcode maker for Visual Studio .NET Control to generate, create UPC-A image in .NET framework applications. www.OnBarcode.comGenerating Code 128 Code Set A In Java Using Barcode creation for Java Control to generate, create USS Code 128 image in Java applications. www.OnBarcode.comOperator
Linear 1D Barcode Creation In Java Using Barcode generation for Java Control to generate, create 1D Barcode image in Java applications. www.OnBarcode.comDecode QR Code JIS X 0510 In .NET Framework Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.com+ * / % - Paint QR In None Using Barcode generation for Microsoft Word Control to generate, create QR image in Microsoft Word applications. www.OnBarcode.comPrint PDF-417 2d Barcode In None Using Barcode creation for Excel Control to generate, create PDF-417 2d barcode image in Excel applications. www.OnBarcode.comDescription
Making Barcode In Java Using Barcode creator for BIRT Control to generate, create Barcode image in Eclipse BIRT applications. www.OnBarcode.comRecognize Barcode In Visual Basic .NET Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comUnchecked addition Unchecked subtraction Unchecked multiplication Division Modulus Unary negation
1D Barcode Maker In Visual C#.NET Using Barcode generation for .NET Control to generate, create Linear 1D Barcode image in .NET framework applications. www.OnBarcode.comPaint GTIN - 13 In Java Using Barcode generation for Eclipse BIRT Control to generate, create European Article Number 13 image in BIRT reports applications. www.OnBarcode.comSample Use on int
1 + 2 12 - 5 2 * 3 5 / 2 5 % 2 -(5+2) Sample Use on float
1.0 + 2.0 12.3 - 5.4 2.4 * 3.9 5.0 / 2.0 5.4 % 2.0 -(5.4+2.4) CHAPTER 3 CREATING YOUR FIRST F# PROGRAM
The behavior of these and other operators can be extended for user-defined types, a topic covered in 6. In F#, addition, subtraction, and multiplication over integers are unchecked; that is, if overflow or underflow occurs beyond the representable range, then wraparound occurs. For example, 2147483647 is the largest representable 32-bit integer of the int type: > 2147483647+1;; val it : int = -2147483648 You can access checked versions of arithmetic operators that raise System.OverflowException exceptions by opening the Microsoft.FSharp.Core.Operators.Checked module. If avoiding overflow is a priority, then using the decimal, bigint, and bignum types is recommended. Division by zero raises a System.DivideByZeroException exception, except in the case of floating-point numbers, where it returns one of the special floating-point numbers Infinity and -Infinity. Operator overloading interacts with type inference if a use of an overloaded operator isn t otherwise constrained to work on a particular type, then F# assumes it works on 32-bit integers. To constrain a use of an operator to a particular type, you must give a type annotation that has the effect of telling the compiler the type on the left of the two arguments to the binary operator. For example, in the absence of additional type information, the following function is assumed to work with integers: > let squareAndAdd a b = a * a + b;; val squareAndAdd : int -> int -> int A single type annotation on a is sufficient to indicate that a * a is an operation on float values and thus returns a float value, and that a * a + b is also an operation on float: > let squareAndAdd (a:float) b = a * a + b;; val squareAndAdd : float -> float -> float If you want, you can also give full type annotations for the arguments and return type of a function: > let squareAndAdd (a:float) (b:float) : float = a * a + b;; val squareAndAdd : float -> float -> float Bitwise Operations
All the integer types listed in Table 3-1 support bitwise manipulations on their underlying representations. Table 3-3 shows the bitwise manipulation operators. CHAPTER 3 CREATING YOUR FIRST F# PROGRAM
Table 3-3. Bitwise Arithmetic Operators and Examples
Operator
&&& ||| ~~~ <<< >>>
Description
Bitwise and Bitwise or Bitwise exclusive or Bitwise negation Left shift Right shift (arithmetic if signed) Sample Use
0x65 &&& 0x0F 0x65 ||| 0x18 0x65 0x0F ~~~0x65 0x01 <<< 3 0x65 >>> 3
Result
0x05 0x7D 0x6A 0xFFFFFF9a 0x08 0x0C
The following sample shows how to use these operators to encode 32-bit integers into 1, 2, or 5 bytes, represented by returning a list of integers. Integers in the range 0 to 127 return a list of length 1: let encode (n: int32) = if (n >= 0 && n <= 0x7F) then [ n ] elif (n >= 0x80 && n <= 0x3FFF) then [ (0x80 ||| (n >>> 8)) &&& 0xFF; (n &&& 0xFF) ] else [ 0xC0; ((n >>> 24) &&& 0xFF); ((n >>> 16) &&& 0xFF); ((n >>> 8) &&& 0xFF); (n &&& 0xFF) ] Here s an example of the function in action: > encode 32;; val it : int32 list = [32] > encode 320;; val it : int32 list = [129; 64] > encode 32000;; val it : int32 list = [192; 0; 0; 125; 0]
|
|