[Swift-devel] numeric type(s) in swift.

Mihael Hategan hategan at mcs.anl.gov
Wed Jul 25 09:32:52 CDT 2007


Yep. But we're not using longs.

On Wed, 2007-07-25 at 10:30 +0000, Ben Clifford wrote:
> need to be careful a bit about casting between floating point and fixed 
> precision types in the operator implementation.
> 
> ints are small enough that they fit within a double such that no precision 
> is lost; but using eg. a java long would cause a problem (see below code)
> 
> public class casts {
>     public static void main(String args[]) {
> 
>         long i = 9223372036854775784l;
>         double d = (double) i;
>         long i2 = (long)d;
> 
>         System.out.println("  i="+i);
>         System.out.println("  d="+d);
>         System.out.println(" i2="+i2);
>         if(i != i2) System.out.println("Different");
>     }
> }
> 




More information about the Swift-devel mailing list