real-datatype

Precision problems of real numbers in Fortran [duplicate]

若如初见. 提交于 2019-11-27 09:49:39
This question already has an answer here: Is floating point math broken? 30 answers I've been trying to use Fortran for my research project, with the GNU Fortran compiler (gfortran), latest version, but I've been encountering some problems in the way it processes real numbers. If you have for example the code: program test implicit none real :: y = 23.234, z z = y * 100000 write(*,*) y, z end program You'll get as output: 23.23999 2323400.0 I find this really strange. Can someone tell me what's exactly happening here? Looking at z I can see that y does retain its precision, so for calculations

Are “Complex Numbers” already defined in Objective-C?

試著忘記壹切 提交于 2019-11-27 06:00:04
问题 For the following code, -How does Objective-C know to add an "i" to complex numbers? When I defined "real" and "imaginary" as double values in the Complex.m file I figured Xcode would ONLY know that "real" and "imaginary" are double values. -If I add an "i" to the end of a complex number in main.m file, for example, if I turn "myComplex.imaginary = 7;" into "myComplex.imaginary = 7i;" the output for that line becomes 0.00000i, if I add any other letter, the program will simply not run, why is

Precision problems of real numbers in Fortran [duplicate]

泪湿孤枕 提交于 2019-11-26 14:51:51
问题 This question already has answers here : Is floating point math broken? (31 answers) Closed 3 years ago . I've been trying to use Fortran for my research project, with the GNU Fortran compiler (gfortran), latest version, but I've been encountering some problems in the way it processes real numbers. If you have for example the code: program test implicit none real :: y = 23.234, z z = y * 100000 write(*,*) y, z end program You'll get as output: 23.23999 2323400.0 I find this really strange.