@@ -115,25 +115,9 @@ let float_needs_period s =
115115 false
116116
117117(*
118- Both write_float_fast and write_float guarantee
119- that a sufficient number of digits are printed in order to
120- allow reversibility.
121-
122- The _fast version is faster but often produces unnecessarily long numbers.
118+ Guarantees that a sufficient number of digits are printed in order to allow
119+ reversibility.
123120*)
124- (* unused *)
125- let write_float_fast ob x =
126- match classify_float x with
127- FP_nan ->
128- Buffer. add_string ob " NaN"
129- | FP_infinite ->
130- Buffer. add_string ob (if x > 0. then " Infinity" else " -Infinity" )
131- | _ ->
132- let s = Printf. sprintf " %.17g" x in
133- Buffer. add_string ob s;
134- if float_needs_period s then
135- Buffer. add_string ob " .0"
136-
137121let write_float ob x =
138122 match classify_float x with
139123 FP_nan ->
@@ -192,23 +176,6 @@ let json_string_of_float x =
192176 Buffer. contents ob
193177
194178
195- (* unused *)
196- let write_std_float_fast ob x =
197- match classify_float x with
198- FP_nan ->
199- json_error " NaN value not allowed in standard JSON"
200- | FP_infinite ->
201- json_error
202- (if x > 0. then
203- " Infinity value not allowed in standard JSON"
204- else
205- " -Infinity value not allowed in standard JSON" )
206- | _ ->
207- let s = Printf. sprintf " %.17g" x in
208- Buffer. add_string ob s;
209- if float_needs_period s then
210- Buffer. add_string ob " .0"
211-
212179let write_std_float ob x =
213180 match classify_float x with
214181 FP_nan ->
0 commit comments