title: How to validate a numeric field value in react using Yup? I want to check if the number provided is in increments of 0.01 or 0.1
body: <p>I have the below code to validate the numeric value provide to be an increments of <strong>'fraction'</strong> i provide , which works fine for 0.25 , 0.5 etc but not 0.1 , 0.01 </p>
  
  <pre><code>export function buildFractionStepTest(message: () =&gt; string,fraction: number): Yup.TestOptions{  return {
  name: 'fractionStepNumericValue',
  test: (value: number | null) =&gt;
  typeof value !== 'number' || value % fraction === 0,
  message  };}
  
  ValidationSchema = (): Yup.Schema&lt;any&gt; =&gt; {
  return Yup.object().shape(
    {
  fieldname : Yup.number().test(
  buildFractionStepTest(() =&gt; {
    return `Value for field must be the nearest multiple of ${formattingSettings.step}`;
  }, formattingSettings.step)  );}}    
  </code></pre>
  
  <p>The below two cases are being validated properly</p>
  
  <p>Example : Fraction = 0.5<br>
  Valid Numeric values :0.5 , 1 , 1.5 ,2 etc ( multiples of 0.5)<br>
  Invalid Values : 0.6 , 1.1, 1.3 etc  </p>
  
  <p>Fraction : 0.25
  Valid Values : 0.25 , 0.5 , 0.75 , 1 etc (multiples of 0.25)<br>
  InValid Values : 0.3 ,0.8 , 1.3 ,1.6 etc </p>
  
  <p>Problem arises for<br>
  Fractions : 0.1 / 0.01 </p>