

Subject:
Computer Programming, C++ 'SIGN' function, 1.d0
Category: Computers > Programming Asked by: cping3ga List Price: $5.00 
Posted:
08 Jul 2004 18:53 PDT
Expires: 07 Aug 2004 18:53 PDT Question ID: 371633 
I am writing a simulation code in MATLAB. I am using a set of formulas called 'Pacejka 94', they are formulas used to simulate a vehicle tire. The code I am copying from is 'I believe' C++, but it may be something else similar. The text I am copying the code from does not distinquish. The script in question is: E=((B6*FZ^2+B7)*FZ+B8)*(1.D0(B13*SIGN(1.D0,X1)))) The real issue I have is with the variable 1.D0 or 1.d0. What does this stand for? I have a variable named D already, and it may be the initial value for D, but I still don't know what the 1 and period are for. Is this a single variable, a dot product, or? Also, I do not understand the function 'SIGN()'. MATLAB has a SIGN function but it only operates for a single variable, not a pair (as it seems to be). Can you explain the SIGN function. I understand all the other variables in the equation (X1, B6, FZ, etc), they are just integers. 

Subject:
Re: Computer Programming, C++ 'SIGN' function, 1.d0
Answered By: hedgiega on 08 Jul 2004 20:18 PDT 
The D is used instead of E to express double precision numbers, e.g. in FORTRAN, as shown here REAL X DATA X /.01/ IF ( X * 100.d0 .NE. 1.0 ) THEN PRINT *, 'Many systems print this surprising result. ' ELSE PRINT *, 'And some may print this.' ENDIF http://www.lahey.com/float.htm FORTRAN also has sign with 2 arguments, explained e.g. here Sign(A, B) Sign: INTEGER or REAL function, the exact type being the result of crosspromoting the types of all the arguments. Returns `ABS(A)*s', where s is +1 if `B.GE.0', 1 otherwise. http://cclib.nsu.ru/projects/gnudocs/gnudocs/g77/g77_298.html or here The function sign in Fortran is called the sign transfer function. It is a function of two variables, sign(x,y) If we substitute x = 1 in the sign transfer function, we get the sign of y; http://www.math.hawaii.edu/lab/197/fortran/fort4.htm So, it looks like Hans was writing in Fortran http://www.amazon.co.uk/exec/obidos/ASIN/0750651415/wwwlinksoftware21/02691201724002819  
 


There are no comments at this time. 
If you feel that you have found inappropriate content, please let us know by emailing us at answerssupport@google.com with the question ID listed above. Thank you. 
Search Google Answers for 
Google Home  Answers FAQ  Terms of Service  Privacy Policy 