<commit_before>
package body peak is

  procedure max (x,y : in Float; r : out Float) is
  begin
    if x >= y then
      r := x;
    else
      r := y;
    end if;
  end max;

  procedure coeffs (y1,y2,y3 : in Float; a,b,c : out Float) is
  begin
    a := -- 0.5*(y1-2*y2+y3)
      numeric.times(
        0.5,
        numeric.plus(
          y1,
          numeric.plus(
            numeric.times(-2.0,y2),
            y3)));
    b := -- 0.5*(y3-y1)
      numeric.times(0.5,numeric.minus(y3,y1));
    c := y2;
  end coeffs;

  procedure peakQ (a,b,c,x : in Float; r : out Float) is
    ghost : Float;
  begin
    ghost := a+(x-x); 
    r :=
      numeric.minus(
        c,
        numeric.divide(
          numeric.times(b,b),
          numeric.times(4.0,ghost)));
  end peakQ;

  procedure peakUnit (y1,y2,y3 : in Float; r : out Float) is
    a,b,c,m1,m2 : Float;
  begin
    max(y1,y3,m1);
    coeffs(y1,y2,y3,a,b,c);
    if a < -0.2 and 2.0*a <= b and b <= -2.0*a then -- poly has peak within [-1,1]
      peakQ(a,b,c,0.0,m2);<commit_msg>weaken guard in peakunit to match peakq precondition<commit_after>
package body peak is

  procedure max (x,y : in Float; r : out Float) is
  begin
    if x >= y then
      r := x;
    else
      r := y;
    end if;
  end max;

  procedure coeffs (y1,y2,y3 : in Float; a,b,c : out Float) is
  begin
    a := -- 0.5*(y1-2*y2+y3)
      numeric.times(
        0.5,
        numeric.plus(
          y1,
          numeric.plus(
            numeric.times(-2.0,y2),
            y3)));
    b := -- 0.5*(y3-y1)
      numeric.times(0.5,numeric.minus(y3,y1));
    c := y2;
  end coeffs;

  procedure peakQ (a,b,c,x : in Float; r : out Float) is
    ghost : Float;
  begin
    ghost := a+(x-x); 
    r :=
      numeric.minus(
        c,
        numeric.divide(
          numeric.times(b,b),
          numeric.times(4.0,ghost)));
  end peakQ;

  procedure peakUnit (y1,y2,y3 : in Float; r : out Float) is
    a,b,c,m1,m2 : Float;
  begin
    max(y1,y3,m1);
    coeffs(y1,y2,y3,a,b,c);
    if a < -0.1 and 2.0*a <= b and b <= -2.0*a then -- poly has peak within [-1,1]
      peakQ(a,b,c,0.0,m2);
{'fraction_non_alphanumeric': 0.1621876473361622, 'fraction_numerical': 0.0462046204620462, 'mean_word_length': 1.8143236074270557, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490314', 'n_tokens_mistral': 916, 'n_tokens_neox': 891, 'n_words': 218}