Live data from Hacker News

The Power C Compiler

mixsoftware.com

41–50 of 77 posts

Re: The Power C Compiler

#41
post #29

Earlier quoted context omitted.

Financial calculations need to be done with fixed-point, not floating-point, arithmetic. Floating-point can't store the exact value of most fractional numbers, and especially over many transactions for many customers the floating-point errors will accumulate. You need basic addition and subtraction to always be exact (e.g. $15.27 + $91.31 needs to come out as $106.58, not $106.5799999999999999999998), and for operati…

Why would you ever want monetary amounts as fractions or any kind? Why would you want to separate dollars from cents? Just represent them in cents or other smallest units ($15.27 would be 1527), and only make the distinction between dollars and cents for human-readable output. Problem solved. I don't understand what BCD would solve here vs plain binary integers.

When currencies are represented as integers you have trouble doing transactions in multiple currencies.

Floating point is out of the question, so division, multiplication, etc was more accurate in BCD than in integers when different currencies were involved.

Re: The Power C Compiler

#42
post #7

> binary coded decimal floating point routines and financial functions for calculating the time value of money, depreciation, etc Wow what was the utility of BCD for these applications? My only experience with BCD is with RTCs. I always assumed that the RTCs had been designed for driving a simple display like 7-segment lcd. But doing floating point in BCD? I guess the 8087 wasn't common yet but maybe soft float using…

Financial calculations need to be done with fixed-point, not floating-point, arithmetic. Floating-point can't store the exact value of most fractional numbers, and especially over many transactions for many customers the floating-point errors will accumulate. You need basic addition and subtraction to always be exact (e.g. $15.27 + $91.31 needs to come out as $106.58, not $106.5799999999999999999998), and for operati…

Actually it's worse than that; they're talking about decimal floating point, which appears to work in obvious tests - $15.270 + $91.310 is $106.58. But (assuming 5 mantissa digits for example, but it works with any number), you can do the following:

  balance   91.31 [+291310]
         +1000.00 [+410000] temporary credit
  balance 1091.30 [+410913] ULP lost
         -1000.00 [-410000] temporary credit deducted
  balance   91.30 [+291300] successfully stole 1 cent
  repeat on each account/transaction/etc
Real examples are obviously less blatant than this, but you get the idea.

Decimal floating point should never be supported for anything in any capacity, and use of any floating point in financial software should be considered material proof of either gross incompentence or negligence, or intent to commit fraud.

Re: The Power C Compiler

#43
post #29

Earlier quoted context omitted.

Financial calculations need to be done with fixed-point, not floating-point, arithmetic. Floating-point can't store the exact value of most fractional numbers, and especially over many transactions for many customers the floating-point errors will accumulate. You need basic addition and subtraction to always be exact (e.g. $15.27 + $91.31 needs to come out as $106.58, not $106.5799999999999999999998), and for operati…

Why would you ever want monetary amounts as fractions or any kind? Why would you want to separate dollars from cents? Just represent them in cents or other smallest units ($15.27 would be 1527), and only make the distinction between dollars and cents for human-readable output. Problem solved. I don't understand what BCD would solve here vs plain binary integers.

> Why would you ever want monetary amounts as fractions or any kind?

If you can exchange arbitrary currency (and other commodity) in specified whole units with no other restrictions, then if you need to track prices, the prices need to be tracked as arbitrary rational numbers.

BCD is, of course, inadequate for that, but it's the most general reason for why monetary amounts may need fractions, IMO.

BCD does mean that when the requirements change from “we need to track to the cent” to “we need to track to the mil”, you change one constant as to the minimum allowed precision, and no other code or existing data. Whereas “use integer multiples of the minimum unit” makes that messier. Also, if you have different minimum units in different parts of an enterprise, using BCD makes sharing between them easier.

Re: The Power C Compiler

#44
post #25

Earlier quoted context omitted.

It was just the way things were back then. Compilers were expensive too. In the late 80s I saved up my allowance money for months to buy a Modula-2 compiler for my Atari ST. I still remember reading the manual on my way home from the city, floppies in hand. In the 80s there was a vibrant shareware & public domain scene, but 'open source' wasn't nearly what it is today, and shareware & PD things were mostly utilities,…

To be fair, this particular compiler was relatively cheap. The number £30 springs to mind (which included the book), but I'm not sure if that was the price or just my faulty memory. The internet wasn't a thing for home users in 1989. Only a couple of years later I had access to the internet and was downloading DJGPP. Fun fact is I now work with DJ.

> Fun fact is I now work with DJ.

Would you mind to tell us what you do? I can only imagine legacy or a mix of legacy and highly specialized niches using DJGPP nowadays.

Re: The Power C Compiler

#46
post #25

Earlier quoted context omitted.

To be fair, this particular compiler was relatively cheap. The number £30 springs to mind (which included the book), but I'm not sure if that was the price or just my faulty memory. The internet wasn't a thing for home users in 1989. Only a couple of years later I had access to the internet and was downloading DJGPP. Fun fact is I now work with DJ.

> Fun fact is I now work with DJ. Would you mind to tell us what you do? I can only imagine legacy or a mix of legacy and highly specialized niches using DJGPP nowadays.

DJ is a well-known compiler developer at Red Hat who is also working on Arm and RISC-V support (https://www.delorie.com/users/dj/). I work at Red Hat on Arm & RISC-V (amongst a few other things).

Re: The Power C Compiler

#47
This was the compiler I learned to code on - $20 was great for a student budget. If you click through the pages you can also find their database toolchest which is a great introduction to btrees and managing storage.

Re: The Power C Compiler

#48
post #46

Earlier quoted context omitted.

> Fun fact is I now work with DJ. Would you mind to tell us what you do? I can only imagine legacy or a mix of legacy and highly specialized niches using DJGPP nowadays.

DJ is a well-known compiler developer at Red Hat who is also working on Arm and RISC-V support ( https://www.delorie.com/users/dj/ ). I work at Red Hat on Arm & RISC-V (amongst a few other things).

Ah... right... you work with DJ, the person!

I thought you used DJGPP on your work.

Re: The Power C Compiler

#49

Earlier quoted context omitted.

Having to pay for a compiler sounds a little funny through the lens of 2022; I wonder if the majority of people buying these software/packages at the time found the idea strange, too.

Turbo Pascal was a bargain at $49 when it was introduced, and remained a bargain as the delay loops were removed from the compiler (according to rumor), and features were added. Delphi at $200 was still a good deal... then the price shot through the roof. Oh, and it had a REALLY good manual and online help.

Just yesterday I commented to a clerk at a used bookstore that hers was probably the only one in the U.S. with 3 Turbo Pascal books.

Re: The Power C Compiler

#50
post #36

That looks like the Go logo. Did the Go creators reuse one of the C logos? (Yes yes, Unix lineage)

Nope, first they started with Gopher that was based on Glenda. https://9p.io/plan9/glenda.html Then because it wasn't deemed professional enough, a marketing campaign was created for the current logo. https://go.dev/blog/go-brand

The Gopher is the mascot, not the logo, always has been. The original Go logo was this: https://go.dev/blog/gopher/logo.png
Post reply on HN