Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Compares v with x. Results: 0=EQUAL, 1=v>x, -1=v<x
- [==============================================================================}
- function CompareValE(v, x: Extended): Integer;
- begin
- case (v <> x) of
- True:
- case (v > x) of
- True: Result := 1;
- False: Result := -1;
- end;
- False: Result := 0;
- end;
- end;
- var
- a, b: Extended;
- begin
- a := 100;
- b := 50;
- WriteLn(CompareValE(a, b));
- WriteLn(CompareValE(1, 1));
- WriteLn(CompareValE(b, a));
- end.
Advertisement
Add Comment
Please, Sign In to add comment