SIGN expession and variables starting value

oh my God… I realize just now (after 6 month) that we haven’t the “sign” mathematical expression!!! I need it :grin:

I have another request for Xmas… that will be possible to set starting value for the 6 variables… very useful!!!

@dario.marnoni how do you mean the “sign” exp? Do you mean negative? *-1?

john

no, I mean the mathematical function “Sign” in basic language “SGN”… it returns 1 for positive and -1 for negative numbers

@dario.marnoni that should be equivalent to a conditional testing if the value >= 0, no?

yes, but boolean formulas has not the wanted effect…

  1. (operation) * (condition > 0)… not good

  2. $condition > 0 ? aaaaa : bbbbb $ not good

  3. (operation) * sign(parameter) that’s what I said <<<<<<

for example, if a VAR is negative a formula must become negative and vice versa
(I was buolding a scroll effect connected to INC or DEC of a variable and it must go up or down)

in this watchface I found a workaround: Dario Marnoni - Biorhythm Analogic - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer

$(#DNOW#-#VAR_3_T#)<500?(167+#VAR_5#*(#DNOW#-#VAR_3_T#)/25):167$ is the Y coordinates of the number (day, month or year) when setting birthdate; here VAR_5 is a flag that give the sign to the result but I have to put a INCVAR, a DECVAR and behind a RESET VAR so every time I tap it the variable turn to 0 and then goes to -1 or +1 to have the wanted sign

ahh I see what you’re saying. One way is to shift your mathwork. Whether you are INCVAR or DECVAR, add some big number like 1000 to the var value so the VAR can’t go negative. The user would have to tap 1000 times in one direction to go negative. The user can still tap up and down, but you don’t have to worry about the VAR value crossing over zero.

I did this for changing time zones, then modulus’ing % the result.

Does that help?

Not really… I already use your method.
My intention was to combine the VAR_T with VAR_INC and VAR_DEC in the same formula but my solution works … But anyway SIGN is a standard mathematical function that Facer miss.

ok gotcha