From 2b24e6ecb631c7b79ac4058a62dc4926c1e75bbd Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 7 Jun 2006 21:01:35 +0000 Subject: [PATCH] fix calc of fahrenheit ... git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@842 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/doc/cdeftutorial.pod | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/program/doc/cdeftutorial.pod b/program/doc/cdeftutorial.pod index bfe94ad0..fc24a34e 100644 --- a/program/doc/cdeftutorial.pod +++ b/program/doc/cdeftutorial.pod @@ -721,9 +721,12 @@ If you do so, you won't be able to use these next GPRINTs: =head2 Degrees Celsius vs. Degrees Fahrenheit +To convert Celsius into Fahrenheit use the formula +F=9/5*C+32 + rrdtool graph demo.png --title="Demo Graph" \ DEF:cel=demo.rrd:exhaust:AVERAGE \ - CDEF:far=cel,32,-,0.55555,* \ + CDEF:far=9,5,/,cel,*,32,+ \ LINE2:cel#00a000:"D. Celsius" \ LINE2:far#ff0000:"D. Fahrenheit\c" @@ -731,19 +734,17 @@ This example gets the DS called "exhaust" from database "demo.rrd" and puts the values in variable "cel". The CDEF used is evaluated as follows: - CDEF:far=cel,32,-,0.5555,* - 1. push variable "cel" - 2. push 32 - 3. push function "minus" and process it - The stack now contains values that are 32 less than "cel" - 4. push 0.5555 - 5. push function "multiply" and process it - 6. the resulting value is now "(cel-32)*0.55555" - -Note that if you take the Celsius to Fahrenheit function you should -be doing "5/9*(cel-32)" so 0.55555 is not exactly correct. It is close -enough for this purpose and it saves a calculation. - + CDEF:far=9,5,/,cel,*,32,+ + 1. push 9, push 5 + 2. push function "divide" and process it + the stack now contains 9/5 + 3. push variable "cel" + 4. push function "multiply" and process it + the stack now contains 9/5*cel + 5. push 32 + 6. push function "plus" and process it + the stack contains now the temperature in Fahrenheit + =head2 Changing unknown into zero rrdtool graph demo.png --title="Demo Graph" \ -- 2.30.2