write(*,'(f5.1,a)')AT,char(248)//'C'
works in CVF 6.6 in Windows, but gives a question mark in a wee box in
gfortran on Linux.
write(*,'(f5.1,a)')AT,'°C'
works in gfortran on Linux, but gives a wee hatched box in CVF on
Windows.
write(*,'(f5.1,a)')AT,char(176)//'C'
works in neither, but 176 is the correct ASCII number in most word
processors.
Is there a consistent, cross-platform way to get the degree symbol?
°
in HTML
> Is there a consistent, cross-platform way to get the degree symbol?
That's dependent on the character set of the process under which the
executable is running and would require whatever is the appropriate
technique to determine the character on the given platform.
--
It does not depend really on the platform but on the character encoding yor
tools use.
If your text editor (or command tool) uses the ISO-LATIN-1 encoding, then
you are right : CHAR(176) is the correct character (more precisely, the
correct byte, each iso-latin character being represented by a single byte).
Notice that 176 is not ASCII (the valid ASCII code range is 0-127).
The unicode for that character is 00B0 (=176) which matches the ISO-LATIN
definition. But if your tools use the UTF-8 encoding, able to represent any
unicode character and widely implemented now, then the definition is C2B0,
i.e. two bytes (in UTF-8, only ASCII characters are represented by a single
byte).
Try :
write(*,'(f5.1,a)')AT,char(194)//char(176)//'C'
--
François Jacq
email : first name . last name at irsn . fr
> write(*,'(f5.1,a)')AT,char(248)//'C'
> works in CVF 6.6 in Windows, but gives a question mark in a wee box in
> gfortran on Linux.
> write(*,'(f5.1,a)')AT,'?C'
> works in gfortran on Linux, but gives a wee hatched box in CVF on
> Windows.
> write(*,'(f5.1,a)')AT,char(176)//'C'
> works in neither, but 176 is the correct ASCII number in most word
> processors.
> Is there a consistent, cross-platform way to get the degree symbol?
>
To be pedantic, none of the above. There is no "degree celsius",
the unit is celsius, abbreviated C. Temperatures are written like "25 C"
and pronounced "25 celsius". Note that the abbreviation of a unit derived
from a personal name is capitalised but the unit is not capitalised when
written in full. Also there is a space between the number and the unit
abbreviation. All of this matters when writing scientific publications.
--
Ivan Reid, School of Engineering & Design, __________ ex-CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
Yeah, well, you may think me an ignorant yokel, but I like there to be
a degree symbol between the number and the C.
This contradict what I have been taught. Replacing Celsius by Kelvin in
the above paragraph, however, it would be exactly what I was taught.
Since your signature identifies you as someone who works in a scientific
environment, I presumed your knowledge on a matter like this exceeds
mine. So I tried to find out if either my memory of what I had been
taught was false, I had been taught wrong, or official convention in
this matter had changed since the time I had been taught. None of these
three options appears to be true.
I came across the following page on the website of the BIPM, the
International Bureau of Weights and Measurements, which contradicts what
you said.
http://www.bipm.org/en/si/si_brochure/chapter2/2-2/table3.html
Also on the same website is a document describing the International
Temperature Scale of 1990, which on the first page descibes the 'degree
Celsius' as unit.
http://www.bipm.org/utils/common/pdf/its-90/ITS-90.pdf
So from this I assume you must have been mistaken.
Erik.
> http://www.bipm.org/en/si/si_brochure/chapter2/2-2/table3.html
> http://www.bipm.org/utils/common/pdf/its-90/ITS-90.pdf
Hmm, you appear to be right; the degree Celsius does get singled
out as a special case of a derived unit at
http://physlab2.nist.gov/cuu/Units/units.html
and in the one style manual I have to hand. ISTR there have been changes
in opinion on this, it must have ingrained on me when the degree symbol
was less in favour.
--
Ivan Reid, School of Engineering & Design, _____________ CMS Collaboration,
Something had to be done to avoid using the same symbol for 'celsius' and
'coulomb', the latter having been assigned the symbol C.
-- mecej4
Well, I don't know about actual use in practice, but according to
Appendix 1 of the SI brochure available at the BIPM website, degree
Celsius as unit name and the accompanying symbol °C have already been
adopted in 1948.
http://www.bipm.org/en/si/si_brochure/
More specific:
http://www.bipm.org/en/committees/cipm/cipm-1948.html
and
http://www.bipm.org/en/CGPM/db/9/7/
Erik.
I agree with Erik on this one. But then again, there is also a chance
the TideMan could've made a typo.
As far as I remember from an old book describing this in more detail
(and giving an explanation for it), temperatures described in absolute
scale (Kelvins, and Rankins ... if one remembers the anglosaxson scale
correctly) are not written with a degree sign, while temperatures
which are described in relative scale (from freezing point of water in
Celsius scale, for example) are written with it.
Rook
Close, "Rankine" :)
--
Now that we've dropped Rankine's name, anyone in C.L.F who has not already
read his poem is urged to enjoy it:
https://tspace.library.utoronto.ca/html/1807/4350/poem1699.html
-- mecej4
A typical scientific discussion initiated from the issue of how to get
the 'o' symbol through some coding, rooted back to its basic
definition & origin..
Its hilarious guys..!
Here is an extract from another source.
The following
The Oxford Guide to Style
page 172
says
express a degree of temperature in figures, such as
40^C (I've used the ^ to represent the degree character)
... There is a space of the line (or thin space in
scientific and technical work) between the figure and the degree sign.
cheers
ian chivers
On Sep 15, 2:46 pm, "Dr Ivan D. Reid" <Ivan.R...@ivan.fsnet.co.uk>
wrote:
> On Wed, 15 Sep 2010 13:04:43 +0200, Erik Toussaint <u...@example.net.invalid>
> wrote in <4c90a848$0$778$58c7a...@news.kabelfoon.nl>:
> KotPT -- "for stupidity above and beyond the call of duty".- Hide quoted text -
>
> - Show quoted text -
Eh? Kelvin and Rankine seem equally Anglo-Saxon to me. Both were
professors at Glasgow University, in Scotland. Kelvin started life in
Ireland and I suspect Rankine did in Scotland. I'm not sure whether
that makes both of them A-S, or neither :-)
-- John Harper
Yes, of course. I admit, I could've put that a little better - what I
ment was that in continental europe K and C, while in America R and F
are more used.
Although nowadays people use pretty much what suits them the most.
>As far as I remember from an old book describing this in more detail
>(and giving an explanation for it), temperatures described in absolute
>scale (Kelvins, and Rankins ... if one remembers the anglosaxson scale
>correctly)
I was just unsure which one is the name of the scale for absolute
temperature. Rankins or Fahrenheits - just so there is no confusion
under "if one remembers ..."
As far as I know, Chemical Engineers use R, all the rest of science,
when using absolute temperature, use K.
Weather reports in US use F, everywhere else uses C.
And we still call them English units, even though England
doesn't use them.
> Although nowadays people use pretty much what suits them the most.
-- glen
> Here is an extract from another source.
> The following
> The Oxford Guide to Style
> page 172
> says
> express a degree of temperature in figures, such as
> 40^C (I've used the ^ to represent the degree character)
> ... There is a space of the line (or thin space in
> scientific and technical work) between the figure and the degree sign.
Thanks, Ian. I think my confusion must have arisen from my
teacher's confusion about the time that celsius started to be used as an
alternative to Centigrade. I'm reasonably sure, on reflection, that I was
taught that one used "x degrees Centigrade" but "x celsius". Which, it
turns out, is not the case nowadays at least. Sorry about the specific
misinformation; the other comments in my original post stand in the case
of (hopefully!) all other SI units.
Not quite true ...
I'd never heard of Rankine before I got on the interweb things a fair few
years back, but at 43 I can definitely remember the TV weather forecasts giving
the temp in F, and still newspapers regularly list both. The situation is
that I'm happier with C but can understand F, my parents are the other way around,
Ian
It seems that there is a wikipeida page:
Metrification_in_the_United_Kingdom
with all the dates and rules. It seems that for packaged goods
the use of non-metric units was mostly gond by 1980. "Mandatory
metric measures for goods sold loose or in bulk began in 2000."
".... supplementary units could be used indefinitely." Continuing,
"petrol has been sold in liters since the 1980's, but fuel consumption
is quoted in miles per gallon."
In the US, it is common to have the metric units (volume, weight,
size) on things in addition to the english units. Soft drinks come
in, usually, 12oz cans or 2 liter bottles. Since the beginning of
plastic bottles for carbonated drinks, we have always had the 2l size.
Non-carbonated drinks more commonly come in 48oz or 64oz bottles.
At the time that gasoline first went over $1/gallon, many pumps
couldn't easily be converted, but could convert to prices under
$1/liter. If the US had standardized that at the time, then it
would have been a good start toward metrification, but no.
Though many of our (US) units aren't the units previously used
in England. I do remember Canadian gasoline in Imperial gallons,
5/4 of a US gallon, and also, as I understand, different from the
UK Gallon.
-- glen