Convert Varchar field

  • TomThomson - Sunday, August 26, 2018 4:37 PM

    It's very rarely that I disagree with you Jeff, but I think PL/1 was pure crap. 

    I came across it when it was still quite new, and asked IBM (back in 1968, when most of the various computer firms were still ready to help each other, and I worked for EE, a rival of IBM,but that didn't matter a damn when it came to helping each-other technically) for a specification or language defintion for PL1 to help me with my documentation of current computer languages.  They sent me the documentation, no problem.  I read the documentation, and concluded the language was crap - it was pure rubbish compared to CPL (and years later its successors BCPL, B, C and C++) which was itself rubbish anyway. 

    A couple of years later I defended PL1 (despite its awfulness)  against some idiot who claimed that the guidance from IBM for assembly language components added to PL1 programs was wasteful. That resulted in recognition from my CS department head for my letter, and in thanks from a persom at IBM who remembered my contact with them a few years earlier (both my boss at the University and the guy I had had contact with at IBM agreed that PL1 was pure crap, but not as compeletely crap as the guy who attacked IBM's suggestions on assembly-level connections to PL1).

    I only worked with it for a short period (2 months of training and 6 months Dev time or so) but I was able to make it sing and didn't have any problems with the language (my recollection was that it had some pretty cool stuff in it that I took full advantage of).  That was way back in '77-'78 and I could tell you a bit about the actual syntax anymore (although I think I still have the PL1 book I used somewhere).  I can't dispute that it may or may not have been crap... All I can say is that I had no problems at all with it and remember enjoying writing code (punched cards) for it.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • jcelko212 32090 - Friday, August 24, 2018 12:58 PM

    Jeff Moden - Friday, August 24, 2018 12:03 PM

    Man, I loved PL/1.  It was way ahead of it's time.  If you needed something "special", you could also make calls to Fortran and a couple of other languages kind of like what I use xpCmdShell for now.

    And thanks for the history lesson... that's some interesting stuff.  Heh... no wonder they went to the metric system. 😀  I don't know of anyone that has 6 digits on each hand. 😀

    Many decades ago, I was consulting at Coca-Cola in Atlanta. They were trying to convert COBOL over to PL/1 because it was the new cool super language. Since I'd taken computer classes at Georgia Tech, I knew Algol (the school was on a Burroughs 5500) , so my code was pretty good. Other programmers took advantage of this super language being able to be used COBOL or Fortran style. Their code frankly was pretty awful for a block structured language.

    I really hated PL/1 because I thought it was overly complicated, and produced code that was about three times the size of the COBOL it was replacing. Apparently the IBM salesman for Coca-Cola the hell of a good job of selling extra hardware. Then after all that bitching I wound up working for DOD and learning ADA before there were even any compilers for it. I guess it could've been worse; somebody actually wrote in Algol 68 compiler over in the UK. I really hate super languages 🙁

    The first language I used was Algol 68 and I thought it was great, maybe because next on my list was COBOL. Hated that.

  • jcelko212 32090 - Friday, August 24, 2018 12:58 PM

    Many decades ago, I was consulting at Coca-Cola in Atlanta. They were trying to convert COBOL over to PL/1 because it was the new cool super language. Since I'd taken computer classes at Georgia Tech, I knew Algol (the school was on a Burroughs 5500) , so my code was pretty good. Other programmers took advantage of this super language being able to be used COBOL or Fortran style. Their code frankly was pretty awful for a block structured language.

    I really hated PL/1 because I thought it was overly complicated, and produced code that was about three times the size of the COBOL it was replacing. Apparently the IBM salesman for Coca-Cola the hell of a good job of selling extra hardware. Then after all that bitching I wound up working for DOD and learning ADA before there were even any compilers for it. I guess it could've been worse; somebody actually wrote in Algol 68 compiler over in the UK. I really hate super languages 🙁

    Actually there were at least 4 Algol 68 compilers built in Britain. The UK end of Burroughs built an Algol 68 compiler (which did, I believe, get used by the US end) and implemented a mainframe operating system in it - but I don't think it was the whole language.  ICL built two Algol 68 compilers - also not the whole language - for a subset known in ICL as S3, the second one being a replacement for the first one, and again used it to write a series of mainframe operating systems plus quite a bit of middleware (including a bolt-on for IDMS-X that allowed it to be queried - but not written to - in SQL).  And I heard about a compiler for the complete Algol 68 language, but I can't remember who did it. After Fujitsu bought ICL the operating system and the language both continued to be used in Fujitsu, who still sell the OS and sometimes look for S3-capable developers.

    It's not a super-language in the sense of a horrible overcomplicated mess like PL/1 or something throughly declarative - like Haskell or Prolog - (and therfore utterly alien to developers who know only very undeclarative languages such as C++ and PL/1), so I don't see why you call it a super-language; it's extremely simple to learn if you already know one of the earlier Algols (Algol 58, Jovial, Algol 60) - back in 1971 it took me and hour or two to read and understand the user handbook, and then I could learn what was effective by coding things in a few different ways and seeing how they compared on (a) easiness to understand, (b) storage used, (c) performance.

    Tom

  • paul s-306273 - Tuesday, August 28, 2018 1:31 AM

    jcelko212 32090 - Friday, August 24, 2018 12:58 PM

    Jeff Moden - Friday, August 24, 2018 12:03 PM

    Man, I loved PL/1.  It was way ahead of it's time.  If you needed something "special", you could also make calls to Fortran and a couple of other languages kind of like what I use xpCmdShell for now.

    And thanks for the history lesson... that's some interesting stuff.  Heh... no wonder they went to the metric system. 😀  I don't know of anyone that has 6 digits on each hand. 😀

    Many decades ago, I was consulting at Coca-Cola in Atlanta. They were trying to convert COBOL over to PL/1 because it was the new cool super language. Since I'd taken computer classes at Georgia Tech, I knew Algol (the school was on a Burroughs 5500) , so my code was pretty good. Other programmers took advantage of this super language being able to be used COBOL or Fortran style. Their code frankly was pretty awful for a block structured language.

    I really hated PL/1 because I thought it was overly complicated, and produced code that was about three times the size of the COBOL it was replacing. Apparently the IBM salesman for Coca-Cola the hell of a good job of selling extra hardware. Then after all that bitching I wound up working for DOD and learning ADA before there were even any compilers for it. I guess it could've been worse; somebody actually wrote in Algol 68 compiler over in the UK. I really hate super languages 🙁

    The first language I used was Algol 68 and I thought it was great, maybe because next on my list was COBOL. Hated that.

    Thinking about it, it was Algol 60 on an ICL 1904S.
    So, I never got to use Algol 68 or COBOL 80.

  • I think this should be pretty close to what the OP is looking for in terms of results.
    If not, it was still a fun little exercise.
    Please be sure to read the inline comments to make sure you understand how and why it's doing what it's doing...

    IF OBJECT_ID('tempdb..#TestData', 'U') IS NULL
    BEGIN    -- DROP TABLE #TestData;
        CREATE TABLE #TestData (
            orig_string_val VARCHAR(20) NOT NULL
            );

        INSERT #TestData(orig_string_val) VALUES
            ('1"'),
            ('3/4"'),
            ('11/2"'),
            ('13/4"'),
            ('333/4"'),
            ('789"'),
            ('998/9"'),
            ('499/64"'),
            ('888/999"')
            --('7/4"')    --<< a value like this would throw an error.
            ;
    END;

    --===================================================================================
    --===================================================================================
    /*
    The following code operates on the premise that the “original values” are such that the numerator is always smaller than the denominator.
    Any digits that would make the numerator larger are peeled off and considered to be whole numbers.
    This is accomplished starting with a “pre-numerator” and lopping off characters (starting at the left and moving inward.
    Please note, this means that the denominator MUST be larger than the right-most numerator character, otherwise an error will be generated.
    */
    WITH
        cte_split_val AS (    -- Start by cleaning up the original value and splitting it up into pre-numerator & denominator.
            SELECT
                td.orig_string_val,
                --cv.clean_val,    
                --x.string_len,    
                --x.split_location,    
                pre_numerator = SUBSTRING(cv.clean_val, 1, ISNULL(NULLIF(x.split_location -1, -1), x.string_len)),
                denominator = CONVERT(INT, SUBSTRING(cv.clean_val, ISNULL(NULLIF(x.split_location + 1, 1), x.string_len + 1), x.string_len))
            FROM
                #TestData td
                CROSS APPLY ( VALUES (REPLACE(td.orig_string_val, '"', '')) ) cv (clean_val)
                CROSS APPLY ( VALUES (LEN(cv.clean_val), CHARINDEX('/', cv.clean_val)) ) x (string_len, split_location)
            )

            SELECT
                sv.orig_string_val,
                dn.decimal_number            
            FROM
                cte_split_val sv
                CROSS APPLY (    -- Use an inline tally table to help parse the “pre-numerator” into its possible permutations
                                -- and selecting the first value where the “remaining” numerator is less than the denominator.
                    SELECT TOP (1)
                        t.n,
                        SUBSTRING(sv.pre_numerator, t.n, 10)
                    FROM ( VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) ) t (n)
                    WHERE
                        CONVERT(INT, SUBSTRING(sv.pre_numerator, t.n, 10)) < sv.denominator
                        OR
                        sv.denominator = ''
                    ORDER BY
                        t.n
                    ) t (n, numerator)
                CROSS APPLY ( VALUES (
                    CASE        -- Here we are bringing back the whole numbers that were previously removed when determining the actual numerator.
                        WHEN sv.denominator = 0 THEN CONVERT(DECIMAL(9,5), sv.pre_numerator)
                        WHEN t.n = 1 THEN CONVERT(DECIMAL(9,5), 0)
                        ELSE CONVERT(DECIMAL(9,5), SUBSTRING(sv.pre_numerator, 1, t.n - 1))
                    END
                    +
                    CASE    -- and adding the result of deviding the numerator by the denominator.
                        WHEN sv.denominator = 0 THEN 0
                        ELSE (CONVERT(DECIMAL(9,5), t.numerator) / CONVERT(DECIMAL(9,5), sv.denominator))
                    END
                    ) ) dn (decimal_number);

    Results...
    orig_string_val  decimal_number
    -------------------- ---------------------------------------
    1"     1.000000000000000
    3/4"    0.750000000000000
    11/2"    1.500000000000000
    13/4"    1.750000000000000
    333/4"    33.750000000000000
    789"    789.000000000000000
    998/9"    99.888888888888888
    499/64"   49.140625000000000
    888/999"   0.888888888888888

    Hope this helps,
    Jason

  • Jason A. Long - Tuesday, August 28, 2018 4:04 PM

    orig_string_val  decimal_number
    -------------------- ---------------------------------------
    1"     1.000000000000000
    3/4"    0.750000000000000
    11/2"    1.500000000000000
    13/4"    1.750000000000000
    333/4"    33.750000000000000
    789"    789.000000000000000
    998/9"    99.888888888888888
    499/64"   49.140625000000000
    888/999"   0.888888888888888

    Hope this helps,
    Jason

    I don't understand why you convert 11/2 to be 1.5? I could see it if there were a space i.e. 1 1/2 but 11/2 is 6.5

  • Jonathan AC Roberts - Tuesday, August 28, 2018 4:23 PM

    Jason A. Long - Tuesday, August 28, 2018 4:04 PM

    orig_string_val  decimal_number
    -------------------- ---------------------------------------
    1"     1.000000000000000
    3/4"    0.750000000000000
    11/2"    1.500000000000000
    13/4"    1.750000000000000
    333/4"    33.750000000000000
    789"    789.000000000000000
    998/9"    99.888888888888888
    499/64"   49.140625000000000
    888/999"   0.888888888888888

    Hope this helps,
    Jason

    I don't understand why you convert 11/2 to be 1.5? I could see it if there were a space i.e. 1 1/2 but 11/2 is 6.5

    Actually, 11/2 is 5.5... but I know what you're getting at. To answer your question, it was a pure judgement call on my part. 
    No one other than a complete psycopath would would write 5.5 as 11/2, so it seemed (at least to me) that it made more sense as 1 1/2, just missing the space.
    Then again it would take a psychopath to record 1.5 as 11/2 (without a space) too... So, I'm open to the idea that I got it wrong. Hopefully the OP will be back to clarify.

  • Gotta love people that post a question and then disappear after just a couple of hours.  After 5 days, I wouldn't expect much.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jason A. Long - Tuesday, August 28, 2018 5:07 PM

    Jonathan AC Roberts - Tuesday, August 28, 2018 4:23 PM

    Jason A. Long - Tuesday, August 28, 2018 4:04 PM

    orig_string_val  decimal_number
    -------------------- ---------------------------------------
    1"     1.000000000000000
    3/4"    0.750000000000000
    11/2"    1.500000000000000
    13/4"    1.750000000000000
    333/4"    33.750000000000000
    789"    789.000000000000000
    998/9"    99.888888888888888
    499/64"   49.140625000000000
    888/999"   0.888888888888888

    Hope this helps,
    Jason

    I don't understand why you convert 11/2 to be 1.5? I could see it if there were a space i.e. 1 1/2 but 11/2 is 6.5

    Actually, 11/2 is 5.5... but I know what you're getting at. To answer your question, it was a pure judgement call on my part. 
    No one other than a complete psycopath would would write 5.5 as 11/2, so it seemed (at least to me) that it made more sense as 1 1/2, just missing the space.
    Then again it would take a psychopath to record 1.5 as 11/2 (without a space) too... So, I'm open to the idea that I got it wrong. Hopefully the OP will be back to clarify.

    It was a bit past my bedtime when I last commented. But it seems better to write a top heavy fraction than use a method that has ambiguous values. For example is 888/999 really 888/999 or is it 8 88/999 or maybe 88 8/999? If you think it's one then how would you write the others?

  • Jonathan AC Roberts - Wednesday, August 29, 2018 3:41 AM

    It was a bit past my bedtime when I last commented. But it seems better to write a top heavy fraction than use a method that has ambiguous values. For example is 888/999 really 888/999 or is it 8 88/999 or maybe 88 8/999? If you think it's one then how would you write the others?

    Either way, it's an insane way of recording data... Once that simple but obvious truth has been estabolished, we're free to make whatever assumptions we want. Especially since the OP hasn't offered up any guidance on the matter.
    I do see your point... Based on my intrepritation, there would be certain values that would be impossible to record accuratly. But... Here's the thing... Given that there are two possible intrepitations, one makes for an interesting and somewhat challenging problem, the other doesn't. I opted to take on the interesting version. I'm not trying to convince you that my inreipitation is correct. 
    If it turns out that you're correct (entirely possible) the code I provided can be easily modified to accomodate it. Simply skip the steps involving the splitting of the "pre-numerator" into whole number & numerator and simply use the pre-numerator as the numerator. Easy-peezy & boring. 😀

  • Jeff Moden - Tuesday, August 28, 2018 7:04 PM

    Gotta love people that post a question and then disappear after just a couple of hours.  After 5 days, I wouldn't expect much.

    Seems like that's par for the course...
    I'm not too worried about it though. I had a bit of free bandwidth yesterday afternoon and this seemed like an interesting problem.

  • jcelko212 32090 - Friday, August 24, 2018 10:47 AM

    In the US, the smallest fraction of an inch used in engineering and manufacturing is 1/64, which works out to 0.015625 as a decimal. This would be DECIMAL (n,6) . For whatever value of (n) make sense for your application. You can write a simple program to slice off the whole number and fraction, lookup the fractions value and put them together. The only problem is you also have to repeat this sort of lookup for 1/2, 1/4, 1/8, 1/16, and 1/32. This gives you a lookup table with less than 200 rows.

    CREATE TABLE Proper_Fractions
    (denominator INTEGER NOT NULL,
    numerator INTEGER NOT NULL,
    PRIMARY KEY (denominator, numerator),
    CHECK (denominator > numerator),
    decimal_value DECIMAL (12,6) NOT NULL);

    If you have the time, get a good history of mathematics book and look up the stories of how decimal fractions came to be used (there were actually coins, currency, bonds, etc. denominated with proper fractions. Prior to decimalization in 1971 Britain used a system of pounds, shillings and pence. The smallest unit of currency was a penny, the plural of which was pence (or pennies). There were 12 pence in a shilling and 20 shillings in a pound. One of the classic programming problems back then was writing programs that could figure out, coin by coin, to put money in a pay envelope. The first version of PL/1 actually had built-in functions for this! Then they went decimal and didn't need this monster anymore.

    Joe,
    in the UK we used thou for tight tolerance engineering but the fractional nomenclature was commonplace.
    There were also coins smaller than a penny - plural pennies not pence - the halfpenny and the farthing (1 quarter penny) were still in use at decimalisation in 1971 although there were smaller denomination coins at earlier times usually using binary fractions but there were some decimal coins at some points . After that the new coin was called a "new pence" to differentiate it from the pre decimal "penny" although it commonly was (and still is) called a penny.
    If you really want to give your students a challenge have them use guineas (21 shillings to the guinea) rather than pounds and throw in a few tanners, groats, crowns and florins into the pay packet.

  • crmitchell - Wednesday, August 29, 2018 7:42 AM

    jcelko212 32090 - Friday, August 24, 2018 10:47 AM

    In the US, the smallest fraction of an inch used in engineering and manufacturing is 1/64, which works out to 0.015625 as a decimal. This would be DECIMAL (n,6) . For whatever value of (n) make sense for your application. You can write a simple program to slice off the whole number and fraction, lookup the fractions value and put them together. The only problem is you also have to repeat this sort of lookup for 1/2, 1/4, 1/8, 1/16, and 1/32. This gives you a lookup table with less than 200 rows.

    CREATE TABLE Proper_Fractions
    (denominator INTEGER NOT NULL,
    numerator INTEGER NOT NULL,
    PRIMARY KEY (denominator, numerator),
    CHECK (denominator > numerator),
    decimal_value DECIMAL (12,6) NOT NULL);

    If you have the time, get a good history of mathematics book and look up the stories of how decimal fractions came to be used (there were actually coins, currency, bonds, etc. denominated with proper fractions. Prior to decimalization in 1971 Britain used a system of pounds, shillings and pence. The smallest unit of currency was a penny, the plural of which was pence (or pennies). There were 12 pence in a shilling and 20 shillings in a pound. One of the classic programming problems back then was writing programs that could figure out, coin by coin, to put money in a pay envelope. The first version of PL/1 actually had built-in functions for this! Then they went decimal and didn't need this monster anymore.

    Joe,
    in the UK we used thou for tight tolerance engineering but the fractional nomenclature was commonplace.
    There were also coins smaller than a penny - plural pennies not pence - the halfpenny and the farthing (1 quarter penny) were still in use at decimalisation in 1971 although there were smaller denomination coins at earlier times usually using binary fractions but there were some decimal coins at some points . After that the new coin was called a "new pence" to differentiate it from the pre decimal "penny" although it commonly was (and still is) called a penny.
    If you really want to give your students a challenge have them use guineas (21 shillings to the guinea) rather than pounds and throw in a few tanners, groats, crowns and florins into the pay packet.

    Sixpence piece? Tuppence ha'penny? Threepenny bit?
    Think we had pence as well as pennies.

  • paul s-306273 - Wednesday, August 29, 2018 8:24 AM

    crmitchell - Wednesday, August 29, 2018 7:42 AM

    jcelko212 32090 - Friday, August 24, 2018 10:47 AM

    In the US, the smallest fraction of an inch used in engineering and manufacturing is 1/64, which works out to 0.015625 as a decimal. This would be DECIMAL (n,6) . For whatever value of (n) make sense for your application. You can write a simple program to slice off the whole number and fraction, lookup the fractions value and put them together. The only problem is you also have to repeat this sort of lookup for 1/2, 1/4, 1/8, 1/16, and 1/32. This gives you a lookup table with less than 200 rows.

    CREATE TABLE Proper_Fractions
    (denominator INTEGER NOT NULL,
    numerator INTEGER NOT NULL,
    PRIMARY KEY (denominator, numerator),
    CHECK (denominator > numerator),
    decimal_value DECIMAL (12,6) NOT NULL);

    If you have the time, get a good history of mathematics book and look up the stories of how decimal fractions came to be used (there were actually coins, currency, bonds, etc. denominated with proper fractions. Prior to decimalization in 1971 Britain used a system of pounds, shillings and pence. The smallest unit of currency was a penny, the plural of which was pence (or pennies). There were 12 pence in a shilling and 20 shillings in a pound. One of the classic programming problems back then was writing programs that could figure out, coin by coin, to put money in a pay envelope. The first version of PL/1 actually had built-in functions for this! Then they went decimal and didn't need this monster anymore.

    Joe,
    in the UK we used thou for tight tolerance engineering but the fractional nomenclature was commonplace.
    There were also coins smaller than a penny - plural pennies not pence - the halfpenny and the farthing (1 quarter penny) were still in use at decimalisation in 1971 although there were smaller denomination coins at earlier times usually using binary fractions but there were some decimal coins at some points . After that the new coin was called a "new pence" to differentiate it from the pre decimal "penny" although it commonly was (and still is) called a penny.
    If you really want to give your students a challenge have them use guineas (21 shillings to the guinea) rather than pounds and throw in a few tanners, groats, crowns and florins into the pay packet.

    Sixpence piece? Tuppence ha'penny? Threepenny bit?
    Think we had pence as well as pennies.

    tuppence is a decimal coin - there may have been some half groat coins at some time but generally the next coin up from the penny was the thru'p'ny .bit.
    sixpence was the name of the coin commonly called a tanner or a half bob - you could change it to 6 pennies or 2 1/2 new pence. the 1d coin was called the penny not a pence.

  • crmitchell - Wednesday, August 29, 2018 9:53 AM

    paul s-306273 - Wednesday, August 29, 2018 8:24 AM

    crmitchell - Wednesday, August 29, 2018 7:42 AM

    Joe,
    in the UK we used thou for tight tolerance engineering but the fractional nomenclature was commonplace.
    There were also coins smaller than a penny - plural pennies not pence - the halfpenny and the farthing (1 quarter penny) were still in use at decimalisation in 1971 although there were smaller denomination coins at earlier times usually using binary fractions but there were some decimal coins at some points . After that the new coin was called a "new pence" to differentiate it from the pre decimal "penny" although it commonly was (and still is) called a penny.
    If you really want to give your students a challenge have them use guineas (21 shillings to the guinea) rather than pounds and throw in a few tanners, groats, crowns and florins into the pay packet.

    Sixpence piece? Tuppence ha'penny? Threepenny bit?
    Think we had pence as well as pennies.

    tuppence is a decimal coin - there may have been some half groat coins at some time but generally the next coin up from the penny was the thru'p'ny .bit.
    sixpence was the name of the coin commonly called a tanner or a half bob - you could change it to 6 pennies or 2 1/2 new pence. the 1d coin was called the penny not a pence.

    There's so much wrong there!  Halfpennies and farthings were not in use at decimalisation in 1971 - that's pure nonsense.   The history of Brtish coinage/currency is very well documented; and there are pleny of us still around who were old enough to be married and have children and have to worry about money back in 1971 who noticed what happened then, and as a result can explain to you how wrong you are.  It appears that we also speak an English language that it is foreign to you, as "pence" was an accepted plural for "penny" when discussing value (as opposed to penny coins) when I first learnt the words, more that 20 years before 1971.
    Halfpenny coins ceased to be legal tender in 1969.  The last halfpenny coins that were legal tender were minted in 1967.   In 1970 a set of souvenir halfpenny pseudocoins were minted as souvenirs of the predecimal age - these were never legal tender.
    The halfpenny coin ceased to be something that could be used to pay in 1969, two years before 1971 - it was alreasy no longer British currency 2 years before 1971.
    Farthing coins ceased to be legal tender in 1960.  They were last minted in 1956.  They were certainly not British currency all the way up to 1971.
    Tuppence can indeed mean a decimal coin.  However, throughout the 19th centurey and in the twentieth century until 1971 (and in practise for a good time afterwards) it meant a value/price/cost, not a coin, of one sixth of a shilling, 
    You seem not to distinguish between the name of a coin and the name iof its value.  A penny was a coin. It was also a value.  The two meanings had different plurals.  Three pence meant three penny coins.  Threpence meant the value of 3 penny coins or of one threpenny bit.  People said "three hapence" for a value/price/cost of one and half pennnies but when they were referring to an out of date bicycle (whose wheels were different sizes, as were a penny and a halfpenny) they said "penny halfpenny" because the bike's wheels were in the proportion of the coins.
    Your last few words seem to suggest that you call a 1p coin "a pence" - well, most of us call it a penny.   It's worth a lot less than a old-style penny in 1971, of course: 1d 1971 = 4.118p 2018 on the most optimistic estimate (the one chosen by politicians who want to pretend we are so much better off that we actually are) , but it's nearer to 12.5p if we measure by the typical price of a pint of bitter in a pub and even more if we look at the price of milk or at house prices and rents.

    Tom

Viewing 15 posts - 16 through 30 (of 41 total)

You must be logged in to reply to this topic. Login to reply