Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to write a degree sign

271 views
Skip to first unread message

TideMan

unread,
Sep 14, 2010, 7:55:03 PM9/14/10
to
I want to write the apparent temperature in degrees C:

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?

e p chandler

unread,
Sep 14, 2010, 9:41:39 PM9/14/10
to

"TideMan" <mul...@gmail.com> wrote in message
news:3ef648b5-7ac8-4bca...@n19g2000prf.googlegroups.com...

&deg;

in HTML


dpb

unread,
Sep 14, 2010, 9:54:33 PM9/14/10
to
TideMan wrote:
...

> 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.

--


fj

unread,
Sep 14, 2010, 10:02:35 PM9/14/10
to
TideMan wrote:

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

Dr Ivan D. Reid

unread,
Sep 15, 2010, 3:49:15 AM9/15/10
to
On Tue, 14 Sep 2010 16:55:03 -0700 (PDT), TideMan <mul...@gmail.com>

wrote in <3ef648b5-7ac8-4bca...@n19g2000prf.googlegroups.com>:
> I want to write the apparent temperature in degrees C:

> 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".

TideMan

unread,
Sep 15, 2010, 4:19:44 AM9/15/10
to
On Sep 15, 7:49 pm, "Dr Ivan D. Reid" <Ivan.R...@ivan.fsnet.co.uk>
wrote:

> On Tue, 14 Sep 2010 16:55:03 -0700 (PDT), TideMan <mul...@gmail.com>

Yeah, well, you may think me an ignorant yokel, but I like there to be
a degree symbol between the number and the C.

Erik Toussaint

unread,
Sep 15, 2010, 7:04:43 AM9/15/10
to
On 15-9-2010 9:49, Dr Ivan D. Reid wrote:
> 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.
>

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.

Dr Ivan D. Reid

unread,
Sep 15, 2010, 9:46:06 AM9/15/10
to
On Wed, 15 Sep 2010 13:04:43 +0200, Erik Toussaint <us...@example.net.invalid>
wrote in <4c90a848$0$778$58c7...@news.kabelfoon.nl>:

> 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,

mecej4

unread,
Sep 15, 2010, 10:44:56 AM9/15/10
to

Something had to be done to avoid using the same symbol for 'celsius' and
'coulomb', the latter having been assigned the symbol C.

-- mecej4

Erik Toussaint

unread,
Sep 15, 2010, 10:46:09 AM9/15/10
to

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.

Rook

unread,
Sep 15, 2010, 2:25:48 PM9/15/10
to
On Wed, 15 Sep 2010 13:04:43 +0200, Erik Toussaint
<us...@example.net.invalid> wrote:

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

dpb

unread,
Sep 15, 2010, 2:34:26 PM9/15/10
to
Rook wrote:
...
> ... temperatures described in absolute

> scale (Kelvins, and Rankins ... if one remembers the anglosaxson scale
> correctly) ....

Close, "Rankine" :)

--

mecej4

unread,
Sep 15, 2010, 3:21:57 PM9/15/10
to
dpb wrote:

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

Fortran_follower

unread,
Sep 16, 2010, 4:21:22 AM9/16/10
to

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..!

Ian

unread,
Sep 16, 2010, 6:44:56 AM9/16/10
to
Hi Ivan,

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 -

jfh

unread,
Sep 16, 2010, 10:58:29 PM9/16/10
to
On Sep 16, 6:25 am, Rook <sebastian_ro...@mail.at.lavabit.com> wrote:
> On Wed, 15 Sep 2010 13:04:43 +0200, Erik Toussaint
>
> <u...@example.net.invalid> wrote:
>
> ...

> (Kelvins, and Rankins ... if one remembers the anglosaxson scale
> correctly) ...

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

Rook

unread,
Sep 17, 2010, 7:01:00 AM9/17/10
to
On Thu, 16 Sep 2010 19:58:29 -0700 (PDT), jfh <john....@vuw.ac.nz>
wrote:

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.

Rook

unread,
Sep 17, 2010, 7:05:01 AM9/17/10
to
On Wed, 15 Sep 2010 20:25:48 +0200, Rook
<sebasti...@mail.at.lavabit.com> wrote:

>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 ..."

glen herrmannsfeldt

unread,
Sep 17, 2010, 2:04:51 PM9/17/10
to
Rook <sebasti...@mail.at.lavabit.com> wrote:
(snip)


> 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.

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

Dr Ivan D. Reid

unread,
Sep 18, 2010, 4:19:58 PM9/18/10
to
On Thu, 16 Sep 2010 03:44:56 -0700 (PDT), Ian <ian_d_...@yahoo.co.uk>

> 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.

Ian Bush

unread,
Sep 20, 2010, 2:56:33 AM9/20/10
to
glen herrmannsfeldt wrote:
> Rook <sebasti...@mail.at.lavabit.com> wrote:
> (snip)
>
>> 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.
>
> 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.

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

glen herrmannsfeldt

unread,
Sep 20, 2010, 11:32:53 AM9/20/10
to
Ian Bush <please@dont_email_me.at.all> wrote:
(snip, I wrote)


>> And we still call them English units, even though England
>> doesn't use them.

> 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,

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

0 new messages