# Functions branch: Add more Float Math opsAcceptedPublicActions

Authored by artem ivanov (ixd) on Wed, Aug 7, 7:41 PM.

# Details

Reviewers
 Jacques Lucke (JacquesLucke)
Summary

• Subtract
• Divide
• Power
• Log
• Square Root
• Absolute
• Modulo
• Cosine
• Tangent
• Arcsine
• Arccosine
• Arctangent
• Arctan2
• Fract
• Ceil
• Floor
• Round
• Snap

Notes:
None in EnumProperty is a separator.
May corrupt .blend files that used Float Math node with Multiply, Min, Max, Sin (Enum values are changed)

# Diff Detail

Repository
rB Blender

### Event Timeline

artem ivanov (ixd) retitled this revision from Functions branch: Add more Float Math nodes to Functions branch: Add more Float Math ops.

We need to create tasks so we donβt end up working on the same thing

Yeah right π

Iβm working on the vector math node

Jacques Lucke (JacquesLucke) requested changes to this revision.Wed, Aug 7, 8:00 PM
source/blender/functions/functions/scalar_math.cpp
142

what is intpt? Please use a more descriptive name.

166

I think in this case you can also just return zero. Don't try to be clever.

187

how are negative numbers handled?

377

I think we should assert isfinite instead of having a condition. Same above.

This revision now requires changes to proceed.Wed, Aug 7, 8:00 PM
source/blender/functions/functions/scalar_math.cpp
187

sasqrtf takes care of it.

```source/blender/blenlib/intern/math_base_inline.c:159

MINLINE float sasqrtf(float fac)
{
if (UNLIKELY(fac <= 0.0f)) {
return 0.0f;
}
else {
return sqrtf(fac);
}
}```
source/blender/functions/functions/scalar_math.cpp
377

isfinite is pretty cheap function (something like fabsf(value) <= FLT_MAX). Inf can happen when user is tweaking nodes (e.g. pow -> multiply -> pow chain can produce such values fairly easy for 32-bit floats). So IMHO no need to crash in such a case.

• more descriptive var name (scalar_math.cpp:142)
• logarithm logic fix
artem ivanov (ixd) marked 4 inline comments as done.Mon, Aug 12, 3:39 PM
This revision is now accepted and ready to land.Mon, Aug 12, 4:28 PM