What does the fraction math node do?

I am trying to learn some procedural basics. Could you tell me what the fraction math node does? Is the result similar to modulo?

Fract returns the fractional part of a floating-point value, as described by @Merlin, but its treatment of negative fractional parts is not actually the same as Blender's implementaion of Modulo.

If you want to see what a mathematical chunk of your shader tree is doing, it can be quite handy to make it generate a graph.

Fract:

This plane is 8x8 units, with its origin, (so (0,0)), at its center. I've added the annotations, but you can see the function without them.

Modulo 1:

Thanks to @Rich Sedman for this very useful tip.

• Check out page 12 in this scrapbook below. I reconstructed Rich Sedman's node tree and experimentally played around with the settings in nodes. After that, I achieved over 16 interesting different patterns. docs.google.com/presentation/d/… – Rita Geraghty stands by Monica Nov 26 '19 at 13:03
• Merlin, it is good to know usage of each node. I previously didn't know what modulo node was for. There are not many Blenderheads who are good at mathematics. I am relearning mathematics as a hobby. – Rita Geraghty stands by Monica Nov 26 '19 at 13:08
• @Merlin.. Nothing wrong with your answer, ( I UV'd it :) ) It was only after posting I remembered how often the Blender node mod had caught me out, before I made my own group to do it, and edited the answer.. In GLSL, for example, mod(x,1) and fract(x) would be the same.. it's language dependent. A gotcha, not a bug, AFAIK. – Robin Betts Nov 26 '19 at 14:14
• It's good to visualize how Blender implements these, they do not always follow mathematical principle, but will favour artistic usefulness. I have updated my answer accordingly – Moog Nov 26 '19 at 14:16
• @RitaGeraghty .. some nice explorations! Recommend visiting shadertoy and having a go at translating some of those into Blender nodes, if you want a real work-out! :) – Robin Betts Nov 26 '19 at 14:25

Mathematically it should return the fractional part of the number i.e the non whole-number part, but the blender implementation is artistic in it's implementation.

For non-negative numbers this is equivalent to using the modulo with a factor of 1.0

For negative numbers it is equivalent to using modulo with a factor of -1.0

The equivalent node setup of the fraction node would be: