[julia-users] Re: Declaring variables in julia
I recommend reading the manual http://docs.julialang.org/en/release-0.3/manual/variables/. // Tomas On Wednesday, December 31, 2014 1:57:25 PM UTC+1, sadhanapriya…@vit.ac.in wrote: hi Please let me know how to declare float, double, long int, unsigned long and unsigned char to some variable in julia( Please mention syntax) Thanks
[julia-users] Re: Declaring variables in julia
Yes, the short answer is that the Julia manual is full of talk about types. Whether to specify type information, and if so, how depends on what you are trying to do. So an example of what you are trying to write would be helpful. Exact type correspondences http://julia.readthedocs.org/en/latest/manual/calling-c-and-fortran-code/#type-correspondences are listed in the Julia manual, but these are normally only useful for interfacing with Fortran or C libraries. --John On Wednesday, December 31, 2014 1:57:25 PM UTC+1, sadhanapriya...@vit.ac.in wrote: hi Please let me know how to declare float, double, long int, unsigned long and unsigned char to some variable in julia( Please mention syntax) Thanks
[julia-users] Re: Declaring variables in julia
http://docs.julialang.org/en/release-0.3/manual/integers-and-floating-point-numbers/ This might be really useful, and I find that Julia's manual is really easy to understand. 在 2014年12月31日星期三UTC+8下午8时57分25秒,sadhanapriya...@vit.ac.in写道: hi Please let me know how to declare float, double, long int, unsigned long and unsigned char to some variable in julia( Please mention syntax) Thanks
[julia-users] Re: Declaring variables in julia
On Wednesday, December 31, 2014 7:57:25 AM UTC-5, sadhanapriya...@vit.ac.in wrote: hi Please let me know how to declare float, double, long int, unsigned long and unsigned char to some variable in julia( Please mention syntax) I've found the following works for me As others have mentioned, that reference page looks good, but for the C equivalent, you need to be a little careful in 2 cases. float will always be Float32 and double will always be Float64, but long is not necessarily 64 bits http://stackoverflow.com/questions/7279504/long-and-long-long-bit-length, so may be either UInt64 or UInt32 depending. Also, in 0.3.x it's Uint and in 0.4.x it UInt (little i, big I). Finally the char type in Julia is a wide char (32 bits), so the equivalent type as far as bits go to C unsigned char is UInt8 on 0.4.x or Uint8 for 0.3.x.
[julia-users] Re: Declaring variables in julia
On Wednesday, December 31, 2014 11:30:50 AM UTC-5, Jeff Waller wrote: As others have mentioned, that reference page looks good, but for the C equivalent, you need to be a little careful in 2 cases. float will always be Float32 and double will always be Float64, but long is not necessarily 64 bits http://stackoverflow.com/questions/7279504/long-and-long-long-bit-length, so may be either UInt64 or UInt32 depending. Also, in 0.3.x it's Uint and in 0.4.x it UInt (little i, big I). Finally the char type in Julia is a wide char (32 bits), so the equivalent type as far as bits go to C unsigned char is UInt8 on 0.4.x or Uint8 for 0.3.x. See: http://docs.julialang.org/en/latest/manual/calling-c-and-fortran-code/#type-correspondences Julia defines aliases like Clong etcetera if you need the exact equivalences of C types on your platform.