Hi, trying to compare 2 floating point numbers to generate an on/off output
byte = float_eq(float, float) Compares two floating point numbers to see if they are equal
byte = float_ge(float, float) Compares two floating point numbers to see if they are greater then or equal
byte = float_gt(float, float) Compares two floating point numbers to see if they are greater then
byte = float_le(float, float) Compares two floating point numbers to see if they are less then or equal
byte = float_lt(float, float) Compares two floating point numbers to see if they are less the
Seem to be battling with the syntax, byte 0 - 255? So if they are equal for example is the byte output 255 and if unequal, byte output 0?
Floating Point Math
Moderator: Benj
-
- Posts: 9
- Joined: Tue Jun 11, 2019 8:09 am
- Been thanked: 6 times
- Contact:
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Floating Point Math
Hi Smartmultienergy
The result of a comparision will be in general a boolean instead of byte.
boolean= float_eq(float, float)
The boolean will be true or false (with values 1 and 0 respectively)
If you use byte= float_eq(float, float), byte will also be 1 or 0.
kind regards
Jan
The result of a comparision will be in general a boolean instead of byte.
boolean= float_eq(float, float)
The boolean will be true or false (with values 1 and 0 respectively)
If you use byte= float_eq(float, float), byte will also be 1 or 0.
kind regards
Jan
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Floating Point Math
Hello,
In Flowcode 8 you can use the decision icon directly with floats.
For example.
floatA = floatB
The float compare functions are now legacy and were designed as workarounds for the BoostC compiler floating point issues. Note they will still work with the new XC compiler.
In Flowcode 8 you can use the decision icon directly with floats.
For example.
floatA = floatB
The float compare functions are now legacy and were designed as workarounds for the BoostC compiler floating point issues. Note they will still work with the new XC compiler.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel