C++Guns – RoboBlog

08.09.2017

C&P Bug of the Day

Filed under: Allgemein — Tags: — Thomas @ 15:09

Keine Ahnung wie das passiert ist. git diff zeigte es dann. Ich wusste garnicht, dass so etwas überhaupt compiliert. FORTRAN ist scheiße 😀 - ContAdvection(1) = NABLA_U(1,2) + NABLA_U(2,3) + ContAdvection(1) = (1,2) + NABLA_U(2,3)

04.09.2017

C++ Guns - Semantik und concepts - Part 2

Filed under: Allgemein — Tags: , — Thomas @ 14:09

Im letzten Post wollte ich deutlich machen, welche Art von Fehler passieren, wenn zwischen den TypenPoint3D und Vector3D keinen semantischen Unterschied gemacht wird. Also, wenn ein Rechenergebnis von der Bedeutung ein Vektor ist, es aber in einem Punkt Datentyp gespeichert wird. Die erste Lösung war, einen zusätzlichen Datentyp Vector3D zu erstellen, welcher sich genau wie […]

15.06.2017

FORTRAN: parameter variables in module evaluated at compile or runtime?

Filed under: Allgemein — Tags: — Thomas @ 10:06

Suggest you habe a fortran module with a collection of mathematical constant like PI. module constant_m real, parameter :: PI = 3.1314_8 end module Now you use this module in a function which calculate the circumcenter of a circle with given radius. function U(r) use constant_m implicit none real, intent(in) :: r real :: U […]

31.05.2017

FORTRAN - NaN and min() max()

Filed under: Allgemein — Tags: — Thomas @ 19:05

What happens if one put NaN into min() or max()? Will it return NaN or the other number? Is it deterministic or random? Sounds easy to test but its hard to implement. For example: How one get a quite-NaN number? A quite-NaN dosen't trigger debug traps, signaling-NaN do. There is no standard way in pre […]

11.05.2017

C++ Guns - Why isn't there a swap function in Fortran and C?

Filed under: Allgemein — Tags: , , — Thomas @ 09:05

Because Fortran and C sucks. To implement a generic swap function which works for any type and any custom type, one needs templates. Think about usually variables which store a value. Templates are variables which store types. But Fortran and C do not have template techniques. So one must implement a swap function for every […]

26.06.2016

malloc info fortran

Filed under: Allgemein — Tags: — Thomas @ 00:06

Code snipped to get detailed information about memory usage mallocinfo.f95.zip Related: Code snipped to read /proc status with fortran. module MallocInfo_m use :: iso_c_binding implicit none !> This structure type is used to return information about the dynamic memory allocator. type, bind(c) :: MallInfo_t !> This is the total size of memory allocated with sbrk […]

17.02.2016

Fortran: Detect 64bit 32bit

Filed under: Allgemein — Tags: — Thomas @ 08:02

Ein möglicher Weg zu erkennen ob auf einer 64bit oder 32bit Maschine compiliert wird ist mit Hilfe von macros. Die üblichen macros wie __amd64, __amd64__, __x86_64 __x86_64__ funktionieren unter gfortran (nicht) mehr, da sie nur zeigen ob eine 64Bit Prozessor zur Verfügung steht. Und nicht, ob man auch wirklich für 64bit compiliert. [1] Es ist […]

12.02.2016

/proc status

Filed under: Allgemein — Tags: — Thomas @ 20:02

Code snipped to read /proc status with fortran. E.g. used memory and so... ! original: http://hiliev.eu/posts/recipe-obtaining-peak-vm-memory-size-in-pure-fortran.html module ProcStatus contains !---------------------------------------------------------------! ! Returns current process virtual memory size ! ! Requires Linux procfs mounted at /proc ! !---------------------------------------------------------------! ! Output: vmsize - vmsize VM size in kB ! !---------------------------------------------------------------! function getVmSize() result(vmsize) implicit none integer :: […]

26.01.2016

Evaluation of logical operations

Filed under: Allgemein — Tags: , , — Thomas @ 21:01

Spass mit dem Standard. Aus dem Fortran 90/95 Standard [1] Kapitel 7.1.7.6. Evaluation of logical intrinsic operations The rules given in 7.2.4 specify the interpretation of logical intrinsic operations. Once the interpretation of an expression has been established in accordance with those rules, the processor may evaluate any other expression that is logically equivalent, provided […]

04.05.2015

storing into constants (Bug of the day 4)

Filed under: Allgemein — Tags: — Thomas @ 17:05

From the Layhey Fortran 95 compiler user guide. -[N]PCA Protext Constant Arguments Compile only. Default npca Specify -pca to prevent invoked subprograms from storing into constants. Example call sub(5) print *, 5 end subroutine sub(i) i = i + 1 end This example would print 5 using -pca and 6 using -npca. Greatest bullshit I've […]

Older Posts »

Powered by WordPress