How to create a floating point variable in LANSA - lang

I have something like this
Define Field(#FLTPOINT) Type(*DEC) Length(7) Decimals(0)
I'm not sure if this is the best way to define it in RDML or RDMLX. How do I create a floating point variable in LANSA?
(Actually, are there any LANSA developers out there? I'd never heard of it until I started at this job!)

Your DEFINE will create a fixed length decimal. To create a floating point use;
Define Field(#FLTPOINT) Type(*FLOAT)

Related

Optaplaner - Working with double variable in ConstraintProvider

Is there a way I can use groupBy(ConstraintCollectors.sum(x)) such as x is a variable of type Double ?
I don't want to round it to n decimal pointes then multiply by 10^n. I would like to use the Double variable as is.
As explained in an earlier answer, OptaPlanner does not provide means of working with double.
That said, ConstraintCollectors.sum() is simple and if you look up its implementation, you should be able to implement a double-based one easily. Use with caution.

easiest way to figure out what waiver() is doing?

If one looks at the (e.g.) ggplot2::scale_y_continuous, the default value of many of the arguments is set to waiver(), e.g. for breaks:
‘waiver()’ for the default breaks computed by the
transformation object
How does one figure out/look at how these defaults are computed? Let's say I want to find the breaks for scale_y_log10(). ?scales::log10_trans doesn't say anything about computation of breakpoints.
I think log10_trans()$breaks might do it, which is the same as ?log_breaks. Not sure how to figure this out in general, though ...

Why are constants used instead of variables?

In what general occasions are constants used instead of variables. I need a few examples.
Thanks in advance.
A variable, as the name implies, varies over time. Variables mostly allocate memory. In your code, when you declare that a value will not change, the compiler can do a series of optimizations (no space is allocated for constants on stack) and this is the foremost advantage of Constants.
Update
You may ask why do we use Constants after all?
It's a good question, actually, we can use literal numbers instead of constants. it does not make any difference for the compiler since it sees both the same. However, in order to have a more readable code (--programming good practice), we'd better use constants.
Using constants, you can also save your time!. To be more specific, take below as an example:
Suppose a rate value for some products in a shopping system (rate value = 8.14). Your system has worked with this constant for several months. But then after some months, you may want to change the rate value, right?. What are you going to do? You have one awful option! Changing all the literals numbers which equal 8.14! But when you declare rate as a constant you just need to change the constant value once and then changes will propagate all over the code. So you see that by using constants you do not need to find 8.14's (literal numbers) and change them one by one.
Constants are used when you want to assign a value that doesn't change. This is helpful because if you try to change this, you will receive an error.
It is also great for readability of the code. A person who reads your code will now know that this particular value will never change.
For example:
$name = 'Danny'; // this could change if I ever changed my name
const SECONDS_IN_MINUTE = 60; // this will never change, so we assign it as a constant
You use a constant, when the value of a variable never changes during the lifetime of your program. Once you defined a constant x, you can't change it's value anymore.
Think of pi. Pi is a constant with value 3.1415. This will never change during your programs lifecyle.
const pi = 3.14159265359
When you use a variable instead, you can change it's value as often as you want to.
int x = 1;
x = 7;

wxStaticText inconsistently displays 'degree' character

In the same application I have two different instances of wxStaticText. Each displays an angular value expressed in degrees. I've tested both instances for font name and font encoding. They are the same for both. I've tested that both strings passed to SetLabel() are using the same character value, decimal 176. Yet one displays the 'degree' character (small circle, up high) as expected and the other instead displays an odd character I'm not familiar with. How can this be? Is there some other property of wxStaticText I need to test?
I can't explain what you're seeing because obviously two identical controls must behave in the same way, but I can tell you that using decimal 176 is not a good way to encode the degree sign, unless you explicitly use wxConvISO8859_1 to create the corresponding wxString.
It is better to use wxString::FromUTF8("\xc2\xb0") instead or, preferably, make sure that your source files are UTF-8 encoded and just use wxString::FromUTF8("°").
Arghhhh! Found it. I was assuming SetLabel() was wxStaticText::SetLabel(), inherited from the wxWindow base class. It's not. We have a wrapper class of our own around wxStaticText that I was not aware of. It's the wrapper class that is bollixing the string value.
Moral: When debugging unfamiliar code, don't make assumptions, step ALL THE WAY in.

How do I get the "reverse" tangent in objective-c?

I know that tan(angle) gets me the tangent. But how do I do the "reverse tangent" so that I can get the angle given the length of both sides of the right triangle?
I'm assuming there is a method for this in math.h?
As others have mentioned, atan() is what you're looking for. Generally, the operation is referred to as "inverse tangent" or "arc tangent", not "reverse tangent". The name "atan" comes from "arc tangent". There's also an atan2() function which takes both the X and the Y coordinates as separate paramters and will give you an angle relative to the 0 mark whereas atan() will leave figuring out the quadrant as an exercise for the developer. Beware, however, that the atan2() function on certain older MS environments (or maybe visual studio libraries?) doesn't work quite right...
There should be an atan() function.
For example: http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.7.html
use atan()