• bvs23bkv33 (unregistered)

    magnificient absolute comment!

  • LCrawford (unregistered)

    earlier compilers could not be trusted to find the most efficient way to calculate the exponent

    And yet he trusted the compiler not to use successive approximation for the SQRT?

  • Jaloopa (unregistered)

    Only an Ada deals in absolutes

  • Sole Purpose of VIsit (unregistered)

    MAGRA, good god, What is it good for? ABSOLUTELY NOTHING

  • Foo AKA Fooo (unregistered)

    Somehow abs seems to be a popular target for wannabe optimizers. I remember back in the 1990s, when Usenet was popular, someone proudly posted his hand-optimized inline-assembler version of integer abs in a Turbo Pascal newsgroup. While better than the absolute naive code with branches, it performed worse than even the code TP emitted by default. This means something because while TP was a quick compiler, it barely did any optimization at all.

  • Little Bobby Tables (unregistered)

    (though I’ve never actually heard of anyone using it either…)

    Er yes, that would be us.

    Back in 1987 we designed and built the first commercially-available system built in ADA and deployed as an embedded application on a piece of custom hardware. We delivered it on time, within budget, and it worked first time.

  • maogouste (unregistered)

    ADA is still was in the military domain.

    Some ships, planes and other things are coded in ADA.

    It may explain the 'nobody talks about ada' part, I guess.

  • Laserbrain (unregistered)

    ...not to mention when you pass a large number and get an overflow error...

  • TruePony (unregistered)

    At my current job, we have a screen in our app where the user selects which days in a calendar week they want a specific event to occur. How do you pass around basically 7 Booleans? The old version of that screen chose an integer with bit fiddling... because “optimization”

  • REDACTED (unregistered)

    Ada was created by the US Department of Defense for military purposes. You don't hear much about it because most code written in Ada is classified.

  • Lothar (unregistered)

    Another example for use of ADA is the Ariane rocket's control software, that was mathematically proven to be correct and still lead to the failure of the first launch test (https://en.wikipedia.org/wiki/Ariane_5#Notable_launches). One of the two examples I know of a mathematically proven piece of software that contained a bug.

  • RLB (unregistered)

    Ah yes, the Wrath of Magra.

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    I think we all know how the saying goes... "You can write FORTRAN in any language"

  • Brian (unregistered)

    My main experience with ADA was in one of my earliest jobs working for a defense contractor. Several of the veteran developers who had spend most of their career writing ADA suddenly found themselves working with this newfangled C thing (this is early 2000s, mind you), and not doing a very good job with the transition. So there I was, a still-green college grad, trying to explain pointers to these guys... Ah, memories.

  • Foo AKA Fooo (unregistered) in reply to TruePony

    Bit masks are pretty standard. Optimization might not be the main issue here, but they may actually be more readable and maintainable than 7 separate parameters, and perhaps 7 DB fields to store them etc., if you know understand them. And if you don't understand bit masks (or for that matter, Boolean expressions with more than one operator), you really shouldn't be a programmer.

  • (nodebb) in reply to Brian

    I only used Ada in one course in university. Pointers are called Access types in Ada. If I recall my professor from 30 years ago correctly, the developers of the specification saw the problems that pointers can cause in languages like C, so specified that pointers were not be available in Ada, but the people actually writing the language found them so useful that they stuck a restricted-use pointer (restricted compared to pointers in C) in anyway and called it an Access type. By the time the specification people caught wind of what this Access type really was, it was too late; it had survived too many iterations and approvals of the language so far and too much had been written using it to scrap it and rewrite everything that relied on it to do something else.

  • (nodebb)

    I consistently fail to understand why people think they can "do better" than the folks who designed the language and all its libraries. Sure, some things are WTFs waiting to happen (just look at code written in any language by fresh "developers" who just graduated with a degree in "count from 1 to 300 by 17s and add those numbers up") because of ignorance, but what if RA is an irrational value? Pi?? 1/3???? If you call this an "ABS Function":

    MAGRA := SQRT(RA * RA)

    then not only do you not understand how to use documentation to find out what libraries and built-ins are available, but you probably don't understand Math, Computers, Programming, or Common Sense, either.

    Addendum 2019-12-12 10:11: EDIT: Yes, I realize 1/3 is rational, but I used it to point out the rounding problem

  • Seth S, original poster (unregistered) in reply to Brian

    Ada has access type types, which are better than pointers, and address types which are pointers. I suspect that they were not doing very well before the transition either.

  • Hasseman (unregistered) in reply to Nutster

    A language like Java who has no 'pointers' still throws null pointer exceptions ...

  • (nodebb)

    Ada I do believe I failed you. Ada I know I let you down. Don’t you know I tried so hard to love you in my way? It’s easy let it go…

  • Stranger Things (unregistered)

    Last job - school years 2009, 2010 and 2011. Worked in a vocational shop called programming and web development. previous name was data processing.
    they still taught programming in cobol until about 2006. we taught in visual basic, java and javascript. python may have happened later. big accomplishments for me was getting the name updated to pwd. it amazed me that the future programmers were still being taught cobol rather than something more modern. at this level, the name of the game is to lay down fundamentals and foundations. I am of the age that my high school taught in basic (early 80s) and computer science was taught in C in the late 80s. Why cobol in 2005 was still an appropriate standard in a state that prides itself on being a top leader in public education, still amuses me.

  • Stephen Cleary (unregistered)

    Whenever I think of ADA, I always think of a high school programming competition I participated in. This was in the early '90s in Michigan. Our team came in 2nd; the winning team (which had won many years in a row) used ADA (just like they always did).

    I never learned ADA, but it does hold a kind of mythical presence in my mind ever since then.

  • sizer99 (google)

    Ada was designed by and for the US Defense Department, so when it came out in the early 80s it was (relatively) slow, unwieldy, and very ungainly and verbose - like Pascal, but more (and it has a weird task model). Most people just went 'ffft' and went back to using languages more suited for their own domains - BASIC, C, FORTRAN, COBOL, or ASM.

    Since then the hardware and compilers have more than caught up, and Java is just as unwieldy and verbose. But since Ada still has the 'uncool' stink on it, and a lot of people don't like the US DoD, it mostly only gets used for super-critical applications where you really want all the guarantees it has, usually avionics. If you run into it in school it's usually as a passing curiosity.

    But since we love to re-invent things, Rust is basically the industry re-inventing Ada.

  • Worf (unregistered)

    ADA is a verbose version of Pascal. But ADA's one of the few languages where parallelism is built into the language itself - you can have implicit locking and critical sections and monitors and stuff because it's part of the language without having to manually deal with those things yourself.

    VHDL is also derived from ADA, because hardware is naturally parallel.

    Had to learn it for a parallel programming class. Or was it an OS class, I can't remember. basically everything was happening in parallel and it helped to abstract out the need to worry about mutexes, semaphores and locks.

    And yes, both ADA and VHDL are more DoD things, industry uses other languages for parallel programming and HDLs (i.e., Verilog). (Think of it this way - I took a semester of VHDL to do stuff with it. I had a week of Verilog to get competent in it).

  • Lőrinczy, Zsigmond (github)

    Off: a subset of Ada is known as Oracle PL/SQL

  • Foo AKA Fooo (unregistered) in reply to Bananafish

    Floating and fixed point numbers (which ADA has) cannot represent irrational numbers, including pi. Square and square-root of 1.0/3 has the same rounding error as 1.0/3 itself (which already cannot be represented exactly) in any common FP type.

    So while this method of doing abs is bad, it's not for the reasons you seem to think.

  • kurkosdr (unregistered) in reply to Hasseman

    "A language like Java who has no 'pointers' still throws null pointer exceptions ..."

    This always bugged me. Couldn't they just call it a "null reference exception"? It's not like Java abstracts away the concept of the null reference or something, the only thing it abstracts away is the numerical nature of the pointer (aka you can't add +1 to it to move around the memory), so there is no reason it shouldn't be a "null reference exception".

    Typical Sun Microsystems unix-beards, exposing internal details of the things they are abstracting right and left I guess...

  • unregistered (unregistered) in reply to kurkosdr

    'Couldn't they just call it a "null reference exception"?'

    I'd prefer "null derefence exception. It's not the null reference that's the problem (okay, philosophically, maybe it is - but that's not what there was a problem executing), it's the attempt to dereference it.

  • Zero (unregistered) in reply to Bananafish

    Your point is right. But...

    RA can never be irrational.

    Normal floating point representations are unable to represent irrational numbers. (They may approximate them.) Heck, they don't even represent "all" the rational numbers (even within the range of values that those types support).

    Yes, saying it again, your point is valid: squaring a floating point number and taking the square root may not always bring you back to the exact same number.

  • Simon (unregistered)

    We Ada users like to call it Ada, not (please) ADA. I don’t think you’d write PASCAL, which is also a person’s name.

  • Simon (unregistered) in reply to Lothar

    First, it wasn’t mathematically proven. Second, even if it had been, taking an intertial reference system proven to work on one rocket and use it on another rocket (which happened to have a similar name) without any testing was beyond foolish.

  • Jinks (unregistered)

    If it's IEEE floating point you can just use some pointer massaging and an OR.

  • David Mårtensson (unregistered) in reply to Lothar

    Mathematically correct "according to specification", but the specs might be wrong ;)

    Like the 737 MAX, the code was doing what it was supposed to do, it just did not consider the case when hardware failure supplied incorrect values to begin with.

  • NoName (unregistered) in reply to David Mårtensson

    To my knowledge they simply chose the wrong data type. The old sensor just delivered a byte of acceleration data (e.g. 200 as 2g) and it was used as byte. The new booster delivered 3g (which would be 300 on the same scale).

  • John (unregistered)

    Back in the day I wrote and read a lot of FORTRAN. Don't recall seeing anything as dumb as those ABS simulations.

  • Ulysses (unregistered) in reply to Zero

    Wowzers. Seems like Remy and everybody here fell asleep in math class. In more abstract terms, an absolute value is the distance from the origin. In a vector space, that means the Pythagorean theorem. magra is the magnitude of ra. Ra had a lot of magnitude before O'Neil (that's one L) and Jackson blew him to smithereens.

    function "abs" (Right : Real_Vector) return Real'Base;
    This operation returns the L2-norm of Right (the square root of the inner product of the vector with itself).
    
  • DCL (unregistered) in reply to Stranger Things

    When you think of the billions of lines of COBOL still in daily use all over the world, teaching COBOL is not such a dumb idea. Most of the people who wrote the original code have retired or are about to. So who is going to maintain this legacy code?

  • Zero (unregistered) in reply to Ulysses

    Thou shalt square the components of thy vectors and then square root the sum to find their magnitudes, even though thy vectors are one-dimensional, even though that may cause errors in the magnitudes of thy vectors, lest face the fury of Ulysses.

  • oscar carserud (unregistered)

    There are software errors and there are harware errors, and when the new Ariadne rocket engine output exeeded previous models and caused a vertical owerflow, it was a hardware failure, not a software failure and not a failure with Ada.

  • (nodebb) in reply to Bananafish

    Go read through the .NET reference source and tell me you still trust the designers of the language and its libraries.

  • Kelly (unregistered)

    I wrote a lot of Ada (not "ADA"), mostly early in my career. It was an excellent language for our domain (aerospace/military).

    The worst Ada code was almost always written by former FORTRAN coders. We usually referred to this as "AdaTRAN".

  • (nodebb) in reply to Little Bobby Tables

    The reason there isn't a site for that is that the site itself wouldn't be reliable enough...

  • DW (unregistered)

    I cannot imaging a real FORTRAN coder would do that - I'm confident they would do some sort of fancy bitwise operation in place of calling a built in function (i.e. manually clear the sign bit?). But even though there are efficient bitwise algorithms to sqr and sqrt an integer I'd be very supprised if an old school FORTRAN coder would use them in place of ABS()

  • airdrummer (unregistered)

    i worked on ALSN...Ada Language System/Navy...in the mid '80s. we wrote a text editor & a formatter...ur tax$$$ at work reinventing the wheel;-} but Ada was a pleasure to code in, and certainly helped me transition to oo languages.

    and when john mccormack moved from c to ada in his realtime programming course @ suny/plattsburgh http://archive.adaic.com/projects/atwork/trains.html the number of students successfully completing projects went from ZERO to >75%

    only cult45 would try to ignore that reality

  • (nodebb)

    i worked on ALSN...Ada Language System/Navy...in the mid '80s. we wrote a text editor & a formatter...ur tax$$$ at work reinventing the wheel;-} but Ada was a pleasure to code in, and certainly helped me transition to oo languages.

    and when john mccormack moved from c to ada in his realtime programming course @ suny/plattsburgh http://archive.adaic.com/projects/atwork/trains.html the number of students successfully completing projects went from ZERO to >75%

    only cult45 would try to ignore that reality

Leave a comment on “An Absolute Square”

Log In or post as a guest

Replying to comment #510308:

« Return to Article